Sign in to follow this  

Mixing shadowmaps and lightmaps

Recommended Posts

I need some help, how to mix lightmaps with shadowmaps. Right now, I have static lightmaps created for all static objects in a map (buildings, etc). And I have a shadowmap system for dynamic objects (cars, people, etc)

This works fine, but the buildings won't receive shadows from the cars, since they only read the shadow data from the lightmaps (my lightmaps only store a occlusion value, 1 if light can reach that point, or 0.25 if light is occluded by something).

Now, I want buildings to also receive shadows casted by dynamic objects. I if make the buildings shader read both from the lightmap and shadowmap, it doesnt work, mainly because shadowmaps also contain building shadows, and those don't map exactly 1:1 to the lightmaps, are just an approximation.

I also want the dynamic objects to receive shadows from the buildings, so all objects are shadow casters, I'm confused now.

Dynamic objects: Using shadowmaps, receive shadows from everthing [OK]

Static objects: Using lightmaps now, only receive shadows from other static objects, need to receive shadows from everything [NOT OK]

Share this post

Link to post
Share on other sites
Original post by O-san
Can't you have the static objects included in the shadowmap lighting shader also?

I would probably go for shadowmapping on the entire scene.

That was the previous solution, but we've a very big city scene. Cascade shadowmapping was implemented, but the results were not acceptable (would be good if we used very big shadowmap textures, 4096x4096, and there were some shimmering of the shadows when the camera moved, we minimized those, but still, it was visible sometimes).

Lightmaps provide us with very good quality shadows, that are pixel perfect, and they actually consume less memory than shadowmaps (as the lightmap is encoded in one channel of the already existing building textures)

I'm pretty sure there are lots of games that combine both techniques, but how, I would like to know

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