Пример #1
0
    private void OnPostRender()
    {
        Camera cam = Camera.current;

        Shader.SetGlobalTexture(_DepthTexture, depthTexture);
        //Graphics.SetRenderTarget(cameraTarget);
        Graphics.SetRenderTarget(GBuffers, depthTexture.depthBuffer);
        GL.Clear(true, true, Color.black);

        //pureColorMaterial.color = new Color(0, 0.5f, 0.8f);
        //pureColorMaterial.SetPass(0);
        deferredLighting.deferredMaterial.SetPass(0);
        foreach (var i in cubeTransforms)
        {
            Graphics.DrawMeshNow(cubeMesh, i.localToWorldMatrix);
        }

        skybox.DrawSkybox(cam);

        Graphics.Blit(cameraTarget, cam.targetTexture);
    }