public void OnGUI(DeluxeTonemapper.Mode mode) { SetupCurve(); float denom = m_WhitePoint - m_BlackPoint; float co = (m_CrossOverPoint - m_BlackPoint) / denom; if (Mathf.Abs(denom) < 0.001f) { co = 0.5f; } Rect r = EditorGUILayout.BeginVertical(GUILayout.MinHeight(60)); Rect rr = GUILayoutUtility.GetRect(Mathf.Min(r.width, 60), 60); EditorGUI.CurveField(rr, m_Curve); EditorGUILayout.EndVertical(); m_BlackPoint = DoSlider("Minimum Intensity (Black point)", m_BlackPoint, 0.0f, 1.0f); m_WhitePoint = DoSlider("Maximum Intensity (White point)", m_WhitePoint, 0.0f, 6.0f); co = DoSlider("Mid-value (Crossover)", co, 0.0f, 1.0f); m_ToeStrength = -1.0f * DoSlider("Dark Intensity (Toe)", -1.0f * m_ToeStrength, -0.99f, 0.99f); m_ShoulderStrength = DoSlider("Bright Intensity (Shoulder)", m_ShoulderStrength, -0.99f, 0.99f); if (mode == DeluxeTonemapper.Mode.ExtendedLuminance) { m_LuminositySaturationPoint = DoSlider("Luminance Saturation", m_LuminositySaturationPoint, 0, 5.0f); } m_CrossOverPoint = co * (m_WhitePoint - m_BlackPoint) + m_BlackPoint; UpdateCoefficients(); }
private void OnRenderImage(RenderTexture source, RenderTexture destination) { if (this.m_Mode != this.m_LastMode) { this.ReloadShaders(); } this.m_LastMode = this.m_Mode; this.CreateMaterials(); this.UpdateCoefficients(); Graphics.Blit(source, destination, this.m_Material); }