コード例 #1
0
        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);
        }
コード例 #2
0
    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);
    }
コード例 #3
0
 void Awake()
 {
     instance = this;
 }