Sign in to follow this  

Detecting shadow casters and receivers

This topic is 4111 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 am trying to generate an efficient way to detect shadow casters and receivers that contribute to the visible scene in my engine. Obviously any objects be they shadow casters or receivers will have an effect if visible by the view frustum so these are added automatically. My question is for non visible elements of the scene that could potentially contribute shadows. I have done the following for one directional light source. Take the 8 view frustum corners in world space and transform them by the directional light's view space matrix. Generate an AABB from these transformed corners. For non visible entities I then check if they intersect this new AABB. If they do I add them as shadow casters or receivers that contribute to the final scene. Is this a correct way of doing this? Part of the reason I am doing this is that I am already calculating this AABB to generate the ortho projection matrix for the light when shadow mapping, so it is convenient if I could reuse this AABB to detect shadow casters and receivers. Thanks for any help anyone can give me

Share this post


Link to post
Share on other sites
I would do it pretty much the same way. Every object in the view frustum and between the view frustum and the light source are potential shadow casters. You could also calculate the optimal light frustum from the view frustum first, then every object in the light frustum is a shadow caster.

I don't understand why you want to differentiate between shadow casters and shadow receivers, because most objects are both. A house for example receives shadows from other houses and casts shadows on the floor, too.

Share this post


Link to post
Share on other sites
I´d say if you´re doing shadow mapping you will want to optimize the light´s frustum anyway, so I´d do that first. Every object inside that frustum is then a potential shadow caster and receiver, just like MrSparkle said.
I don´t think using an AABB for that is a too good approach. Imagine a directional light with a direction that is 45° to the horizontal plane. For that case the AABB that includes the light´s frustum will contain many objects that won´t contribute to the final picture. Of course it depends on how exact you want your shadow caster / receiver detection to be, which I guess depends on how complex the scene is.

Share this post


Link to post
Share on other sites

This topic is 4111 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this