#Two pass blur effect with Custom Renderer Feature

1 messages · Page 1 of 1 (latest)

spare sorrel
#

Hello! I am working on a volumetric screen effect which requires a blur pass to hide some of the noise from raymarching and downsampling.

For this I have a shader that applies a simple gaussian blur. I'm trying to get this implemented into the renderer feature of my volumetric effect with a two pass approach for horizontal+vertical blur:

if (_blurMat != null)
{
_blurMat.SetVector("_TexelSize", new Vector2(1f / _lowResColor.rt.width, 1f / _lowResColor.rt.height));
_blurMat.SetFloat("_BlurRadius", 1.5f);

// Horizontal
_blurMat.SetFloat("_Direction", 0);
_blurMat.SetTexture("_SourceTex", _lowResColor);
Blitter.BlitTexture(cmd, _lowResColor, _blurTemp, _blurMat, 0);

// Vertical
_blurMat.SetFloat("_Direction", 1);
_blurMat.SetTexture("_SourceTex", _blurTemp);
Blitter.BlitTexture(cmd, _blurTemp, _lowResColor, _blurMat, 0);

}

However I can't figure out exactly why this doesn't work. I've tried checking everywhere and there was one mention of a similar issue before, but there wasn't a concrete answer.

Basically, the RTHandle _blurTemp isn't being written to on the horizontal pass, which causes the vertical pass to not have anything to work with. Anyone knows what could be the problem?

languid flare
#

I don't think blit happens immediately. It's likely queued into a command list that is sent to the gpu at the end of the frame and is executed at appropriate time there. Thus, the material state during the actual command execution or even creation is incorrect. Try using different materials for each pass.
Also, looking at the frame debugger could be useful.

spare sorrel