Hello everyone,
How can I get the following effect using libGDX:
Photoshop does that by using moving HueSaturation-layer with mask.
Is there a way to apply Photoshop-like filters (Multiply, Color-Dodge, etc) in a game?
Hello everyone,
How can I get the following effect using libGDX:
Photoshop does that by using moving HueSaturation-layer with mask.
Is there a way to apply Photoshop-like filters (Multiply, Color-Dodge, etc) in a game?
Yeah, that’s totally possible. Take a look at shaders.
A good starting point can be found here: https://github.com/mattdesl/lwjgl-basics/wiki/Shaders
For your examlpe you would have to render the whole scene into a Framebuffer (basicly a texture that you can write to).
Then you would render that to the screen using a shader that will make the parts of the image you want to be gray, gray.
Keep a circle that covers the area and the radius, and use the shaders to convert anything in that area into grayscale. Render the foreground trees with a separate shader.
out float isGray;
void main()
{
if ( (p.x - c.x) * (p.x - c.x) + (p.y - c.y) * (p.y - c.y) <= r * r )
isGray = 1.0;
else
isGray = 0.0;
}
Then use this in fragment shader to convert to grayscale.
if (isGray == 1.0)
outColor = vec4(vec3((c.r + c.g + c.b) / 3.0), c.a);
else
outColor = c;
This sorta works, but should be improved.
I found this example online: https://github.com/JFixby/Tinto/blob/master/tinto-run-fokker-desktop/tinto-run-desktop/com/jfixby/tinto/run/desktop/GrayscaleTest.java
Is it what I’m looking for?
Will it work on Android/iOS?
Also I’m total noob in shaders. Is there some sort of an editor to test/debug shader code?