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.
Occluding Light in a Deferred Shader,
Moderators - Reputation: 12018
Posted 02 April 2014 - 12:12 PM
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.
Edited by Promit, 02 April 2014 - 12:13 PM.
Crossbones+ - Reputation: 7525
Posted 04 April 2014 - 09:43 AM
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).