Skip to main content
gamedev.net
🔒 Locked

Volume lighting sampling errors

Started by M4573R Sep 11, 2010 at 10:34 PM 1 replies 1k views
Original Post
M4573R
M4573R
I'm trying to create a volumetric lighting effect that is basically a cross between nvidia's volume fog demo and their volume lighting demo. I render the depths for the front and back of a light's frustum, then render the frustum geometry again with a shader that reconstructs the front and back positions of the frustum per pixel, then samples between them with the light's shadow map. It's creating a very nice effect and is running fast with zero effort to try and optimize it yet. However I'm getting some really weird problems when I sample from different camera angles. The shadow's cast in the volume are wrongly view-dependent when facing the towards the light. The problem appears that because I'm rendering the frustum back face to do this effect, I'm getting the distortion from the shape of the geometry. I'm completely stumped as to what would fix this.

EDIT: Updated pictures to highlight the problem.

Image 1
Image 2
Image 3

[Edited by - M4573R on September 12, 2010 1:32:40 AM]
ankhd
ankhd
I think it my be projection bleeding.
you may need some thing like this in your shader.


// Points outside the light volume.
if( In.projTexC.x < -1.0f || In.projTexC.x > 1.0f ||
In.projTexC.y < -1.0f || In.projTexC.y > 1.0f ||
In.projTexC.z < 0.0f )
{
out side no colour mode get lines here
}
else
{
do colour info in side the volume
}
M4573R
M4573R
That might solve the problem of the white outline at the end of the frustum, but thats what I'm trying to fix atm. The shadow cast in through the volume is distorted at different camera angles.

[Edited by - M4573R on September 12, 2010 1:03:15 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.