Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ void DrawWheel(ref Vector4 value, bool overrideState, TrackballAttribute attr)
s_Material = new Material(Shader.Find("Hidden/PostProcessing/Editor/Trackball")) { hideFlags = HideFlags.HideAndDontSave };

// Wheel texture
#if UNITY_2018_1_OR_NEWER
#if UNITY_2018_1_OR_NEWER
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.sRGB;
#else
#else
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.Linear;
#endif
#endif

var oldRT = RenderTexture.active;
var rt = RenderTexture.GetTemporary((int)(size * scale), (int)(size * scale), 0, RenderTextureFormat.ARGB32, kReadWrite);
Expand Down Expand Up @@ -118,11 +118,14 @@ void DrawWheel(ref Vector4 value, bool overrideState, TrackballAttribute attr)

switch (attr.mode)
{
case TrackballAttribute.Mode.Lift: displayValue = ColorUtilities.ColorToLift(value);
case TrackballAttribute.Mode.Lift:
displayValue = ColorUtilities.ColorToLift(value);
break;
case TrackballAttribute.Mode.Gamma: displayValue = ColorUtilities.ColorToInverseGamma(value);
case TrackballAttribute.Mode.Gamma:
displayValue = ColorUtilities.ColorToInverseGamma(value);
break;
case TrackballAttribute.Mode.Gain: displayValue = ColorUtilities.ColorToGain(value);
case TrackballAttribute.Mode.Gain:
displayValue = ColorUtilities.ColorToGain(value);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,21 +579,29 @@ void DoCurvesGUI(bool hdr)
{
switch (curveEditingId)
{
case 0: m_RawMasterCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
case 0:
m_RawMasterCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
break;
case 1: m_RawRedCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
case 1:
m_RawRedCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
break;
case 2: m_RawGreenCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
case 2:
m_RawGreenCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
break;
case 3: m_RawBlueCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
case 3:
m_RawBlueCurve.animationCurveValue = AnimationCurve.Linear(0f, 0f, 1f, 1f);
break;
case 4: m_RawHueVsHueCurve.animationCurveValue = new AnimationCurve();
case 4:
m_RawHueVsHueCurve.animationCurveValue = new AnimationCurve();
break;
case 5: m_RawHueVsSatCurve.animationCurveValue = new AnimationCurve();
case 5:
m_RawHueVsSatCurve.animationCurveValue = new AnimationCurve();
break;
case 6: m_RawSatVsSatCurve.animationCurveValue = new AnimationCurve();
case 6:
m_RawSatVsSatCurve.animationCurveValue = new AnimationCurve();
break;
case 7: m_RawLumVsSatCurve.animationCurveValue = new AnimationCurve();
case 7:
m_RawLumVsSatCurve.animationCurveValue = new AnimationCurve();
break;
}
}
Expand Down Expand Up @@ -694,11 +702,11 @@ void DrawBackgroundTexture(Rect rect, int pass)

float scale = EditorGUIUtility.pixelsPerPoint;

#if UNITY_2018_1_OR_NEWER
#if UNITY_2018_1_OR_NEWER
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.sRGB;
#else
#else
const RenderTextureReadWrite kReadWrite = RenderTextureReadWrite.Linear;
#endif
#endif

var oldRt = RenderTexture.active;
var rt = RenderTexture.GetTemporary(Mathf.CeilToInt(rect.width * scale), Mathf.CeilToInt(rect.height * scale), 0, RenderTextureFormat.ARGB32, kReadWrite);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ sealed class PostProcessLayerEditor : BaseEditor<PostProcessLayer>

Dictionary<PostProcessEvent, ReorderableList> m_CustomLists;

#if UNITY_2017_3_OR_NEWER
#if UNITY_2017_3_OR_NEWER
Camera m_TargetCameraComponent;
#endif
#endif

static GUIContent[] s_AntialiasingMethodNames =
{
Expand Down Expand Up @@ -80,9 +80,9 @@ void OnEnable()
m_ShowToolkit = serializedObject.FindProperty("m_ShowToolkit");
m_ShowCustomSorter = serializedObject.FindProperty("m_ShowCustomSorter");

#if UNITY_2017_3_OR_NEWER
#if UNITY_2017_3_OR_NEWER
m_TargetCameraComponent = m_Target.GetComponent<Camera>();
#endif
#endif
}

void OnDisable()
Expand Down Expand Up @@ -161,14 +161,14 @@ void DoAntialiasing()

if (m_AntialiasingMode.intValue == (int)PostProcessLayer.Antialiasing.TemporalAntialiasing)
{
#if !UNITY_2017_3_OR_NEWER
#if !UNITY_2017_3_OR_NEWER
if (RuntimeUtilities.isSinglePassStereoSelected)
EditorGUILayout.HelpBox("TAA requires Unity 2017.3+ for Single-pass stereo rendering support.", MessageType.Warning);
#endif
#if UNITY_2017_3_OR_NEWER
#endif
#if UNITY_2017_3_OR_NEWER
if (m_TargetCameraComponent != null && m_TargetCameraComponent.allowDynamicResolution)
EditorGUILayout.HelpBox("TAA is not supported with Dynamic Resolution.", MessageType.Warning);
#endif
#endif

EditorGUILayout.PropertyField(m_TaaJitterSpread);
EditorGUILayout.PropertyField(m_TaaStationaryBlending);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ internal MenuAction(SerializedProperty curve, Vector3 position)

public CurveEditor()
: this(Settings.defaultSettings)
{}
{ }

public CurveEditor(Settings settings)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ static class GlobalSettings
static class Keys
{
internal const string trackballSensitivity = "PostProcessing.Trackball.Sensitivity";
internal const string volumeGizmoColor = "PostProcessing.Volume.GizmoColor";
internal const string currentChannelMixer = "PostProcessing.ChannelMixer.CurrentChannel";
internal const string currentCurve = "PostProcessing.Curve.Current";
internal const string volumeGizmoColor = "PostProcessing.Volume.GizmoColor";
internal const string currentChannelMixer = "PostProcessing.ChannelMixer.CurrentChannel";
internal const string currentCurve = "PostProcessing.Curve.Current";
}

static bool m_Loaded = false;
Expand Down Expand Up @@ -48,7 +48,7 @@ static GlobalSettings()
Load();
}

#if UNITY_2018_3_OR_NEWER
#if UNITY_2018_3_OR_NEWER
[SettingsProvider]
static SettingsProvider PreferenceGUI()
{
Expand All @@ -58,14 +58,14 @@ static SettingsProvider PreferenceGUI()
};
}

#else
#else
[PreferenceItem("Post-processing")]
static void PreferenceGUI()
{
OpenGUI();
}

#endif
#endif

static void OpenGUI()
{
Expand All @@ -75,15 +75,15 @@ static void OpenGUI()
EditorGUILayout.Space();

trackballSensitivity = EditorGUILayout.Slider("Trackballs Sensitivity", trackballSensitivity, 0.05f, 1f);
volumeGizmoColor = EditorGUILayout.ColorField("Volume Gizmo Color", volumeGizmoColor);
volumeGizmoColor = EditorGUILayout.ColorField("Volume Gizmo Color", volumeGizmoColor);
}

static void Load()
{
m_TrackballSensitivity = EditorPrefs.GetFloat(Keys.trackballSensitivity, 0.2f);
m_VolumeGizmoColor = GetColor(Keys.volumeGizmoColor, new Color(0.2f, 0.8f, 0.1f, 0.5f));
m_CurrentChannelMixer = EditorPrefs.GetInt(Keys.currentChannelMixer, 0);
m_CurrentCurve = EditorPrefs.GetInt(Keys.currentCurve, 0);
m_VolumeGizmoColor = GetColor(Keys.volumeGizmoColor, new Color(0.2f, 0.8f, 0.1f, 0.5f));
m_CurrentChannelMixer = EditorPrefs.GetInt(Keys.currentChannelMixer, 0);
m_CurrentCurve = EditorPrefs.GetInt(Keys.currentCurve, 0);

m_Loaded = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public enum AmbientOcclusionQuality
/// A volume parameter holding a <see cref="AmbientOcclusionMode"/> value.
/// </summary>
[Serializable]
public sealed class AmbientOcclusionModeParameter : ParameterOverride<AmbientOcclusionMode> {}
public sealed class AmbientOcclusionModeParameter : ParameterOverride<AmbientOcclusionMode> { }

/// <summary>
/// A volume parameter holding a <see cref="AmbientOcclusionQuality"/> value.
/// </summary>
[Serializable]
public sealed class AmbientOcclusionQualityParameter : ParameterOverride<AmbientOcclusionQuality> {}
public sealed class AmbientOcclusionQualityParameter : ParameterOverride<AmbientOcclusionQuality> { }

/// <summary>
/// This class holds settings for the Ambient Occlusion effect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum EyeAdaptation
/// A volume parameter holding a <see cref="EyeAdaptation"/> value.
/// </summary>
[Serializable]
public sealed class EyeAdaptationParameter : ParameterOverride<EyeAdaptation> {}
public sealed class EyeAdaptationParameter : ParameterOverride<EyeAdaptation> { }

/// <summary>
/// This class holds settings for the Auto Exposure effect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public override void Render(PostProcessRenderContext context)
// Negative anamorphic ratio values distort vertically - positive is horizontal
float ratio = Mathf.Clamp(settings.anamorphicRatio, -1, 1);
float rw = ratio < 0 ? -ratio : 0f;
float rh = ratio > 0 ? ratio : 0f;
float rh = ratio > 0 ? ratio : 0f;

// Do bloom on a half-res buffer, full-res doesn't bring much and kills performances on
// fillrate limited platforms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public enum Tonemapper
/// A volume parameter holding a <see cref="GradingMode"/> value.
/// </summary>
[Serializable]
public sealed class GradingModeParameter : ParameterOverride<GradingMode> {}
public sealed class GradingModeParameter : ParameterOverride<GradingMode> { }

/// <summary>
/// A volume parameter holding a <see cref="Tonemapper"/> value.
/// </summary>
[Serializable]
public sealed class TonemapperParameter : ParameterOverride<Tonemapper> {}
public sealed class TonemapperParameter : ParameterOverride<Tonemapper> { }

/// <summary>
/// This class holds settings for the Color Grading effect.
Expand Down Expand Up @@ -328,31 +328,31 @@ public sealed class ColorGrading : PostProcessEffectSettings
/// <remarks>
/// This is only used when working with <see cref="GradingMode.LowDefinitionRange"/>.
/// </remarks>
public SplineParameter masterCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };
public SplineParameter masterCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };

/// <summary>
/// Remaps the red channel.
/// </summary>
/// <remarks>
/// This is only used when working with <see cref="GradingMode.LowDefinitionRange"/>.
/// </remarks>
public SplineParameter redCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };
public SplineParameter redCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };

/// <summary>
/// Remaps the green channel/
/// </summary>
/// <remarks>
/// This is only used when working with <see cref="GradingMode.LowDefinitionRange"/>.
/// </remarks>
public SplineParameter greenCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };
public SplineParameter greenCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };

/// <summary>
/// Remaps the blue channel.
/// </summary>
/// <remarks>
/// This is only used when working with <see cref="GradingMode.LowDefinitionRange"/>.
/// </remarks>
public SplineParameter blueCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };
public SplineParameter blueCurve = new SplineParameter { value = new Spline(new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f)), 0f, false, new Vector2(0f, 1f)) };

/// <summary>
/// Remaps the hue according to the current hue.
Expand Down Expand Up @@ -467,13 +467,17 @@ void RenderHDRPipeline3D(PostProcessRenderContext context)

switch (settings.tonemapper.value)
{
case Tonemapper.None: kernel = compute.FindKernel("KGenLut3D_NoTonemap");
case Tonemapper.None:
kernel = compute.FindKernel("KGenLut3D_NoTonemap");
break;
case Tonemapper.Neutral: kernel = compute.FindKernel("KGenLut3D_NeutralTonemap");
case Tonemapper.Neutral:
kernel = compute.FindKernel("KGenLut3D_NeutralTonemap");
break;
case Tonemapper.ACES: kernel = compute.FindKernel("KGenLut3D_AcesTonemap");
case Tonemapper.ACES:
kernel = compute.FindKernel("KGenLut3D_AcesTonemap");
break;
case Tonemapper.Custom: kernel = compute.FindKernel("KGenLut3D_CustomTonemap");
case Tonemapper.Custom:
kernel = compute.FindKernel("KGenLut3D_CustomTonemap");
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum KernelSize
/// A volume parameter holding a <see cref="KernelSize"/> value.
/// </summary>
[Serializable]
public sealed class KernelSizeParameter : ParameterOverride<KernelSize> {}
public sealed class KernelSizeParameter : ParameterOverride<KernelSize> { }

/// <summary>
/// This class holds settings for the Depth of Field effect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ internal void Render(PostProcessRenderContext context)
var blueNoise = context.resources.blueNoise64;
Assert.IsTrue(blueNoise != null && blueNoise.Length > 0);

#if POSTFX_DEBUG_STATIC_DITHERING // Used by QA for automated testing
#if POSTFX_DEBUG_STATIC_DITHERING // Used by QA for automated testing
m_NoiseTextureIndex = 0;
float rndOffsetX = 0f;
float rndOffsetY = 0f;
#else
#else
if (++m_NoiseTextureIndex >= blueNoise.Length)
m_NoiseTextureIndex = 0;

float rndOffsetX = (float)m_Random.NextDouble();
float rndOffsetY = (float)m_Random.NextDouble();
#endif
#endif

var noiseTex = blueNoise[m_NoiseTextureIndex];
var uberSheet = context.uberSheet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
}

#if POSTFX_DEBUG_STATIC_GRAIN
#pragma warning disable 414
#pragma warning disable 414
#endif
[UnityEngine.Scripting.Preserve]
internal sealed class GrainRenderer : PostProcessEffectRenderer<Grain>
Expand Down Expand Up @@ -122,6 +122,6 @@ public override void Release()
}

#if POSTFX_DEBUG_STATIC_GRAIN
#pragma warning restore 414
#pragma warning restore 414
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
{
return enabled.value
&& shutterAngle.value > 0f
#if UNITY_EDITOR
#if UNITY_EDITOR
// Don't render motion blur preview when the editor is not playing as it can in some
// cases results in ugly artifacts (i.e. when resizing the game view).
&& Application.isPlaying
#endif
#endif
&& SystemInfo.supportsMotionVectors
&& RenderTextureFormat.RGHalf.IsSupported()
&& !context.stereoActive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void GenerateAOMap(CommandBuffer cmd, Camera camera, RenderTargetIdentifi
for (int i = 1; i < 7; i++)
{
int div = 1 << i;
m_ScaledWidths[i] = (m_ScaledWidths[0] + (div - 1)) / div;
m_ScaledWidths[i] = (m_ScaledWidths[0] + (div - 1)) / div;
m_ScaledHeights[i] = (m_ScaledHeights[0] + (div - 1)) / div;
}

Expand All @@ -180,10 +180,10 @@ public void GenerateAOMap(CommandBuffer cmd, Camera camera, RenderTargetIdentifi
PushRenderCommands(cmd, ShaderIDs.TiledDepth3, ShaderIDs.Occlusion3, GetSizeArray(MipLevel.L5), tanHalfFovH, isMSAA);
PushRenderCommands(cmd, ShaderIDs.TiledDepth4, ShaderIDs.Occlusion4, GetSizeArray(MipLevel.L6), tanHalfFovH, isMSAA);

PushUpsampleCommands(cmd, ShaderIDs.LowDepth4, ShaderIDs.Occlusion4, ShaderIDs.LowDepth3, ShaderIDs.Occlusion3, ShaderIDs.Combined3, GetSize(MipLevel.L4), GetSize(MipLevel.L3), isMSAA);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth3, ShaderIDs.Combined3, ShaderIDs.LowDepth2, ShaderIDs.Occlusion2, ShaderIDs.Combined2, GetSize(MipLevel.L3), GetSize(MipLevel.L2), isMSAA);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth2, ShaderIDs.Combined2, ShaderIDs.LowDepth1, ShaderIDs.Occlusion1, ShaderIDs.Combined1, GetSize(MipLevel.L2), GetSize(MipLevel.L1), isMSAA);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth1, ShaderIDs.Combined1, ShaderIDs.LinearDepth, null, destination, GetSize(MipLevel.L1), GetSize(MipLevel.Original), isMSAA, invert);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth4, ShaderIDs.Occlusion4, ShaderIDs.LowDepth3, ShaderIDs.Occlusion3, ShaderIDs.Combined3, GetSize(MipLevel.L4), GetSize(MipLevel.L3), isMSAA);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth3, ShaderIDs.Combined3, ShaderIDs.LowDepth2, ShaderIDs.Occlusion2, ShaderIDs.Combined2, GetSize(MipLevel.L3), GetSize(MipLevel.L2), isMSAA);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth2, ShaderIDs.Combined2, ShaderIDs.LowDepth1, ShaderIDs.Occlusion1, ShaderIDs.Combined1, GetSize(MipLevel.L2), GetSize(MipLevel.L1), isMSAA);
PushUpsampleCommands(cmd, ShaderIDs.LowDepth1, ShaderIDs.Combined1, ShaderIDs.LinearDepth, null, destination, GetSize(MipLevel.L1), GetSize(MipLevel.Original), isMSAA, invert);

// Cleanup
PushReleaseCommands(cmd);
Expand Down
Loading