Tuesday, August 30, 2016

xna - How is 2D lighting implemented?


I am wondering what the best way to approach a "lighting" effect in 2D games is. For instance, if my main character is glowing, what techniques can I use to complete the visual effect of the character glowing when it is near other objects which would be affected by the light?



Answer



You could overlay a simple glow effect texture with soft transparent edges. If you want lighting/shadows similar to what you may find in a 3d world you could do something like this: http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/. However, if you are new to HLSL, then that may be a little bit too much.


edit: I stumbled onto a nice HTML5 2d light tutorial


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...