Sign in to follow this  

Shadow Combining

This topic is 4378 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 there, I've got half a demo up and running, with some pretty cool lightmaps. I'm having shadows cast on the scene for all the scene objects (see piccys). Free Image Hosting at www.ImageShack.us The objects shadows use depth projection, and the scene shadows are all radiosityy light maps. Free Image Hosting at www.ImageShack.us atm, i have a shader for the scene materials that uses 1xdiffuse, 1xlightmap, 1xshadowmap textures, and blends the lightmap with the shadowmap for the final lighting component. This works fine when the object is casting a shadow in a fully lit area, as the shadow will be the ambient component. The problem is, that when the shadows are cast on a darker area of the lightmap, the shadows become unrealistically dark. I somehow need a way of stopping the shadow from being blended as much with the darker areas of the lightmap.

Share this post


Link to post
Share on other sites
To be honest, I cant see the problem there.
If you stand around in real life with multiple light sources and watch shadows certain shadows will be darker than others depending on where the light sources are in the world.

Now, if your only lightsource is casting that shadow, then yes you have a problem, however if you have multiple light sources then that effect looks more correct to me.

If you want to see if for yourself, walk outside at night, watch how your shadow is cast and changes as you move around.

Share this post


Link to post
Share on other sites
Actually this is a pretty old problem. The combination of more than one type of shadow at the same time would be impossible. But as zedzeek already said nowadays' shaders allow a different approach by clamping (or better choosing) the correct shadow-intensity for each pixel separatly. If you know two shadows (one volume shadow and one texture-shadow for instance) are casted by the same light you might want to choose the more intensive shadow and ignore the other.
This can be done via shaders.

Share this post


Link to post
Share on other sites
One way to solve the problem is to first mark the shadowed areas, then add in light only after all shadows are marked. You can mark them with destalpha or stencil, or a render-to-texture.

Another way is to use a min function of the light * shadow terms if you have all shadow tersm available in a shader.

Share this post


Link to post
Share on other sites
The problem seems to be that since your static lightmaps are calculated using radiosity, there is no perfectly dark areas. On the other hand, your dynamic shadows are just on or off (so your lightmaps fade, but your dynamic ones don't). One solution could be to shadow dynamic objects at half color instead of just going to 0. This would give the illusion that it's not 100% dark there (since radiosity would lighten it up a bit anyways), and better blend with the existing static lightmap (which already isn't 100% dark).

Share this post


Link to post
Share on other sites

This topic is 4378 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