#Shader Compatibility Question

1 messages · Page 1 of 1 (latest)

manic fossil
#

I am currently passing in a downsampled mask RTHandle which I aim to blur to the output ("RT_BlurredLight"), but unfortunately it is being output as so:

#
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
        {
            var colorDesc = renderingData.cameraData.cameraTargetDescriptor;
            colorDesc.depthBufferBits = 0;
            colorDesc.width /= settings.downsample;
            colorDesc.height /= settings.downsample;

            var colorDesc2 = renderingData.cameraData.cameraTargetDescriptor;
            colorDesc2.depthBufferBits = 0;

            RenderingUtils.ReAllocateIfNeeded(ref RT_LightMask, colorDesc, name: "RT_LightMask");
            RenderingUtils.ReAllocateIfNeeded(ref RT_BlurredLight, colorDesc, name: "RT_BlurredLight");

            ConfigureTarget(RT_LightMask);
            ConfigureClear(ClearFlag.Color, Color.black);
        }
        // Draw the mask of our "Ground" tag to our "RT_GroundMask".
        public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
        {
            CommandBuffer cmd = CommandBufferPool.Get();
            using (new ProfilingScope(cmd, _profilingSampler))
            {
                context.ExecuteCommandBuffer(cmd);
                cmd.Clear();

                SortingCriteria sortingCriteria = SortingCriteria.CommonTransparent;
                DrawingSettings drawingSettings = CreateDrawingSettings(shaderTagsList, ref renderingData, sortingCriteria);

                // draw output of lightMaskMAT to rtMaskedLightTexture ?
                Blit(cmd, RT_LightMask, RT_LightMask, settings.lightMaskMAT, 0);

                Blit(cmd, RT_LightMask, RT_BlurredLight, settings.GaussianBlurShaderMAT, 1);

                cmd.SetGlobalTexture("RT_LightMask_GLOBAL", RT_LightMask);

                cmd.SetGlobalTexture("RT_BlurredLight_GLOBAL", RT_BlurredLight);
            }
            context.ExecuteCommandBuffer(cmd);
            cmd.Clear();
            CommandBufferPool.Release(cmd);
        }
        public override void OnCameraCleanup(CommandBuffer cmd) { }
    }