Getting perspective Frustum in world coordinates

Started by
13 comments, last by L. Spiro 9 years, 10 months ago

You now have a 5-sided frustum with no near plane (it extends into infinity). Perform frustum culling and gather those objects into a list of objects that cast shadows into the player’s frustum.

This is the core of it all, and since I didn't spot any further elaboration on this in L. Spiro post, I will add up.

1- cull object from view of observer

2- cull objects from view of light in very screen space, Meaning, use AABB points of an object in screen space, but do not examine them only for being on screen (thus in light frustum) but also for being any of them over projected observer frustum in the light's projection space.

My concern is that if any of AABB points of an object is in screen space of light projection, it casts a shadow, but if none of its point is over projected observer frustum (in the light's projection), it does not cast shadow to observer frustum.

You would test if an AABB is in observer frustum by comparing only x,y components towards projected observer frustum x,y components. If any of them is positive, you still have a chance of it not casting shadow. But this chance is rather small, and I would render from there on, but you can still test it if you wish further, so you move to comparing the AABB point along with z component for being in or over the projected frustum (not behind it)- this is rather grewsome step and will not save you from many rander calls most of the time I believe.

Advertisement

Your plan always creates the absolute most inefficient shadow map possible. Using corner points should not be used to determine the directional light’s shadow size, it should only be used as an optional limiter. It’s the maximum size there can be, and thus a smaller bound should always be used if possible.

If I understand you correctly, you want to gather all Objects in the scene and all Objects that cast shadows into the scene, and from this list of Objects take the bounding box/spheres to determine the size of the shadow map frustum?

But how would you account for self-shadowing terrain which is not in the object list? It might just be that in the far depth of the viewing frustum there might be some self-shadowing cravases, or a mountain range casting shadows on the valley below.

The algorithm handles all cases, including self-shadowing.
If you have a special way of storing terrain such that it is not in any object lists you have the responsibility of handling that case.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

The algorithm handles all cases, including self-shadowing.
If you have a special way of storing terrain such that it is not in any object lists you have the responsibility of handling that case.


L. Spiro

So the algorithm assumes that the terrain is partitioned into smaller objects which you can add to the drawing list if they pass culling?

It makes no assumptions, but for the sake of your performance I would certainly hope your terrain is chunked in some way.
Otherwise you will be drawing the whole thing twice (though the second time much (perhaps) of it will be off-screen and pixel-culled).

The second purpose of culling by objects is to have the smallest number of draw calls when creating the shadow map.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement