Possible shadow optimization idea...

As promised in my previous post, some examples of a shadow optimization idea…

ShadowSamples_SingleLight_B01_.jpg

ShadowSamples_7Light_B01_.jpg

As you can see, the render with 7 lights is much nicer. Soft luscious shadows behind the neck and elbow, but greatly suppressed moire pattern.

The thing is, the 7 lights are all instanced to each other, and coincident. The only difference is that they are rotated in local Z by 1/7 of a full rotation to each other. This “star pattern” lighting allows each light to fill in the shadows caused by the other light’s poor filtering at low resolution.

The render times, however, are much higher, since there are 6 extra lights to sort and generate buffers for. While we may not be able to generate the new buffers any faster, we could sort the particles faster by simply reusing the sort from the first light for the remaining 6. They would need to be transformed around the light’s Z axis of course, but the depth sort would be the same, only the light-space XY location would change.

I don’t know if this would be easier or harder to implement than multi-resolution maps, but the results are going to be different anyway, so I don’t think it should be lumped together.

  • Chad

Oh, to simplify the idea, you could just check the positions of all the lights in the scene, and group the coincident ones together and render them in order with one sort for that group. That way the user doesn’t have to set anything up, as the renderer can check that they are coincident very easily.

And since this doesn’t require any user intervention, it’s definitely not to be confused with the multi-resolution shadow map idea, which probably should be implemented as some sort of light modifier or shadow plugin, in my opinion.

  • Chad

Would probably be hard to implement, but since the sorting doesn’t have to change, could you not render more than one light at a time? Generating the attenuation buffers is single threaded, so even though the sort is taken care of, we still have to leave many processors idle while the buffers are rendered serially.

  • Chad