It's kind of an extension to pp.lua which i made recently, But it comes with a collection of shaders and some more stuff. So its more akin to something like moonshine
It aims to make applying post processing shaders to your game straight forward, While being pretty flexible.
As usually, It's properly documented over on github. It's a bit of a work in progress, I'd love it if you could try it out, And let me know what features it's missing and whats broken etc.
First, Here's what it can do:
Turn this garbage Into this Which i think we can all agree looks better

Basic usage:
Load it:
Code: Select all
poster = require("poster")
Code: Select all
canvas = poster.new() -- I should probably rename this to "newCanvas". Just realized.
Code: Select all
canvas:drawTo(function()
-- Draw stuff
end)
Code: Select all
canvas:set()
-- Draw stuff
canvas:unset()
Code: Select all
canvas:draw("rgbMix", "saturation", "verticalBlur")
To control the built in shaders, You need to send them some uniforms(externs), Which shaders need what uniforms exactly is also explained on github. To send data to shaders you use the following funciton:
Code: Select all
poster:send(shader, uniform, data)
You can also pass it a table with a format like
Code: Select all
{
{shader, uniform, data},
{shader, uniform, data},
{shader, uniform, data},
...
}
To create a new chain you can either
Code: Select all
blur = poster.newChain({"verticalBlur", "horizontalBlur"}, {{"verticalBlur", "amount", 3}, {"horizontalBlur", "amount", 3}})
Or a slightly "cleaner" but less compact
Code: Select all
blur = poster.
blur:addShader("verticalBlur", "horizontalBlur")
blur:addSetting("verticalBlur", "amount", 3)
blur:addSetting("horizontalBlur", "amount", 3)
Then you apply the chains with the draw function
Code: Select all
canvas:draw(blur)
One thing that's obviously missing from this at the moment is a way to animate chained shaders, I have some ideas for that that i still have to iron out. It's pretty easy to do so globally, Just continuously update a uniform with poster:send(). If you have any other ideas for features or changes, I'm all ears. Thank you!
EDIT: I think i've fixed the issue of not being able to animate chained shaders. I added "macros" to the chain system. You can define a macro like this:
Code: Select all
chain:addMacro(macroName, Targets)
Code: Select all
{
{shader, uniform, multiplier},
{shader, uniform, multiplier},
...
}
Code: Select all
chain:setMacro(macroName, value)