OpenGL 2D lighting using shaders
Loading...
5,136
Loading...
Uploader Comments (geomancer120)
see all
All Comments (11)
-
trippy
-
This is awesome great work.
-
@alexgrinkov Sure, i posted the link in the video description.
-
can you share the shader that writes the lights?
-
@idoopeynolan Thanks. It's both for fun and bigger project :) I plan to use it in a platform game.
Loading...
how would this perform on Android ?
vlastos 3 months ago
@vlastos Not really sure. AFAIK FBOs are not really an option on most android devices, so im thinking something like directly rendering the lighting on top of the scene using blending.
geomancer120 3 months ago
You do something similar to us in the way that you bind a texture of the light. You don't seem to have any ambient light, though, and you render your entire world geometry as black. How is it that you can blend together the texture of the light together with the blackness? Do you bind the world geometry to a second texture or something like that? We're struggling with being able to have an ambient "darkness" that gets put into the lightmap texture. ie. (.2f, .2f, .2f, .2f). Thanks!
RejechtedGaming 6 months ago
@RejechtedGaming Nope, i render lights to a FBO first (offscreen render). Then i render world geometry, and then for each light, i enable GL_BLEND with GL_ONE,GL_ONE (additive) mode, then render the light using pixel shader, and then shadow as well. There is no, in fact, ambient light - everything is black (0.0f, 0.0f, 0.0f). You can achieve that by simply setting the color of all objects to certain amount, or by drawing a fullscreen colored quad with blending, BEFORE the lights, after geometry.
geomancer120 6 months ago