Example #1
0
    private void DownSample4x(RenderTexture source, RenderTexture dest)
    {
        RenderTexture.set_active(dest);
        source.SetGlobalShaderProperty("__RenderTex");
        float offsetX = 1f / (float)source.get_width();
        float offsetY = 1f / (float)source.get_height();

        GL.PushMatrix();
        GL.LoadOrtho();
        Material material = this.GetMaterial();

        checked
        {
            for (int i = 0; i < material.get_passCount(); i++)
            {
                material.SetPass(i);
                DepthOfFieldEffect.Render4TapQuad(dest, offsetX, offsetY);
            }
            GL.PopMatrix();
        }
    }
Example #2
0
    private void FourTapCone(RenderTexture source, RenderTexture dest, int iteration)
    {
        RenderTexture.set_active(dest);
        source.SetGlobalShaderProperty("__RenderTex");
        float offsetX = (0.5f + (float)iteration * this.blurSpread) / (float)source.get_width();
        float offsetY = (0.5f + (float)iteration * this.blurSpread) / (float)source.get_height();

        GL.PushMatrix();
        GL.LoadOrtho();
        Material material = this.GetMaterial();

        checked
        {
            for (int i = 0; i < material.get_passCount(); i++)
            {
                material.SetPass(i);
                DepthOfFieldEffect.Render4TapQuad(dest, offsetX, offsetY);
            }
            GL.PopMatrix();
        }
    }