Example #1
0
    protected Texture2D gradientY; // = new Texture2D(256, 1, TextureFormat.ARGB32, false);
    public void ExecuteRemapCurve(float _size, TextureParam _output)
    {
        System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
        timer.Start();
        Material mat = GetMaterial("TextureOps");

        mat.SetInt("_MainIsGrey", 1);//_input.IsGrey() ? 1 : 0);
        mat.SetInt("_TextureBIsGrey", 1);
        mat.SetVector("_Multiply", new Vector4(m_RepeatX, m_RepeatY, 0, 0));

        AnimCurveToTexture(ref gradientX, m_RemapCurve);
        AnimCurveToTexture(ref gradientY, m_RemapCurveY);


        mat.SetTexture("_GradientTex", gradientY);
//        mat.SetVector("_TexSizeRecip", new Vector4(1.0f / (float)_input.m_Width, 1.0f / (float)_input.m_Height, _size, 0));
        m_TexMode = TexMode.Greyscale;
        RenderTexture destination = _output.CreateRenderDestination(m_TexWidth, m_TexHeight, TextureParam.GetRTFormat(m_TexMode == TexMode.Greyscale));

        SetCommonVars(mat);
        Graphics.Blit(gradientX, destination, mat, (int)ShaderOp.GenCurve);


//        Debug.LogError(" multiply in Final" + timer.ElapsedMilliseconds + " ms");
    }
Example #2
0
 protected RenderTexture CreateRenderDestination(TextureParam _input, TextureParam _output)
 {
     if (_input == _output)
     {
         Debug.LogError(" using input as output ");
     }
     return(_output.CreateRenderDestination(m_TexWidth, m_TexHeight, TextureParam.GetRTFormat(m_TexMode == TexMode.Greyscale)));
 }
Example #3
0
 protected RenderTexture CreateRenderDestination(TextureParam _output)
 {
     return(_output.CreateRenderDestination(m_TexWidth, m_TexHeight, TextureParam.GetRTFormat(m_TexMode == TexMode.Greyscale)));
 }