//This function is also responsible for downsampling the depth buffer and binding it protected RenderTexture DepthOfFieldStep(PostProcessParameters postProcessParams, RenderTexture source) { if (postProcessParams.depthOfField == false) { return(source); } RenderTexture exclusionMask = null; if (postProcessParams.DoFParams.depthOfFieldMask != 0) //If objects are masked out { exclusionMask = m_depthOfFieldClass.RenderExclusionMask(postProcessParams.width, postProcessParams.height, postProcessParams.camera, postProcessParams.cameraTransform, postProcessParams.DoFParams.depthOfFieldMask); //ScionPostProcess.ActiveDebug.RegisterTextureForVisualization(exclusionMask, false, false, false); RenderTexture downsampledExclusionMask = m_downsampling.DownsampleMinFilter(source.width, source.height, exclusionMask); RenderTexture.ReleaseTemporary(exclusionMask); exclusionMask = downsampledExclusionMask; } //postProcessParams.halfResSource = m_downsampling.DownsampleFireflyRemoving(source); postProcessParams.halfResSource = m_downsampling.DownsampleFireflyRemovingBilateral(source, postProcessParams.halfResDepth); source = m_depthOfFieldClass.RenderDepthOfField(postProcessParams, source, m_virtualCamera, exclusionMask); //Downsample scene again, this time with DoF applied RenderTexture.ReleaseTemporary(postProcessParams.halfResSource); if (exclusionMask != null) { RenderTexture.ReleaseTemporary(exclusionMask); } return(source); }