Skip to main content
gamedev.net
🔒 Locked

Shadow mapping maze

Started by jmaupay 5 replies 2.5k views
Original Post
jmaupay
jmaupay
I have a 3D engine up and running for cars simulation (OpenGL, simple texturing, 1 light: the sun, a town of 3km x 2km). I'm trying to add shadow mapping but I feel like in a labyrinth. Here is where I am: My original 3D engine image: Free Image Hosting at www.ImageShack.us Added shadow mapping using "classical, brute force Shadow mapping": http://img150.imageshack.us/img150/6685/ombrexs9.jpg Free Image Hosting at www.ImageShack.us # first pass: - depth image from the sun is calculated using a Frame Buffer Object ( with polygon offset ) #second pass: - a GLSL shader use the depth texture to render the final image ( shadow2D ) Well, it's the entrance of the maze. The exit of the maze is: - I would like to have that shadows not depending on the view position - for static objects perhaps not calculating shadow maps every frame but only at initialization (but a shadow map texture is maximum 4096x4096 and the town is some km squares) - and of course avoid that "aliasing problem" (is it an aliasing problem on the cars ?) I have the feeling that Perspective Shadow Mapping (PSM), Trapezoidal Shadow Mapping (TSM), Light Space Perspective Shadow mapping (LiSPSM) ... Could help to reduce the aliasing problem. But as said in that thread, it's probably not the solution for large environments !? While Percentage Closer Filtering (PCF) or Variant Shadow Mapping (VSM) are needed to create "soft shadows" and could reduce the aliasing problem ? And partitionning methods could be the clue of large environment shadowing ? Does anyone have a map of the labyrinth ? My references are: The basic concept (the naked truth): Reeves 87 Recent tutorials: paulsprojects gametutorials (not free anymore ?) Shadow mapping + GLSL Wrapping methods: PSM (inria) PSM (inria) recipe PSM Care and feeding (nVIDIA) Trapezoidal Shadow Maps (TSM) Trapezoidal Shadow Map recipe : Logarithmic Shadow Maps (LogSM) and ppt: Logarithmic Shadow Maps (excellent introduction to all methods) Warping and Partitioning for Low Error Shadow Maps A Robust Alternative to Perspective Shadow Mapping [Edited by - jmaupay on September 12, 2006 1:06:21 AM]
jma
Deliverance
Deliverance
I'm no expert but:
A partitioning method is a must with a town big as your's, you could use BSP since you have a town "like a maze", and it is a "medium" occluded environment (by the geometry).

Also you may want to consider shadow volumes as an alternative for the shadowmapping algorithm. Do lightmappijng for the environment(buildings) and implement shadowvolumes for the cars and other dynamic objects.

If you want to keep it as simple as possible you could make an octree and draw the nodes distance-based.
As for the shadowing you could use shadowmapping, though I'd recommend Parallel Split Shadowmaps (PSSM), the method works really great for large environments link: http://appsrv.cse.cuhk.edu.hk/~fzhang/pssm_vrcia/

Also keep in mind that in an outdoor environment you have to create the illusion of dynamics really well(light,shadows, objects etc) since an outdoor scene is most of the time more dynamic than an indoor one.(take a look into your room and then throw your head out of the window :) ).
Schrompf
Schrompf
Some quick comments:

Forget about BSPs. In today's environments they're too slow. An Octree or some adaptive octree should do.

There's a lot of techniques to improve shadow mapping resolution for large scenes. PSSM as mentioned by the previous poster might be a nice idea, although it has a certain CPU overhead due to rendering parts of the scene multiple times. Perspective Shadow Mapping should be avoided, it has too much dead ends. LiSPSM is better in this case, although it falls back to standard shadow mapping when the viewer direction is parallel to the light direction. I use a personal developed method (yet unnamed) that is discussed in some length in this thread. It works quite well for large scenes, has nearly no performance penalty and works independent of the viewer direction, but the maximum improvement is somewhat limited until the nonlinear distortion artifacts get noticable.

Shadow Map Filtering is independent of the topic discussed above. I use 8xPCF but this eats graphics boards for breakfast. Variance Shadow Mapping has great results as first but proves to be too artifact laden when using in "real" scenes. Plus it's even slower then 9x PCF in the test programs I've seen. I haven't found a better option yet, so I stick to PCF.

Thus said, your Shadow Mapping looks quite nice at the moment. It usually needs some adjusting work until problematic parts like the footway cast proper shadows on the street that is so close in this case. Keep up the good work!

Oh, as a last note: forget about prerendering parts of the shadow map. This only works if the shadow map is fixed to stretch over the full scene. Most of the time, you adjust the shadow map every frame so it stretches only over the visible part of the scene. Because of this readjustment, you need to render the shadow map every frame anyways. There's no use in trying to cache part of that work.

Bye, Thomas
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
edwinnie
edwinnie
Might wanna take a look at the most recent soft shadow mapping techniques that rather avoid the aliasing problem than to reduce it.

thx!
Edwin
RAZORUNREAL
RAZORUNREAL
Looks to me like your lighting is half the problem. It really doesn't look like the light is coming from the same place as the shadows. Or perhaps it is, but the ambient lighting for things out of shadow is much brighter than for those within or something. While fixing that won't solve all your problems, it should at least mask them a bit and make things look better.
___________________________________________________David OlsenIf I've helped you, please vote for PigeonGrape!
jmaupay
jmaupay
Many, many thanks to answer that question !

I will investigate all your comments and will be back soon (hopefully).

RAZORUNREAL: you are absolutly true: the lighting and shadows don't have the same sun direction. I'm going to correct that now.

Schrompf: is your method free to use and then could you give some advanced details or not ?
jma

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.