Original Post
I implemented the LightPrePass into my engine a while ago, using spheres to render my point lights.
Since a sphere isn't a fullscreen quad, I can't use Cryteks method to reconstruct the worldspace position from my depth buffer. (I'm using D3D11, so it's the hardware depth buffer in my case)
This problem would be gone when I would use a fullscreen quad with a scissoring rect around the light. But when I did that the last time, it wasn't very accurate.
You can see what I mean in our last demo.
There are borders popping up or wrong scissoring when you are behind a light.
I did a straight copy out of some sample code from Nvidia for this algorithm. Maybe there is a better one available?
So my questions are:
- Can I somehow reconstruct the worldspace position from depth using the FrustumRay method on light spheres?
- If not, is there a good algorithm to figure out the scissoring rect for a fullscreen quad for a point light?
- Are there any other ways to do this?
Since a sphere isn't a fullscreen quad, I can't use Cryteks method to reconstruct the worldspace position from my depth buffer. (I'm using D3D11, so it's the hardware depth buffer in my case)
This problem would be gone when I would use a fullscreen quad with a scissoring rect around the light. But when I did that the last time, it wasn't very accurate.
You can see what I mean in our last demo.
There are borders popping up or wrong scissoring when you are behind a light.
I did a straight copy out of some sample code from Nvidia for this algorithm. Maybe there is a better one available?
So my questions are:
- Can I somehow reconstruct the worldspace position from depth using the FrustumRay method on light spheres?
- If not, is there a good algorithm to figure out the scissoring rect for a fullscreen quad for a point light?
- Are there any other ways to do this?