protected Texture2D gradientX;// = new Texture2D(256, 1, TextureFormat.ARGB32, false); // 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, m_OffsetY, m_Mirror)); 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, m_PixelDepth)); SetCommonVars(mat); Graphics.Blit(gradientX, destination, mat, (int)ShaderOp.AnimCurveDraw); // Debug.LogError(" multiply in Final" + timer.ElapsedMilliseconds + " ms"); }
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, m_PixelDepth), m_Filter)); }
protected Texture2D gradientX;// = 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", m_TexMode == TexMode.Greyscale ? 1 : 0); mat.SetInt("_TextureBIsGrey", 1); mat.SetVector("_Multiply", new Vector4(1, 1, 0, 0)); AnimCurveToTexture(ref gradientX, m_Gradient); // m_TexMode=TexMode.Greyscale; RenderTexture destination = _output.CreateRenderDestination(m_TexWidth, m_TexHeight, TextureParam.GetRTFormat(m_TexMode == TexMode.Greyscale, m_PixelDepth)); SetCommonVars(mat); Graphics.Blit(gradientX, destination, mat, (int)ShaderOp.CopyRGBA); // Debug.LogError(" multiply in Final" + timer.ElapsedMilliseconds + " ms"); }
protected RenderTexture CreateRenderDestination(TextureParam _output) { return(_output.CreateRenderDestination(m_TexWidth, m_TexHeight, TextureParam.GetRTFormat(m_TexMode == TexMode.Greyscale, m_PixelDepth), m_Filter)); }