Esempio n. 1
0
 public void EnableThis()
 {
     if (!targets.initialized)
     {
         targets = RenderTargets.Init();
     }
 }
 void Awake()
 {
     cam = GetComponent <Camera>();
     cam.renderingPath = RenderingPath.Forward;
     cam.cullingMask   = 0;
     targets           = RenderTargets.Init();
 }
 public void EnableThis(PipelineResources res)
 {
     if (!targets.initialized)
     {
         targets = RenderTargets.Init();
     }
 }
Esempio n. 4
0
 public static void RunPostProcess(ref RenderTargets targets, out RenderTargetIdentifier source, out RenderTargetIdentifier dest)
 {
     source = targets.renderTargetIdentifier;
     dest   = targets.backupIdentifier;
     targets.backupIdentifier       = targets.renderTargetIdentifier;
     targets.renderTargetIdentifier = dest;
 }
 void Awake()
 {
     cam = GetComponent <Camera>();
     cam.renderingPath = RenderingPath.Forward;
     cam.cullingMask   = 0;
     cam.clearFlags    = CameraClearFlags.Nothing;
     targets           = RenderTargets.Init();
 }
        public static void RunPostProcess(ref RenderTargets targets, CommandBuffer buffer, ref PipelineCommandData data, PostProcessAction renderFunc)
        {
            renderFunc(ref data, buffer, targets.renderTargetIdentifier, targets.backupIdentifier);
            RenderTargetIdentifier back = targets.backupIdentifier;

            targets.backupIdentifier       = targets.renderTargetIdentifier;
            targets.renderTargetIdentifier = back;
        }
Esempio n. 7
0
 public static void DrawCluster(ref RenderClusterOptions options, ref RenderTargets targets, ref PipelineCommandData data, Camera cam)
 {
     if (gpurpEnabled)
     {
         options.command.SetGlobalBuffer(ShaderIDs._PropertiesBuffer, commonData.propertyBuffer);
         options.command.SetGlobalTexture(ShaderIDs._MainTex, commonData.texArray);
         PipelineFunctions.SetBaseBuffer(baseBuffer, options.cullingShader, options.frustumPlanes, options.command);
         PipelineFunctions.RunCullDispatching(baseBuffer, options.cullingShader, options.isOrtho, options.command);
         PipelineFunctions.RenderProceduralCommand(baseBuffer, commonData.clusterMaterial, options.command);
     }
     RenderScene(ref data, cam);
 }
        public static void RunPostProcess(ref RenderTargets targets, CommandBuffer buffer, ref PipelineCommandData data, PostProcessAction renderFunc)
        {
            RenderTexture source = targets.renderTarget;
            RenderTexture dest   = targets.backupTarget;

            renderFunc(ref data, buffer, source, dest);
            targets.renderTarget = dest;
            targets.backupTarget = source;
            RenderTargetIdentifier back = targets.backupIdentifier;

            targets.backupIdentifier       = targets.renderTargetIdentifier;
            targets.renderTargetIdentifier = back;
        }
Esempio n. 9
0
        public void Render(CommandBuffer buffer, ref RenderTargets targets)
        {
            if (!enabled)
            {
                return;
            }
            buffer.SetGlobalConstantBuffer(constantBuffer, _CyberData, 0, sizeof(CyberSetData));
            SetValue();
            RenderTargetIdentifier source, dest;

            PipelineFunctions.RunPostProcess(ref targets, out source, out dest);
            buffer.Blit(source, dest, glitchMat);
        }
Esempio n. 10
0
 public static void DrawCluster(ref RenderClusterOptions options, ref RenderTargets targets, ref PipelineCommandData data, Camera cam)
 {
     data.buffer.SetRenderTarget(targets.gbufferIdentifier, targets.depthBuffer);
     data.buffer.ClearRenderTarget(true, true, Color.black);
     if (gpurpEnabled)
     {
         options.command.SetGlobalBuffer(ShaderIDs._PropertiesBuffer, commonData.propertyBuffer);
         options.command.SetGlobalTexture(ShaderIDs._MainTex, commonData.texArray);
         options.command.SetGlobalTexture(ShaderIDs._LightMap, commonData.lightmapArray);
         PipelineFunctions.SetBaseBuffer(baseBuffer, options.cullingShader, options.frustumPlanes, options.command);
         PipelineFunctions.RunCullDispatching(baseBuffer, options.cullingShader, options.command);
         PipelineFunctions.RenderProceduralCommand(baseBuffer, commonData.clusterMaterial, options.command);
     }
     RenderScene(ref data, cam);
 }
 public virtual void DrawClusterOccDoubleCheck(ref RenderClusterOptions options, ref HizOptions hizOpts, ref RenderTargets rendTargets)
 {
 }
        public override void DrawClusterOccDoubleCheck(ref RenderClusterOptions options, ref HizOptions hizOpts, ref RenderTargets rendTargets)
        {
            CommandBuffer buffer           = options.command;
            ComputeShader gpuFrustumShader = options.cullingShader;

            PipelineFunctions.UpdateOcclusionBuffer(
                baseBuffer, gpuFrustumShader,
                buffer,
                hizOpts.hizData,
                options.frustumPlanes,
                options.isOrtho);
            //绘制第一次剔除结果
            PipelineFunctions.DrawLastFrameCullResult(baseBuffer, buffer, options.proceduralMaterial);
            //更新Vector,Depth Mip Map
            hizOpts.hizData.lastFrameCameraUp = hizOpts.currentCameraUpVec;
            PipelineFunctions.ClearOcclusionData(baseBuffer, buffer, gpuFrustumShader);
            //TODO 绘制其他物体

            //TODO
            buffer.Blit(hizOpts.currentDepthTex, hizOpts.hizData.historyDepth, hizOpts.linearLODMaterial, 0);
            hizOpts.hizDepth.GetMipMap(hizOpts.hizData.historyDepth, buffer);
            //使用新数据进行二次剔除
            PipelineFunctions.OcclusionRecheck(baseBuffer, gpuFrustumShader, buffer, hizOpts.hizData);
            //绘制二次剔除结果
            buffer.SetRenderTarget(rendTargets.gbufferIdentifier, rendTargets.depthIdentifier);
            PipelineFunctions.DrawRecheckCullResult(baseBuffer, options.proceduralMaterial, buffer);
            buffer.Blit(hizOpts.currentDepthTex, hizOpts.hizData.historyDepth, hizOpts.linearLODMaterial, 0);
            hizOpts.hizDepth.GetMipMap(hizOpts.hizData.historyDepth, buffer);
        }
 public static void DrawCluster(ref RenderClusterOptions options, ref RenderTargets targets, ref PipelineCommandData data, Camera cam)
 {
     data.buffer.SetRenderTarget(targets.gbufferIdentifier, targets.depthBuffer);
     data.buffer.ClearRenderTarget(true, true, Color.black);
     RenderScene(ref data, cam);
 }
Esempio n. 14
0
        private void RenderScreenSpaceReflection(CommandBuffer SSGi_Buffer, PipelineCamera cam, ref RenderTargets targets)
        {
            Camera   RenderCamera = cam.cam;
            SSGIData data         = IPerCameraData.GetProperty(cam, (cc) => new SSGIData(int2(cc.cam.pixelWidth, cc.cam.pixelHeight)));

            data.UpdateResolution(int2(cam.cam.pixelWidth, cam.cam.pixelHeight));
            //////Set HierarchicalDepthRT//////
            SSGi_Buffer.CopyTexture(ShaderIDs._CameraDepthTexture, 0, 0, data.SSGi_HierarchicalDepth_RT, 0, 0);
            for (int i = 1; i < HiZ_MaxLevel; ++i)
            {
                SSGi_Buffer.SetGlobalInt(SSGi_HiZ_PrevDepthLevel_ID, i - 1);
                SSGi_Buffer.SetRenderTarget(data.SSGi_HierarchicalDepth_BackUp_RT, i);
                SSGi_Buffer.DrawMesh(GraphicsUtility.mesh, Matrix4x4.identity, SSGi_Material, 0, RenderPass_HiZ_Depth);
                SSGi_Buffer.CopyTexture(data.SSGi_HierarchicalDepth_BackUp_RT, 0, i, data.SSGi_HierarchicalDepth_RT, 0, i);
            }
            SSGi_Buffer.SetGlobalTexture(SSGi_HierarchicalDepth_ID, data.SSGi_HierarchicalDepth_RT);

            SSGi_Buffer.GetTemporaryRT(SSGi_SceneColor_ID, RenderCamera.pixelWidth, RenderCamera.pixelHeight, 0, FilterMode.Bilinear, RenderTextureFormat.ARGBHalf);
            SSGi_Buffer.CopyTexture(targets.renderTargetIdentifier, 0, 0, SSGi_SceneColor_ID, 0, 0);


            //////RayCasting//////
            SSGi_Buffer.GetTemporaryRT(SSGi_Trace_ID, RenderCamera.pixelWidth, RenderCamera.pixelHeight, 0, FilterMode.Point, RenderTextureFormat.ARGBHalf);
            SSGi_Buffer.BlitSRT(SSGi_Trace_ID, SSGi_Material, RenderPass_HiZ3D_MultiSpp);
            SSGi_Buffer.Blit(SSGi_Trace_ID, targets.renderTargetIdentifier);
        }