Beispiel #1
0
        public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data)
        {
            CommandBuffer buffer = data.buffer;

            buffer.SetRenderTarget(cam.targets.gbufferIdentifier, cam.targets.depthIdentifier);
            buffer.ClearRenderTarget(true, true, Color.black);
            HizOcclusionData     hizData = IPerCameraData.GetProperty(cam, () => new HizOcclusionData());
            RenderClusterOptions options = new RenderClusterOptions
            {
                command        = buffer,
                frustumPlanes  = data.frustumPlanes,
                cullingShader  = data.resources.shaders.gpuFrustumCulling,
                terrainCompute = data.resources.shaders.terrainCompute
            };

            if (enableOcclusionCulling)
            {
                HizOptions hizOptions;
                hizOptions = new HizOptions
                {
                    currentCameraUpVec = cam.cam.transform.up,
                    hizData            = hizData,
                    hizDepth           = hizDepth,
                    linearLODMaterial  = linearMat,
                    currentDepthTex    = cam.targets.depthIdentifier
                };
                SceneController.DrawClusterOccDoubleCheck(ref options, ref hizOptions, ref cam.targets, ref data, cam.cam);
            }
            else
            {
                SceneController.DrawCluster(ref options, ref cam.targets, ref data, cam.cam);
            }
        }
Beispiel #2
0
        public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data)
        {
            CommandBuffer        buffer  = data.buffer;
            RenderClusterOptions options = new RenderClusterOptions
            {
                command        = buffer,
                frustumPlanes  = data.frustumPlanes,
                cullingShader  = data.resources.shaders.gpuFrustumCulling,
                terrainCompute = data.resources.shaders.terrainCompute
            };

            if (enableOcclusionCulling)
            {
                if (SceneController.gpurpEnabled)
                {
                    buffer.SetRenderTarget(hizDepth.backupMip);
                    buffer.ClearRenderTarget(true, true, Color.white);
                    if (OccluderDrawer.current)
                    {
                        OccluderDrawer.current.Drawer(buffer, linearDrawerMat, data.frustumPlanes);
                    }
                }
                SceneController.DrawClusterOccDoubleCheck(ref options, ref cam.targets, ref data, ref hizDepth, linearMat, cam.cam);
            }
            else
            {
                SceneController.DrawCluster(ref options, ref cam.targets, ref data, cam.cam);
            }
        }