Jump to content
  • Advertisement
Sign in to follow this  

Shadowmaps for Lightmapping Large Scenes?

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

I have a global illumination lightmapper that uses the CPU to raytrace shadows/direct light, and I want to have a faster shadow solver because raytracing shadows on the CPU is much slower than using shadowmaps on a high end GPU.


For global illumination I'm using a technique very similar to what was used in The Witness's Lightmapper.

But I don't think that Hemicube rendering would be a fast solution to handle direct lighting, so I thought using shadowmaps for lightmapping would be one of the fastest ways to do it. Does anyone know of any technique or paper that specifically talks about using Shadowmaps to bake Direct Lighting? I already have a shadow mapping system working and it would be great to make the lightmapper even faster by calculating the shadows and direct light entirely on the GPU.

For this specific scenario, I'd rather use something similar to shadowmapping which is easily implementable on platforms like WebGL and can work in large environments. So building/using a GPU accelerated raytracer in CUDA/OpenCL is not something that would be a good match for this particular case because it wouldn't be as portable of a solution.


I'm trying to find a solution that can handle large scenes, and avoids artifacts as much as possible


My current idea to handle "Shadowmaps to bake Direct Lighting"' for a directional light is:

+Render multiple depthmaps for the sun and 'pan' the view of the sun so there's multiple high resolution depth maps for the same directional light; If depthmaps could be arbitrarily large, then this partitioning wouldn't be necessary.

+Each depthmap would be part of a uniform grid that makes up one large virtual 'mega depthmap', like cascaded shadow maps but each depthmap grid is used for shading the same amount of worldspace area. So putting the depths map all side by side would add up to super high resolution depthmap.

+After rendering the depthmaps, the geometry in the scene would be rendered to an offscreen buffer with the geometry's vertex positions set to lightmap UV texture space.

+This lightmap uv spaced geometry would use a shader that does a standard depth map test, producing a shaded scene with the geometry's vertex positions in lightmap space.

+Move the camera/'Pan' the sun multiple times to cover the entire world

+And then sum up all the shadow results to find all the parts of the scene that are in shadow


Again, I haven't seen any papers on 'Using Shadowmaps to bake Direct Lighting for a Large scene', the closest I've seen is this blog post that briefly talks about using a shadowmap to make a lightmap, but the scene shown is small enough to fit into a single depth map:



Any ideas on how to accomplish 'Using GPU Shadowmaps for Lightmapping Large Scenes' would be very appreciated!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!