🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Variance shadow maps light leaks

Started by
4 comments, last by JoeJ 1 year, 8 months ago

This image shows the artifacts I am trying to eliminate:

In this thread, it is proposed that the max value of the depths be stored in a third channel in the blur buffer. I did something similar, but a little different, I just did an extra texture read of the unblurred original image to get the exact depth at that pixel. (My “blur” currently just consists of a blit downsample of the texture mipmaps.)

float dropoff = 0.5;
float hiresz = textureLod(shadowmap, texcoord.xy, 0.0f).r;
if (texcoord.z > moments.x + dropoff) return 0.0f;
if (texcoord.z > moments.x) shadow *= 1.0f - (texcoord.z - moments.x) / dropoff;

This eliminates the errors above, but it creates strange sharp edges on other shadows:

I really like how variance shadow maps look aside from this problem. Do you have any suggestions how I can fix these issues?

10x Faster Performance for VR: www.ultraengine.com

Advertisement

Exponential shadow maps eliminate this problem, but create another one…

10x Faster Performance for VR: www.ultraengine.com

Unrelated, but if your interested in faster voxelization, this claims speedup of 3-5 over conservative HW raster:

https://threadreaderapp.com/thread/1577590023888723970.html

After investigating all of this very thoroughly, I am sorry to say that PCF filter with depth shadow maps and hardware depth bias is really the best thing there is. I tried VSM, ESM, and my own filtering, and every approach has problems.

I really wish there was an optional blend range for texture lookups, over which the distance of each sample would be interpolated linearly before the texture sampling filter was applied.

10x Faster Performance for VR: www.ultraengine.com

Josh Klint said:
After investigating all of this very thoroughly, I am sorry to say that PCF filter with depth shadow maps and hardware depth bias is really the best thing there is. I tried VSM, ESM, and my own filtering, and every approach has problems.

Thanks for sharing your experience. It will save me the time to experiment with VSM / ESM myself. I'd like those, but seems PCF variants is what most people converge at in the end. :(

I guess it's worth to break up a regular grid filter kernel. Poisson disk samples seem popular, see here for an example: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#Poisson_Sampling

This topic is closed to new replies.

Advertisement