   VSM filtering
  What's best practice for getting nice VSM shadows in OpenGL on recent hardware?1. Render to a MSAA renderbuffer and then resolve the renderbuffer to a standard FBO color texture (in OpenGL) and perform the blur on that FBO.2. Render directly to a MSAA texture and use GL_TEXTURE_2D_MULTISAMPLE to sample from the texure (but when: only in the first blur pass, or keep both blur FBOs as multisample textures?) Would there be any performance benefit compared to using a larger shadow map?Or is there even a better alternative?   
  I would just resolve the MSAA texture right away...if you perform your blur on the individual subsamples it's going to cost you a lot in terms of performance.   ;  Resolving then blur is the easiest. There's one clever thing you can do by sampling the MSAA texture though ("custom resolve"), and that's converting from depth to the VSM/EVSM representation on the fly, while resolving. This allows you to render to a "standard" multisampled shadow map (one fp32) and then convert to a VSM/EVSM and resolve on the fly. This saves memory footprint and bandwidth as well as enabling some of the more efficient hardware "Z-only" optimizations. These aren't as significant as they used to be, but they can still make a differenceIn either case, it's probably always best to do the resolve before the blurring.   ;Quote:Original post by AndyTXResolving then blur is the easiest. There's one clever thing you can do by sampling the MSAA texture though ("custom resolve"), and that's converting from depth to the VSM/EVSM representation on the fly, while resolving. This allows you to render to a "standard" multisampled shadow map (one fp32) and then convert to a VSM/EVSM and resolve on the fly. This saves memory footprint and bandwidth as well as enabling some of the more efficient hardware "Z-only" optimizations. These aren't as significant as they used to be, but they can still make a differenceYeah I was reading the recent presentation from the Little Big Planet devs and they mentioned that they did that so they could use double-speed Z writes on the PS3.  Neat stuff!;  I tried to custom resolve from a single float 32 channel, too. I am very pleased by the performance, but I am under the impression, that the quality is slightly worse compared to resolving from float 2x32. Is this to be expected, or am I probably doing something wrong?To get the z-only optimizations I would have to use the z-buffer directly, without any color writes. Correct?   ;  If you're doing it from a z-buffer, you probably want to use a 1-z fp32 buffer for precision reasons.   ;  What do you mean by 1-z?Right now I am outputting the depth manually, but maybe I should give it a try to just sample from the z-buffer.   ;Quote:Original post by B_oldWhat do you mean by 1-z?Right now I am outputting the depth manually, but maybe I should give it a try to just sample from the z-buffer.If you're writing something out manually it should be pretty much the exact same result as the hardware resolve if you're doing a box filter for the resolve step. With a "standard" depth buffer, to get more precision you can use 1-z together with a floating point depth buffer. See this paper for more details:http://doi.acm.org/10.1145/311534.311579   