PDA

View Full Version : Variance Shadow Mapping - no shadow visible after using gaussian blur



bwdun123
04-12-2017, 07:03 AM
I tried to implement variance shadow maps but got stuck while doing gaussian blurring. In the code, I'm using two custom framebuffers with a single RG32F texture for each one. One framebuffer is used for rendering the scene to depth map during the first pass of my main rendering loop, and the second one as an intermediate to store the blurred texture. I'm trying to filter my depth map using gaussian blur in two passes: first i filter the map horizontally and then vertically. When filtering horizontally i pass my original depth map to the 2nd framebuffer to blur and save it. Then to filter vertically i use the texture i just stored in the 2nd framebuffer and pass it back to my 1st custom framebuffer so i can blur and save it again. After the blurring process i do my second render pass in main rendering loop to draw the scene to the default framebuffer and do my lightning and render shadows as per ushe. The issue is that after i blur my depth map, with said gaussian technique, no shadows are rendered on screen. But if i don't blur the map, and only use GL_LINEAR to filter it, shadows are drawn.

Here are the images of my depth maps rendered to screen: Images (http://imgur.com/a/S6z8H)

Image C pictures non-filtered depth map rendered to screen and image D shows that the shadows are rendered using the image A's depth map. Image B and A show how my depth maps look after i filter them with only horizontal gaussian blur, and then both horizontal and vertical blur respectively.

So i guess my depth maps in B are A are too bright. Do you reccomend that i take the blurred depth map and adjust it's values to be a bit darker so shadows could be rendered? Or will i just be negating my blurring by doing this? Any help is appreciated! Thanks in advance!

bwdun123
04-13-2017, 01:23 AM
It turns out those "blurred" depth maps i created aren't supposed to be any lighter than the original non-filtered depth map, as can be seen on this page http://www.nutty.ca/?page_id=352&link=shadow_map in the Theory tab, under the section VSM. That means my problem isn't caused by my depth rendering and light rendering shaders, but by my blurring shaders and/or my blurring setup in main.cpp.

i'll update soon