protected override void RenderLut3D(RenderTexture source, RenderTexture destination) { if (LookupTexture.name != m_BaseTextureName) { ConvertBaseTexture(); } if (m_Lut3D == null) { SetIdentityLut(); } m_Lut3D.filterMode = FilterMode.Point; Material.SetTexture("_LookupTex", m_Lut3D); float lutSize = (float)m_Lut3D.width; Material.SetVector("_Params", new Vector4( (lutSize - 1f) / (1f * lutSize), 1f / (2f * lutSize), Amount, PixelSize )); int pass = (Pixelize ? 2 : 0) + (CLib.IsLinearColorSpace() ? 1 : 0); Graphics.Blit(source, destination, Material, pass); }
protected virtual void RenderLut2D(RenderTexture source, RenderTexture destination) { float tileSize = Mathf.Sqrt((float)LookupTexture.width); Material.SetTexture("_LookupTex", LookupTexture); Material.SetVector("_Params1", new Vector3(1f / (float)LookupTexture.width, 1f / (float)LookupTexture.height, tileSize - 1f)); Material.SetVector("_Params2", new Vector2(Amount, 0f)); Graphics.Blit(source, destination, Material, CLib.IsLinearColorSpace() ? 1 : 0); }
protected override void OnRenderImage(RenderTexture source, RenderTexture destination) { if (Amount <= 0f) { Graphics.Blit(source, destination); return; } Material.SetFloat("_Amount", Amount); Graphics.Blit(source, destination, Material, CLib.IsLinearColorSpace() ? 1 : 0); }
protected override void RenderLut2D(RenderTexture source, RenderTexture destination) { float tileSize = Mathf.Sqrt((float)LookupTexture.width); Material.SetTexture("_LookupTex", LookupTexture); Material.SetVector("_Params1", new Vector3(1f / (float)LookupTexture.width, 1f / (float)LookupTexture.height, tileSize - 1f)); Material.SetVector("_Params2", new Vector2(Amount, PixelSize)); int pass = (Pixelize ? 6 : 4) + (CLib.IsLinearColorSpace() ? 1 : 0); Graphics.Blit(source, destination, Material, pass); }
protected override void OnRenderImage(RenderTexture source, RenderTexture destination) { Material.SetColor("_White", White); Material.SetColor("_Black", Black); Material.SetColor("_Red", Red); Material.SetColor("_Green", Green); Material.SetColor("_Blue", Blue); Material.SetColor("_Yellow", Yellow); Material.SetColor("_Magenta", Magenta); Material.SetColor("_Cyan", Cyan); Material.SetFloat("_Amount", Amount); Graphics.Blit(source, destination, Material, CLib.IsLinearColorSpace() ? 1 : 0); }
protected virtual void RenderLut3D(RenderTexture source, RenderTexture destination) { if (LookupTexture.name != m_BaseTextureName) { ConvertBaseTexture(); } if (m_Lut3D == null) { SetIdentityLut(); } Material.SetTexture("_LookupTex", m_Lut3D); float lutSize = (float)m_Lut3D.width; Material.SetVector("_Params", new Vector3( (lutSize - 1f) / (1f * lutSize), 1f / (2f * lutSize), Amount )); Graphics.Blit(source, destination, Material, CLib.IsLinearColorSpace() ? 1 : 0); }
protected override void OnRenderImage(RenderTexture source, RenderTexture destination) { if (Amount <= 0f) { Graphics.Blit(source, destination); return; } if (m_DitherPattern == null) { m_DitherPattern = Resources.Load <Texture2D>("Misc/DitherPattern"); } Material.SetTexture("_Pattern", m_DitherPattern); Material.SetVector("_Params", new Vector4(RedLuminance, GreenLuminance, BlueLuminance, Amount)); int pass = ShowOriginal ? 4 : 0; pass += ConvertToGrayscale ? 2 : 0; pass += CLib.IsLinearColorSpace() ? 1 : 0; Graphics.Blit(source, destination, Material, pass); }
protected virtual void Reset() { White = CLib.IsLinearColorSpace() ? new Color(0.72974005284f, 0.72974005284f, 0.72974005284f) : new Color(0.5f, 0.5f, 0.5f); }