简体   繁体   中英

Gaussian blur on shadow map (FBO/texture)

I have followed the tutorial presented here to create shadow maps.

What I would like to do is to have some sort of post processing step on the shadow, where I apply gaussian blur (or whatever blur) on the shadow map. Understand that I have followed this tutorial strictly, and that I am very inexperienced when it comes to OpenGL. I don't know if it should be applied to the depthMapFBO or the depthMap itself. Or if I need to create new FBOs/textures.

Can one even blur the depth value in this way? How would you go about blurring the shadow map?

Note that I'm not interested in realism, I just want a uniform blurring on all shadows.

Blurring a shadow depth texture makes no sense.

A depth texture contains depth values. A value of, for example, 0.5 means something. It specifies the depth of a texel. For a shadow map, it means something even more specific: it specifies the closest distance to the light of an occluding surface at a particular location in the scene.

If the closest distance at one location is 0.5, what would it mean to "blur" this with a distance of 0.6? It would effectively mean that you have changed the distance of objects to the light. But since that won't be reflected in the actual geometry, this means that the blurred shadow map no longer accurately represents the geometry. So now, there will be locations that should be shadowed which are not, and locations that are being shadowed but shouldn't be.

In short, it makes your depth texture meaningless.

What you seem to want is softer shadows. There are ways to accomplish that with shadow maps, but blurring the depth texture is not one of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM