Пример #1
0
    void RenderObjects(ScriptableRenderContext renderContext, CommandBuffer cmd, Material overrideMaterial, int passIndex, CompareFunction depthCompare, CullingResults cullingResult, HDCamera hdCamera, StencilState?overrideStencil = null)
    {
        // Render the objects in the layer blur mask into a mask buffer with their materials so we keep the alpha-clip and transparency if there is any.
        var result = new RendererListDesc(shaderTags, cullingResult, hdCamera.camera)
        {
            rendererConfiguration      = PerObjectData.None,
            renderQueueRange           = RenderQueueRange.all,
            sortingCriteria            = SortingCriteria.BackToFront,
            excludeObjectMotionVectors = false,
            overrideMaterial           = overrideMaterial,
            overrideMaterialPassIndex  = passIndex,
            layerMask  = seeThroughLayer,
            stateBlock = new RenderStateBlock(RenderStateMask.Depth)
            {
                depthState = new DepthState(true, depthCompare)
            },
        };

        if (overrideStencil != null)
        {
            var block = result.stateBlock.Value;
            block.mask        |= RenderStateMask.Stencil;
            block.stencilState = overrideStencil.Value;
            result.stateBlock  = block;
        }

        CoreUtils.DrawRendererList(renderContext, cmd, RendererList.Create(result));
    }
Пример #2
0
    // This function is called from the custom post process at the before post process injection point, just after TAA
    public void RenderVideoObjects(CommandBuffer cmd)
    {
        // Fix depth buffer jittering
        if (fixDepthBufferJittering)
        {
            using (new ProfilingScope(cmd, new ProfilingSampler("Render Depth Buffer without jittering")))
            {
                // We need to re-render everything to get the non-jittered depth buffer :/
                CoreUtils.SetRenderTarget(cmd, videoDepthBuffer);
                CoreUtils.ClearRenderTarget(cmd, ClearFlag.Depth, Color.black);
                var tags   = new ShaderTagId[] { new ShaderTagId("DepthForwardOnly"), new ShaderTagId("DepthOnly") };
                var result = new RendererListDesc(tags, context.cullingResults, context.hdCamera.camera)
                {
                    rendererConfiguration      = PerObjectData.None,
                    renderQueueRange           = RenderQueueRange.all,
                    sortingCriteria            = SortingCriteria.CommonOpaque,
                    excludeObjectMotionVectors = false,
                    layerMask = fixDepthBufferJitteringMask,
                    // stateBlock = overrideRenderState,
                };
                CoreUtils.DrawRendererList(context.renderContext, context.cmd, RendererList.Create(result));
            }
        }

        // TODO: add an option to render the "frame" objects in the unjittered depth-buffer to avoid flickering
        CoreUtils.SetRenderTarget(cmd, videoColorBuffer, fixDepthBufferJittering ? videoDepthBuffer : context.cameraDepthBuffer, ClearFlag.Color);
        var renderState = new RenderStateBlock(RenderStateMask.Depth)
        {
            depthState = new DepthState(false, CompareFunction.LessEqual)
        };

        CustomPassUtils.DrawRenderers(context, videoObjectMask, overrideRenderState: renderState);
    }
    protected override void Execute(CustomPassContext ctx)
    {
        if (!ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.ObjectMotionVectors) ||
            !ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.OpaqueObjects))
        {
            Debug.Log("Motion Vectors are disabled on the camera!");
            return;
        }

        SyncRenderTextureAspect(motionVectorTexture, ctx.hdCamera.camera);

        var tags = new ShaderTagId("MotionVectors");
        var motionVectorRendererListDesc = new RendererListDesc(tags, ctx.cullingResults, ctx.hdCamera.camera)
        {
            rendererConfiguration      = PerObjectData.MotionVectors,
            renderQueueRange           = RenderQueueRange.all,
            sortingCriteria            = SortingCriteria.BackToFront,
            excludeObjectMotionVectors = false,
            layerMask = renderingMask
        };

        if (ctx.hdCamera.msaaSamples != MSAASamples.None)
        {
            CoreUtils.SetRenderTarget(ctx.cmd, new RenderTargetIdentifier[] { dummy.colorBuffer, motionVectorTexture }, dummy.depthBuffer, ClearFlag.All);
        }
        else
        {
            CoreUtils.SetRenderTarget(ctx.cmd, new RenderTargetIdentifier[] { motionVectorTexture }, motionVectorTexture.depthBuffer, ClearFlag.All);
        }
        RendererList motionVectorsRendererList = RendererList.Create(motionVectorRendererListDesc);

        CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, motionVectorsRendererList);
    }
Пример #4
0
    void DrawObjectToFurify(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
    {
        var result = new RendererListDesc(shaderTags, cullingResult, hdCamera.camera)
        {
            rendererConfiguration      = PerObjectData.None,
            renderQueueRange           = RenderQueueRange.all,
            sortingCriteria            = SortingCriteria.BackToFront,
            excludeObjectMotionVectors = false,
            overrideMaterial           = scatterFurPointsMaterial,
            overrideMaterialPassIndex  = 0,
            layerMask = furMask,
        };

        scatterFurPointsMaterial.SetBuffer("furData", furData);
        // CoreUtils.SetRenderTarget(cmd, furMask, maskDepthBuffer, ClearFlag.All);
        CoreUtils.DrawRendererList(renderContext, cmd, RendererList.Create(result));

        if (furMesh != null && furMaterial != null)
        {
            //Update draw arguments:
            drawArgs[0] = furMesh.GetIndexCount(0);
            drawArgs[1] = 100; // this is filled by the geometry shader
            drawArgs[2] = furMesh.GetIndexStart(0);
            drawArgs[3] = furMesh.GetBaseVertex(0);

            drawFurBuffer.SetData(drawArgs);
            furMaterial.SetBuffer("furData", furData);
            cmd.DrawMeshInstancedIndirect(furMesh, 0, furMaterial, 0, drawFurBuffer);
        }
    }
    protected override void Execute(CustomPassContext ctx)
    {
        // Executed every frame for all the camera inside the pass volume.
        // The context contains the command buffer to use to enqueue graphics commands.

        CommandBuffer cmd          = ctx.cmd;
        Camera        shadowCamera = ctx.hdCamera.camera;

        cmd.SetGlobalTexture("_SelfShadowTexture", m_MainLightShadowmapTexture);

        CoreUtils.SetRenderTarget(cmd, m_MainLightShadowmapTexture, ClearFlag.All, Color.black);


        var renstateBlock = new RenderStateBlock(RenderStateMask.Depth)
        {
            depthState   = new DepthState(true, CompareFunction.LessEqual),
            stencilState = new StencilState(false),
        };


        var hairResult = new RendererListDesc(new ShaderTagId("DepthOnly"), ctx.cullingResults, shadowCamera)
        {
            rendererConfiguration      = PerObjectData.None,
            renderQueueRange           = RenderQueueRange.all, // to change
            sortingCriteria            = SortingCriteria.BackToFront,
            excludeObjectMotionVectors = false,
            overrideMaterial           = shadowMaterial,
            overrideMaterialPassIndex  = (shadowMaterial != null) ? shadowMaterial.FindPass("DepthOnly") : 0,
            stateBlock = renstateBlock,
            layerMask  = hairLayerMask,
        };

        CoreUtils.DrawRendererList(ctx.renderContext, cmd, RendererList.Create(hairResult));
    }
		protected override void Execute(CustomPassContext ctx)
		{
			#region Draw Vertex Color

			// use MRT to render JTRP Shader after Opaque / Sky
			// CoreUtils.SetRenderTarget(ctx.cmd, _customBuffer);
			// CoreUtils.ClearRenderTarget(ctx.cmd, ClearFlag.Color, Color.white);
			//
			// CoreUtils.SetRenderTarget(ctx.cmd, new RenderTargetIdentifier[] {ctx.cameraColorBuffer, _customBuffer},
			// 	ctx.cameraDepthBuffer);

			#endregion

			// render PP to tempBuffer and zhen copy back to cameraColor
			if (enablePPOutline)
			{
				SetupPPTempBuffer(ctx);
				CoreUtils.SetRenderTarget(ctx.cmd, _postProcessTempBuffer, ctx.cameraDepthBuffer);
				CoreUtils.ClearRenderTarget(ctx.cmd, ClearFlag.Color, Color.blue);
				DoPPOutline(ctx);
				BlitToCameraColorTexture(ctx, _postProcessTempBuffer);
			}

			// draw opaque
			var resultJTRPOpaque =
				new RendererListDesc(new ShaderTagId("JTRPLitToon"), ctx.cullingResults, ctx.hdCamera.camera)
				{
					rendererConfiguration = (PerObjectData) 2047, // all
					renderQueueRange = RenderQueueRange.opaque,
					sortingCriteria = SortingCriteria.CommonOpaque
				};
			SetRenderTargetAuto(ctx.cmd);
			CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(resultJTRPOpaque));

			// Procedural Geometry Outline
			if (enableGeometryOutline)
			{
				if (enable3XDepth)
				{
					Setup3XDepthBuffer();
					CoreUtils.SetRenderTarget(ctx.cmd, _depthBuffer, _depthBuffer);
					CoreUtils.ClearRenderTarget(ctx.cmd, ClearFlag.Depth, Color.black);

					var resultOpaqueDepthOnly =
						new RendererListDesc(new ShaderTagId("DepthOnly"), ctx.cullingResults, ctx.hdCamera.camera)
						{
							rendererConfiguration = (PerObjectData) 2047, // all
							renderQueueRange = RenderQueueRange.opaque,
							sortingCriteria = SortingCriteria.CommonOpaque
						};
					CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(resultOpaqueDepthOnly));
					SetRenderTargetAuto(ctx.cmd);
					Shader.SetGlobalTexture(_camera3XDepthTexture, _depthBuffer);
				}

				DoGeometryOutline(ctx);
			}
		}
Пример #7
0
        /// <summary>
        /// Execute the DrawRenderers with parameters setup from the editor
        /// </summary>
        /// <param name="ctx">The context of the custom pass. Contains command buffer, render context, buffer, etc.</param>
        protected override void Execute(CustomPassContext ctx)
        {
            var shaderPasses = GetShaderTagIds();

            if (overrideMaterial != null)
            {
                shaderPasses[shaderPasses.Length - 1] = new ShaderTagId(overrideMaterialPassName);
                overrideMaterial.SetFloat(fadeValueId, fadeValue);
            }

            if (shaderPasses.Length == 0)
            {
                Debug.LogWarning("Attempt to call DrawRenderers with an empty shader passes. Skipping the call to avoid errors");
                return;
            }

            var mask = overrideDepthState ? RenderStateMask.Depth : 0;

            mask |= overrideDepthState && !depthWrite ? RenderStateMask.Stencil : 0;
            var stateBlock = new RenderStateBlock(mask)
            {
                depthState = new DepthState(depthWrite, depthCompareFunction),
                // We disable the stencil when the depth is overwritten but we don't write to it, to prevent writing to the stencil.
                stencilState = new StencilState(false),
            };

            PerObjectData renderConfig = ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.GetBakedLightingWithShadowMaskRenderConfig() : HDUtils.GetBakedLightingRenderConfig();

            var result = new RendererUtils.RendererListDesc(shaderPasses, ctx.cullingResults, ctx.hdCamera.camera)
            {
                rendererConfiguration      = renderConfig,
                renderQueueRange           = GetRenderQueueRange(renderQueueType),
                sortingCriteria            = sortingCriteria,
                excludeObjectMotionVectors = false,
                overrideMaterial           = overrideMaterial,
                overrideMaterialPassIndex  = (overrideMaterial != null) ? overrideMaterial.FindPass(overrideMaterialPassName) : 0,
                stateBlock = stateBlock,
                layerMask  = layerMask,
            };

            var renderCtx = ctx.renderContext;

            CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, renderCtx.CreateRendererList(result));
        }
Пример #8
0
    public SRP0802_BasePassData Render_SRP0802_BasePass(Camera camera, RenderGraph graph, CullingResults cull)
    {
        using (var builder = graph.AddRenderPass <SRP0802_BasePassData>("Base Pass", out var passData, new ProfilingSampler("Base Pass Profiler")))
        {
            //Textures - Multi-RenderTarget
            TextureHandle Albedo = CreateColorTexture(graph, camera, "Albedo");
            passData.m_Albedo = builder.UseColorBuffer(Albedo, 0);
            TextureHandle Emission = CreateColorTexture(graph, camera, "Emission");
            passData.m_Emission = builder.UseColorBuffer(Emission, 1);
            TextureHandle Depth = CreateDepthTexture(graph, camera);
            passData.m_Depth = builder.UseDepthBuffer(Depth, DepthAccess.Write);

            //Renderers
            UnityEngine.Rendering.RendererUtils.RendererListDesc rendererDesc_base_Opaque = new UnityEngine.Rendering.RendererUtils.RendererListDesc(m_PassName1, cull, camera);
            rendererDesc_base_Opaque.sortingCriteria  = SortingCriteria.CommonOpaque;
            rendererDesc_base_Opaque.renderQueueRange = RenderQueueRange.opaque;
            RendererListHandle rHandle_base_Opaque = graph.CreateRendererList(rendererDesc_base_Opaque);
            passData.m_renderList_opaque = builder.UseRendererList(rHandle_base_Opaque);

            UnityEngine.Rendering.RendererUtils.RendererListDesc rendererDesc_base_Transparent = new UnityEngine.Rendering.RendererUtils.RendererListDesc(m_PassName1, cull, camera);
            rendererDesc_base_Transparent.sortingCriteria  = SortingCriteria.CommonTransparent;
            rendererDesc_base_Transparent.renderQueueRange = RenderQueueRange.transparent;
            RendererListHandle rHandle_base_Transparent = graph.CreateRendererList(rendererDesc_base_Transparent);
            passData.m_renderList_transparent = builder.UseRendererList(rHandle_base_Transparent);

            //Builder
            builder.SetRenderFunc((SRP0802_BasePassData data, RenderGraphContext context) =>
            {
                //Skybox - this will draw to the first target, i.e. Albedo
                if (camera.clearFlags == CameraClearFlags.Skybox)
                {
                    context.renderContext.DrawSkybox(camera);
                }

                CoreUtils.DrawRendererList(context.renderContext, context.cmd, data.m_renderList_opaque);
                CoreUtils.DrawRendererList(context.renderContext, context.cmd, data.m_renderList_transparent);
            });

            return(passData);
        }
    }
    protected override void Execute(CustomPassContext ctx)
    {
        PerObjectData renderConfig = PerObjectData.LightProbe | PerObjectData.Lightmaps | PerObjectData.LightProbeProxyVolume;

        if (ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask))
        {
            renderConfig |= PerObjectData.OcclusionProbe | PerObjectData.OcclusionProbeProxyVolume | PerObjectData.ShadowMask;
        }

        // We use a different HDRP shader passes for depth prepass (where we write depth + normal) and forward (were we only write color)
        bool isDepthNormal = injectionPoint == CustomPassInjectionPoint.AfterOpaqueDepthAndNormal;
        var  ids           = isDepthNormal ? depthPrepassIds : forwardIds;

        var result = new RendererListDesc(ids, ctx.cullingResults, ctx.hdCamera.camera)
        {
            rendererConfiguration      = renderConfig,
            renderQueueRange           = GetRenderQueueRange(RenderQueueType.AllOpaque),
            sortingCriteria            = SortingCriteria.CommonOpaque,
            excludeObjectMotionVectors = false,
            layerMask = layerMask,
        };

        if (isDepthNormal)
        {
            // Bind normal + depth buffer
            CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraNormalBuffer, ctx.cameraDepthBuffer, ClearFlag.None);

            // Enable keyword to write normal in the depth pre-pass
            CoreUtils.SetKeyword(ctx.cmd, "WRITE_NORMAL_BUFFER", true);
        }

        // Render all the opaque objects in the layer
        CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(result));

        if (isDepthNormal)
        {
            // Reset the keyword to it's default value
            CoreUtils.SetKeyword(ctx.cmd, "WRITE_NORMAL_BUFFER", ctx.hdCamera.frameSettings.litShaderMode == LitShaderMode.Forward);
        }
    }
Пример #10
0
        void DrawOutlineMeshes(CustomPassContext ctx)
        {
            // TODO: see how we can render objects without lights here.
            // Their rendered color is compared to black to find the outline... black on black...

            var result = new RendererListDesc(shaderTags, ctx.cullingResults, ctx.hdCamera.camera)
            {
                // We need the lighting render configuration to support rendering lit objects
                rendererConfiguration      = PerObjectData.LightProbe | PerObjectData.LightProbeProxyVolume | PerObjectData.Lightmaps,
                renderQueueRange           = RenderQueueRange.all,
                sortingCriteria            = SortingCriteria.BackToFront,
                excludeObjectMotionVectors = false,
                layerMask                 = outlineLayer,
                overrideMaterial          = fullscreenOutline,
                overrideMaterialPassIndex = 0
            };

            CoreUtils.SetRenderTarget(ctx.cmd, outlineBuffer, ctx.cameraDepthBuffer, ClearFlag.Color,
                                      new Color(99.0f, 99.0f, 99.0f) // clear target with a big number, hopefully bigger than anything. Next compare if <, instead of >
                                      );
            CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(result));
        }
Пример #11
0
    protected override void Execute(CustomPassContext ctx)
    {
        // This pass doesn't work with scene views
        if (ctx.hdCamera.camera.cameraType == CameraType.SceneView)
        {
            return;
        }

        CustomPassUtils.GaussianBlur(ctx, ctx.cameraColorBuffer, ctx.cameraColorBuffer, downSampleBuffer, radius: blurRadius);

        ShaderTagId[] litForwardTags = { HDShaderPassNames.s_ForwardOnlyName, HDShaderPassNames.s_ForwardName, HDShaderPassNames.s_SRPDefaultUnlitName };

        var result = new RendererListDesc(litForwardTags, ctx.cullingResults, ctx.hdCamera.camera)
        {
            rendererConfiguration      = PerObjectData.None,
            renderQueueRange           = RenderQueueRange.transparent,
            sortingCriteria            = SortingCriteria.CommonTransparent,
            excludeObjectMotionVectors = false,
            layerMask = uiLayer,
        };

        CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(result));
    }
        void ExecuteNormalBufferBlur(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, RTHandle cameraColor, RTHandle cameraDepth, RTHandle cameraNormal, CullingResults cullingResults)
        {
            if (!EnsureMaterial(ref passMaterial, NAME_SHADER))
            {
                return;
            }

            if (layerMask == 0)
            {
                return;
            }

            if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals))
            {
                return;
            }

            int bufferW = cameraColor.rt.width;
            int bufferH = cameraColor.rt.height;

            // allocate temporary buffers
            cmd.GetTemporaryRT(rtRegions, bufferW, bufferH, (int)DepthBits.None, FilterMode.Point, RenderTextureFormat.R8, RenderTextureReadWrite.Linear, 1, false);
            cmd.GetTemporaryRT(rtDecoded, bufferW, bufferH, (int)DepthBits.None, FilterMode.Point, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear, 1, false);

            // render decals to mark blur regions
            CoreUtils.SetRenderTarget(cmd,
                                      rtRegions, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store,
                                      cameraDepth, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store,
                                      ClearFlag.Color, Color.white
                                      );
            CoreUtils.SetViewport(cmd, cameraDepth);

            RendererListDesc renderListDesc = new RendererListDesc(NAME_PASS_REPLACE_TAG, cullingResults, hdCamera.camera)
            {
                rendererConfiguration      = PerObjectData.None,
                renderQueueRange           = GetRenderQueueRange(queue),
                sortingCriteria            = SortingCriteria.None,
                layerMask                  = layerMask,
                overrideMaterial           = passMaterial,
                overrideMaterialPassIndex  = PASS_MARK,
                stateBlock                 = null,
                excludeObjectMotionVectors = false,
            };

#if UNITY_2021_2_OR_NEWER
            CoreUtils.DrawRendererList(renderContext, cmd, renderContext.CreateRendererList(renderListDesc));
#elif UNITY_2020_2_OR_NEWER
            CoreUtils.DrawRendererList(renderContext, cmd, RendererList.Create(renderListDesc));
#else
            HDUtils.DrawRendererList(renderContext, cmd, RendererList.Create(renderListDesc));
#endif

            // decode normal buffer in marked regions
            CoreUtils.SetRenderTarget(cmd,
                                      rtDecoded, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store,
                                      cameraDepth, RenderBufferLoadAction.Load, RenderBufferStoreAction.DontCare,
                                      ClearFlag.None
                                      );
            CoreUtils.SetViewport(cmd, cameraDepth);

            cmd.SetRandomWriteTarget(2, cameraNormal);
            cmd.DrawProcedural(Matrix4x4.identity, passMaterial, PASS_DECODE, MeshTopology.Triangles, 3, 1);
            cmd.ClearRandomWriteTargets();

            // blur and re-encode normals in marked regions
            cmd.SetGlobalTexture(rtRegions, rtRegions);
            cmd.SetGlobalTexture(rtDecoded, rtDecoded);

            if (dbufferNormalMaskRTIDs != null)
            {
                CoreUtils.SetRenderTarget(cmd,
                                          dbufferNormalMaskRTIDs,
                                          cameraDepth,
                                          ClearFlag.None);
                CoreUtils.SetViewport(cmd, cameraDepth);

                cmd.SetRandomWriteTarget(2, cameraNormal);
                cmd.DrawProcedural(Matrix4x4.identity, passMaterial, PASS_BLUR_AND_ENCODE_AND_DECAL, MeshTopology.Triangles, 3, 1);
                cmd.ClearRandomWriteTargets();
            }
            else
            {
                CoreUtils.SetRenderTarget(cmd,
                                          cameraDepth, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store,
                                          ClearFlag.None
                                          );
                CoreUtils.SetViewport(cmd, cameraDepth);

                cmd.SetRandomWriteTarget(2, cameraNormal);
                cmd.DrawProcedural(Matrix4x4.identity, passMaterial, PASS_BLUR_AND_ENCODE, MeshTopology.Triangles, 3, 1);
                cmd.ClearRandomWriteTargets();
            }

            // free temporary buffers
            cmd.ReleaseTemporaryRT(rtRegions);
            cmd.ReleaseTemporaryRT(rtDecoded);
        }
Пример #13
0
		// TODO
		// 1.Draw hair vertex color to custom mask buffer
		// 2.Draw face with hair buffer and shadow map
		protected override void Execute(CustomPassContext ctx)
		{
			var renderCtx = ctx.renderContext;

			// Draw Vertex Color Mask
			CoreUtils.SetRenderTarget(ctx.cmd, _customBuffer);
			CoreUtils.ClearRenderTarget(ctx.cmd, ClearFlag.Color, Color.black);
			var resultJTRPMask =
				new RendererListDesc(_shaderTagId_JTRPMask, ctx.cullingResults, ctx.hdCamera.camera)
				{
					rendererConfiguration = PerObjectData.None,
					renderQueueRange = RenderQueueRange.all,
					sortingCriteria = SortingCriteria.CommonTransparent,
					// layerMask = LayerMask.GetMask("Hair"),
				};
			CoreUtils.DrawRendererList(renderCtx, ctx.cmd, renderCtx.CreateRendererList(resultJTRPMask));

			// Draw UTS Face
			SetRenderTargetAuto(ctx.cmd);
			ctx.cmd.SetGlobalTexture(_jtrpMask_Map, _customBuffer);
			var resultJTRPFace =
				new RendererListDesc(_shaderTagId_JTRPFace, ctx.cullingResults, ctx.hdCamera.camera)
				{
					rendererConfiguration = (PerObjectData)2047, // all
					renderQueueRange = RenderQueueRange.all,
					sortingCriteria = SortingCriteria.CommonTransparent,
					// layerMask = LayerMask.GetMask("Face"),
				};
			CoreUtils.DrawRendererList(renderCtx, ctx.cmd, renderCtx.CreateRendererList(resultJTRPFace));

			// render PP to tempBuffer and zhen copy back to cameraColor
			if (enablePPOutline)
			{
				SetupPPTempBuffer(ctx);
				CoreUtils.SetRenderTarget(ctx.cmd, _postProcessTempBuffer, ctx.cameraDepthBuffer);
				CoreUtils.ClearRenderTarget(ctx.cmd, ClearFlag.Color, Color.blue);
				DoPPOutline(ctx);
				BlitToCameraColorTexture(ctx, _postProcessTempBuffer);
			}

			// Procedural Geometry Outline
			if (enableGeometryOutline)
			{
				if (enable3XDepth)
				{
					Setup3XDepthBuffer();
					CoreUtils.SetRenderTarget(ctx.cmd, _depthBuffer, _depthBuffer);
					CoreUtils.ClearRenderTarget(ctx.cmd, ClearFlag.Depth, Color.black);

					var resultOpaqueDepthOnly =
						new RendererListDesc(new ShaderTagId("DepthOnly"), ctx.cullingResults, ctx.hdCamera.camera)
						{
							rendererConfiguration = (PerObjectData)2047, // all
							renderQueueRange = RenderQueueRange.opaque,
							sortingCriteria = SortingCriteria.CommonOpaque
						};
					CoreUtils.DrawRendererList(renderCtx, ctx.cmd, renderCtx.CreateRendererList(resultOpaqueDepthOnly));
					SetRenderTargetAuto(ctx.cmd);
					Shader.SetGlobalTexture(_camera3XDepthTexture, _depthBuffer);
				}

				DoGeometryOutline(ctx);
			}

			// Set BackFace Outline
			Shader.SetGlobalFloat("_JTRP_Enable_Global_BackFace_Outline", enableBackFaceOutline ? 1 : 0);
		}