Sign in to follow this  
Matt Aufderheide

methods for local projected shadows

Recommended Posts

While its siple to implement a global appraoch for projected shadows (simply render a view form the sun's position, drawing every occluder in the frustum, and projecting the resulting shadow map on to you environment), this method has several drawbacks: 1) shadow map must be very large to accomodate a large sunlight area 2) requires that all shadow casting models be redrawn every frame 3) may require an additional pass on the terrain if the terrain shader is already very complex Some of these problems can be dealt with of course, such as by using PSMs, or simply moving the sunlight frustum around with the camera. However, as in HalfLife2, there is way to render local projected shadows which are then mapped to a mesh that is flattended against the terrain and environment. My question is, how can this flattening or "projection" of the shadow mesh be accomplished in a fast way?

Share this post


Link to post
Share on other sites
No matter what you do you're going to have to do at least the following:

1) re-render the shadow casting object either into a shadow depth buffer for real shadow determination, or simply into a texture for pure projective texturing -- regardless of whether you're planning on flattening its projection into a plane or not.

2) re-render the objects receiving its shadow using projective texturing

In which case, you're not that far removed form what you originally described (i.e. traditional shadow mapping). I guess it just comes down to how much environmental detail you want to include in your shadows. If you're looking only for character shadows that project locally onto nearby objects and no-self shadowing, then this can be done fairly quickly -- however I'm not sure you can easily avoid the two steps listed above.

Share this post


Link to post
Share on other sites
Well, if the shadows are local, and each shadow mesh has its own render target, only the moving objects need to be rendered, like wise, only the moving object's shadow mesh needs to be re-projected or flattended against the ground. This isnt isnt the case with a normal shadow map, where its needs to be rendered every frame.

My question pertains to actually flattening or projecting the vertices against arbitrary terrain: wha isa fast method for this? The only way i can think of is to cast a ray from each vertex i the sun light direction,to the nearest polygon it hits. But to do this for every vertex every frame seems slow, even if i actually move the vertices in a vertex shader.

Share this post


Link to post
Share on other sites
I guess I'm not fully clear then on what exactly it is you want to do. From the way I understand it and can envision in my own head -- anything that's going to be projected onto "arbitrary" geometry will at the very least require some form of projective texturing, and there's only one way to do that as far as I know.

Share this post


Link to post
Share on other sites
well it isn't all that hard actually. You simply need some octree kind of subdivision of your world with all the geometry inside it. When you want to create the recceiving geometry following the static geometry, you simply get the treenode(s) in which the character resides. Iterate over all the vertices in this scene, and if inside the camera used to create the shadow map, add to a dynamic geometry buffer. You can imm. calculate your tex coords to fetch the shadow map as well.

But I don't know if this will be faster than just rerendering every geometry on which the shadow can cast. If the dynamic object isn't to big, there shouldn't be to many objects in the frustum of the camera. The only problem is the terrain, but for this you can pregenerate a subdivided mesh of 50m by 50m or something. This worked fine for me.

Allthough, that I'm using CSM with VSM now for most of my shadows. I still have a problem with characters close to the camera, but I think I will use stencil shadows for those (seems like the easiest solution, without wasting to much video memory).

Regards,
Kenzo

Share this post


Link to post
Share on other sites
Quote:
Original post by Guoshima
But I don't know if this will be faster than just rerendering every geometry on which the shadow can cast. If the dynamic object isn't to big, there shouldn't be to many objects in the frustum of the camera. The only problem is the terrain, but for this you can pregenerate a subdivided mesh of 50m by 50m or something. This worked fine for me.


I have to agree.

Share this post


Link to post
Share on other sites

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