PDA

View Full Version : shadow algorithms



bootstrap
06-09-2009, 03:39 AM
What "soft shadow" algorithm gives the best combination of speed and appearance [with 3 to 8 lights] and OpenGL310/GLSL140 support?

I read a few HTML and PDF soft-shadow articles recently, but most focus on their favorite approach, and none feel like an objective, unbiased review and comparison. Also, many articles assume older version APIs and shaders. I am guessing that floating-point depth buffers and other recent GPU capabilities might help some approaches considerably.

Personal experiences and links to PDFs and HTML are welcome. Thanks.

A related request for comments: Reading the OpenGL310/GLSL140 documents last night gave me the following idea that might speed some shadow algorithms considerably --- IF --- I understand what I've been reading about soft shadow algorithms.

This idea is inspired by new features like blocks of uniform variables. What if 4 sets of transformation matrices are supplied to the GPU shaders in a large block of uniform variables - one set of transformation matrices for each of 4 light-sources (treating each light like a camera/viewpoint)? Is there any reason the shaders cannot create 4 separate depth buffers (in 4 separate FBO renderbuffers), one for each light? If so, wouldn't this be faster than a separate pass for each light? Something tells me this won't work, but I can't see why off hand.

zeoverlord
06-09-2009, 06:17 AM
I always found that depth shadow maps are the easiest method to implement, and you could always enhance that with a few methods.

I don't know about your other thing though, but i have been doing some thinking about this and then especially for doing cube maps for point lights in one pass, i made some observations.

1. you need to put all of them inside a single FBO and then copy the data to their final destination since you can't have multiple depthbuffers (alternatively blendshaders would fix this).
2. basically all vertex processing has to be done inside the geometry shader, you also have to do custom frustrum culling as well in there.
3. you have to pass a variable to the fragment shader telling which "light" it belongs to so that it can discard stray fragments
4. you will have a huge amount of fillrate wasted doing this
5. it's not clear if it's faster than the regular method.