public GBufferRenderer(IGraphicsService graphicsService, SceneNodeRenderer sceneNodeRenderer, DecalRenderer decalRenderer) { _clearGBufferRenderer = new ClearGBufferRenderer(graphicsService); _sceneNodeRenderer = sceneNodeRenderer; _decalRenderer = decalRenderer; // This filter is used to downsample the depth buffer (GBuffer0). _downsampleFilter = PostProcessHelper.GetDownsampleFilter(graphicsService); }
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { if (!Active) { return; } if (material == null) { var shader = Shader.Find("Custom/PeopleOcclusion"); if (!shader) { return; } material = new Material(shader); } var commandBuffer = CommandBufferPool.Get(Tag); var renderTextureId = Shader.PropertyToID("_SampleLWRPScriptableRenderer"); var cameraData = renderingData.cameraData; var w = cameraData.camera.scaledPixelWidth; var h = cameraData.camera.scaledPixelHeight; int shaderPass = 0; if (PostProcessHelper.GetInstance() != null) { PostProcessHelper.GetInstance().UpdateShaderProperty(material); } commandBuffer.GetTemporaryRT(renderTextureId, w, h, 0, FilterMode.Point, RenderTextureFormat.Default); commandBuffer.Blit(currentTarget, renderTextureId); commandBuffer.Blit(renderTextureId, currentTarget, material, shaderPass); context.ExecuteCommandBuffer(commandBuffer); CommandBufferPool.Release(commandBuffer); }
void Awake() { instance = this; }