Occluding Light in a Deferred Shader

Started by
2 comments, last by phil_t 10 years ago

Hi guys, I have a noob question. Since direct light in a deferred pipeline is represented as geometry, I was wondering what to do in the case were you have two objects in front of a spot light. The first object closer to the spot light is larger and completely covers object two but both objects are still inside the geometry of the light. If you shade it, won't you have the issue were the second object, which is completely hidden from the perspective of the light, be shaded as if it wasn't hidden since it still is inside the lighting geometry? How would you go about solving this and leave it in shadow unlit since its not affected by the light? You could have cases like these with point lights as well. I was thinking maybe you could apply a shadow from object 1 but wouldn't you still have the shadow overlapped with the light applied on the surface? Thanks in advance.

Advertisement

Deferred shading/lighting has no impact on the problem of computing shadows. You need to compute your shadows in the traditional way, by building shadow maps from the lights and doing depth tests when rendering the lighting. The pass that renders the light geometry will be the one to sample the shadow map and depth test.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Oh okay that makes more sense. So if I have lets say a point light, do I have a circle model for it and each point light has a specified radius or do I generate one on the GPU based on its properties (attenuation)?

Yes, you can draw a point light with a sphere model. Using geometry like this is just an optimization so you only draw the pixels you know could affected by the light (as opposed to doing a full screen rendering pass).

This topic is closed to new replies.

Advertisement