• Advertisement
Sign in to follow this  

Point light shadow

This topic is 1241 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I use deferred shading for shadows etc. Programming language is C++.

 

1) How can I render the world to a texture which only contains the distance from the point light to the nearest object based on the horizontal and vertical angle? Can I use the angles as texture coordinates? Or is there a better way to implement point light shadows?

 

2) How can I add multiple lights to the post processing pixel shader buffer? I would just use a texture array for the shadow textures and a constant buffer for the point light count and positions, but I wonder if there is a better way to do this?

 

Greetings,

Magogan

Share this post


Link to post
Share on other sites
Advertisement

"Classical" approach involve rendering to a cubemap depth texture from the light position. For the post processing part you need to use a sampler per point light.

That's what make point light shadow costly.

Share this post


Link to post
Share on other sites

2) How can I add multiple lights to the post processing pixel shader buffer? I would just use a texture array for the shadow textures and a constant buffer for the point light count and positions, but I wonder if there is a better way to do this?

You don't need to hold separate shadow textures for each light... The way I understand deffered shading works, you iterate over all your lights to decide if the resulting pixel is in shadow or not, and write this result to a single screen-space shadow texture.

And I don't think you can do light-space shadows with deferred rendering, if that's what you meant by using a texture array? Or if you do, then you lose most of the benefits of doing deferred shading. The whole point of deferred rendering is that you do all lighting calculations in a single pass, whereas with light-space shadow maps (LsPM?), you have to do one pass for each light.

 

...Or you can use a cube depth map like vlj said (should've read that reply first sorry) :) .

Edited by tonemgub

Share this post


Link to post
Share on other sites

 

 

You don't need to hold separate shadow textures for each light... The way I understand deffered shading works, you iterate over all your lights to decide if the resulting pixel is in shadow or not, and write this result to a single screen-space shadow texture.

 

Im not really sure what youre saying. But for proper quality shadows, you'll need at least one shadow map per light. The reason for this is that in screen space you are dealing with a very restricted amount of data. And unfortunately you dont have much data about where the photons collide, so in screen space you wouldnt have enough data to determine if the pixel was shadowed or not. But, screen space shadowing does exist, but depending on the view point of the scene, it can be very innacurate, although if the view point had a great overview, yeah, it could be done and look good.

 

 

 

And I don't think you can do light-space shadows with deferred rendering,

 

You can, deferred rendering is an awesome envoirernment for that. Render the shadow depth map from the lights POV, then in the deferred pass, get the world position ( from a texture or what you stored it in ), project it into the light space, then compare the depth value to the depth value from the shadow map. Anyway, theres tons of much better explanations about deferred shadow mapping, so listen to them not me.

 

In my opinion, vlj is correct.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement