[library] moonshine – Chainable post-processing shaders for LÖVE.

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

[library] moonshine – Chainable post-processing shaders for LÖVE.

Post by vrld » 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:
noonshine.jpg
noonshine.jpg (66.89 KiB) Viewed 510 times
into this:
moonshine.jpg
moonshine.jpg (87.09 KiB) Viewed 510 times

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
Attachments
moonshine.love
(524.76 KiB) Downloaded 45 times
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

User avatar
master both
Party member
Posts: 238
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: [library] moonshine – Chainable post-processing shaders for LÖVE.

Post by master both » Tue Oct 31, 2017 4:05 pm

Awesome, this sure is a huge upgrade from shine, it's really clean and simple. Congrats!

Fuzzlix
Citizen
Posts: 53
Joined: Thu Oct 13, 2016 5:36 pm

Re: [library] moonshine – Chainable post-processing shaders for LÖVE.

Post by Fuzzlix » Tue Oct 31, 2017 5:46 pm

Well done!
But now comes the beginner question ;) :
Is it possible to use your library with fonts too? (I ask because i have seen the nice effects grump created in his nice game animal factory)

User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: [library] moonshine – Chainable post-processing shaders for LÖVE.

Post by vrld » Tue Oct 31, 2017 5:55 pm

Fuzzlix wrote:
Tue Oct 31, 2017 5:46 pm
Is it possible to use your library with fonts too?
I am unsure what you mean by that, but the shaders apply to everything drawn inside the effect.draw(...) call.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

Fuzzlix
Citizen
Posts: 53
Joined: Thu Oct 13, 2016 5:36 pm

Re: [library] moonshine – Chainable post-processing shaders for LÖVE.

Post by Fuzzlix » Tue Oct 31, 2017 6:27 pm

vrld wrote:
Tue Oct 31, 2017 5:55 pm
Fuzzlix wrote:
Tue Oct 31, 2017 5:46 pm
Is it possible to use your library with fonts too?
I am unsure what you mean by that, but the shaders apply to everything drawn inside the effect.draw(...) call.
Please take a look at the text "Animal Factory" on the start screen. The letter color inside a letter changes and the letter got a black border for instance. The source font is a normal ttf font.
I could draw the letter into a new image and manipulate the color with your filters easily but how to create the black border?

User avatar
zorg
Party member
Posts: 1910
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: [library] moonshine – Chainable post-processing shaders for LÖVE.

Post by zorg » Tue Oct 31, 2017 6:42 pm

Fuzzlix wrote:
Tue Oct 31, 2017 6:27 pm
vrld wrote:
Tue Oct 31, 2017 5:55 pm
Fuzzlix wrote:
Tue Oct 31, 2017 5:46 pm
Is it possible to use your library with fonts too?
I am unsure what you mean by that, but the shaders apply to everything drawn inside the effect.draw(...) call.
Please take a look at the text "Animal Factory" on the start screen. The letter color inside a letter changes and the letter got a black border for instance. The source font is a normal ttf font.
I could draw the letter into a new image and manipulate the color with your filters easily but how to create the black border?
You probably want an outline shader then, something like explained in one of the löve related blog posts.
Iirc that's usually not a "post-processing" related shader though. (But could probably be implemented by you using moonshine, anyway)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Fuzzlix
Citizen
Posts: 53
Joined: Thu Oct 13, 2016 5:36 pm

Re: [library] moonshine – Chainable post-processing shaders for LÖVE.

Post by Fuzzlix » Tue Oct 31, 2017 7:07 pm

zorg wrote:
Tue Oct 31, 2017 6:42 pm
You probably want an outline shader then, something like explained in one of the löve related blog posts.
Iirc that's usually not a "post-processing" related shader though. (But could probably be implemented by you using moonshine, anyway)
I will look at it.
Thank you.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests