[library] moonshine – Chainable post-processing shaders for LÖVE.
Posted: Tue Oct 31, 2017 3:41 pm
TL;DR: shine version 2.0: Better API, better performance, better name.
Less than 10 lines of code to transform this: into this:
Lövers,
ever since shaders were first added to LÖVE, I had this idea of a vast repository of common post-processing shaders that you could just staple on top of your game with a few lines of code. This repository would be open, so that anybody that cared and could would contribute to it.
Unfortunately, this idea would require abstractions and restrictions. Unfortunately, because this clashes with the goal and scope of LÖVE. LÖVE provides the tools you need to make great games, without imposing any artificial limits on what you can and cant do. This is the reason why LÖVE is great, but it means that sometimes things are not as easy as they could be.
A few years back I released shine to fill the gap. You can see how my vision influenced the design : adding post processing shaders to your game requires only a few lines of code. However, the backend, that is, the actual implementation of the shaders, was horrible. Just horrible. The API was a nightmare. I mean, look at this! Who is supposed to write this, let alone understand whats going on? Yuck. Still, awesome people contributed cool effects like pixelate and scanlines, light scattering and gameboy color emulation, or barrel distortion and a sketch effect.
Recently, josefnpat and I worked on a thing which used shine. As the machine we were given was not all that powerful, I ended up re-implemented the effects in two custom shaders. When done, I realized that this new code could be abstracted and be the basis for a rewrite of shine. That day was the birthday of shine 2.0, or, as it should henceforth be known: moonshine*.
Moonshine does everything shine does, but better. It is (way) easier to write effects (example), chaining multiple effects (what you normally do) is much more performant, and some idiocies were fixed. The README documents all effects and contains small tutorials on both how to use the lib and how to contribute effects.
There is also a demo to show off and experiment with the effects. It is attached to this post, but I don't recommend looking at the code to learn moonshine: most of it is used to construct the GUI (though you might learn a thing or two about suit).
Anyway, enough with the wall of text already. Here is the code: moonshine
Enjoy!
* I realize there is also moonshine, the Lua interpreter for the browser, but the name just fits
Less than 10 lines of code to transform this: into this:
Lövers,
ever since shaders were first added to LÖVE, I had this idea of a vast repository of common post-processing shaders that you could just staple on top of your game with a few lines of code. This repository would be open, so that anybody that cared and could would contribute to it.
Unfortunately, this idea would require abstractions and restrictions. Unfortunately, because this clashes with the goal and scope of LÖVE. LÖVE provides the tools you need to make great games, without imposing any artificial limits on what you can and cant do. This is the reason why LÖVE is great, but it means that sometimes things are not as easy as they could be.
A few years back I released shine to fill the gap. You can see how my vision influenced the design : adding post processing shaders to your game requires only a few lines of code. However, the backend, that is, the actual implementation of the shaders, was horrible. Just horrible. The API was a nightmare. I mean, look at this! Who is supposed to write this, let alone understand whats going on? Yuck. Still, awesome people contributed cool effects like pixelate and scanlines, light scattering and gameboy color emulation, or barrel distortion and a sketch effect.
Recently, josefnpat and I worked on a thing which used shine. As the machine we were given was not all that powerful, I ended up re-implemented the effects in two custom shaders. When done, I realized that this new code could be abstracted and be the basis for a rewrite of shine. That day was the birthday of shine 2.0, or, as it should henceforth be known: moonshine*.
Moonshine does everything shine does, but better. It is (way) easier to write effects (example), chaining multiple effects (what you normally do) is much more performant, and some idiocies were fixed. The README documents all effects and contains small tutorials on both how to use the lib and how to contribute effects.
There is also a demo to show off and experiment with the effects. It is attached to this post, but I don't recommend looking at the code to learn moonshine: most of it is used to construct the GUI (though you might learn a thing or two about suit).
Anyway, enough with the wall of text already. Here is the code: moonshine
Enjoy!
* I realize there is also moonshine, the Lua interpreter for the browser, but the name just fits