Login  Register

Re: 2D Lighting Tribulations with Shaders

Posted by Demoscene Passivist on Aug 24, 2011; 7:09pm
URL: https://forum.jogamp.org/2D-Lighting-Tribulations-with-Shaders-tp3279698p3281835.html

>Do these concepts translate well into 2 dimensions, where a GL lightsource is not present and we have defined our own?

Sure, defining ur own lightsource is no problem. U are not locked to using GL_LIGHTx when doing shadowmapping. When using the GLSL shader methods u are defining custom lightsources anyway and the fixed function pipeline method just uses the "buildin" lightsources as convenience variables, wich could be easily replaced by custom ones.

Regarding the "translate well into 2 dimensions" issue: Yes and no! When using shadowmapping u definitly have to build some kind of "3D imposters" of ur 2D spirtes/objects. Taking the correct camera view (e.g. from above) and setting the projection matrix to orthographic will then translate ur 3D scene to 2D. Thats what most (pseudo) 2D games do these days.