コード例 #1
0
ファイル: MKGlow.cs プロジェクト: cedricIGV/CircleShooter
        private void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            if (workflow == Workflow.Selective && PipelineProperties.xrEnabled)
            {
                Graphics.Blit(source, destination);
                return;
            }

            _commandBuffer.Clear();

            _tmpRenderDimension.width  = RenderingCamera.pixelWidth;
            _tmpRenderDimension.height = RenderingCamera.pixelHeight;
            _tmpContext.UpdateRenderContext(RenderingCamera, effect.renderTextureFormat, 0, _tmpRenderDimension);
            _tmpTexture = PipelineExtensions.GetTemporary(_tmpContext, effect.renderTextureFormat);
            effect.Build(source, _tmpTexture, this, _commandBuffer, RenderingCamera);

            Graphics.ExecuteCommandBuffer(_commandBuffer);

            //Additional copy is need when rendering using commandbuffer and OnRenderImage to avoid warnings / flipped image
            //For now stick with the builtin blit, this could be optimized some day by allowing compute shaders in the final glow pass
            //and using pixel shaders for the final blit
            Graphics.Blit(_tmpTexture, destination);

            RenderTexture.ReleaseTemporary(_tmpTexture);
        }
コード例 #2
0
        private void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            if (workflow == Workflow.Selective && PipelineProperties.xrEnabled)
            {
                Graphics.Blit(source, destination);
                return;
            }

            _tmpDimension.width  = renderingCamera.pixelWidth;
            _tmpDimension.height = renderingCamera.pixelHeight;

            _tmpContext.UpdateRenderContext(renderingCamera, _effect.renderTextureFormat, source.depth, _tmpDimension);
            _tmpTexture = PipelineExtensions.GetTemporary(_tmpContext, _effect.renderTextureFormat);

            _effect.Build(source, _tmpTexture, this, renderingCamera);

            Graphics.Blit(_tmpTexture, destination);
            RenderTexture.ReleaseTemporary(_tmpTexture);
        }