Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 84de82e

Browse files
committed
Merge remote-tracking branch 'refs/remotes/Unity-Technologies/master'
2 parents 2649ebe + d810da5 commit 84de82e

File tree

4 files changed

+9
-65
lines changed

4 files changed

+9
-65
lines changed

PostProcessing/Editor/Models/FogModelEditor.cs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,23 @@
1-
using UnityEngine;
21
using UnityEngine.PostProcessing;
32

43
namespace UnityEditor.PostProcessing
54
{
65
using Settings = FogModel.Settings;
76

8-
[PostProcessingModelEditor(typeof(FogModel))]
7+
[PostProcessingModelEditor(typeof(FogModel), alwaysEnabled: true)]
98
public class FogModelEditor : PostProcessingModelEditor
109
{
11-
SerializedProperty m_Color;
12-
SerializedProperty m_Mode;
13-
SerializedProperty m_Density;
14-
SerializedProperty m_Start;
15-
SerializedProperty m_End;
1610
SerializedProperty m_ExcludeSkybox;
1711

1812
public override void OnEnable()
1913
{
20-
m_Color = FindSetting((Settings x) => x.color);
21-
m_Mode = FindSetting((Settings x) => x.mode);
22-
m_Density = FindSetting((Settings x) => x.density);
23-
m_Start = FindSetting((Settings x) => x.start);
24-
m_End = FindSetting((Settings x) => x.end);
2514
m_ExcludeSkybox = FindSetting((Settings x) => x.excludeSkybox);
2615
}
2716

2817
public override void OnInspectorGUI()
2918
{
30-
EditorGUILayout.PropertyField(m_Color);
31-
EditorGUILayout.PropertyField(m_ExcludeSkybox);
32-
EditorGUILayout.PropertyField(m_Mode);
33-
34-
EditorGUI.indentLevel++;
35-
if (m_Mode.intValue == (int)FogMode.Linear)
36-
{
37-
EditorGUILayout.PropertyField(m_Start);
38-
EditorGUILayout.PropertyField(m_End);
39-
}
40-
else
41-
{
42-
EditorGUILayout.PropertyField(m_Density);
43-
}
19+
EditorGUILayout.HelpBox("This effect adds fog compatibility to the deferred rendering path; actual fog settings should be set in the Lighting panel.", MessageType.Info);
20+
EditorGUILayout.PropertyField(m_ExcludeSkybox, EditorGUIHelper.GetContent("Exclude Skybox (deferred only)"));
4421
EditorGUI.indentLevel--;
4522
}
4623
}

PostProcessing/Runtime/Components/FogComponent.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,18 @@ public override CameraEvent GetCameraEvent()
4141
return CameraEvent.BeforeImageEffectsOpaque;
4242
}
4343

44-
public override void Init(PostProcessingContext pcontext, FogModel pmodel)
45-
{
46-
base.Init(pcontext, pmodel);
47-
48-
var settings = model.settings;
49-
RenderSettings.fog = model.enabled;
50-
RenderSettings.fogColor = settings.color;
51-
RenderSettings.fogMode = settings.mode;
52-
RenderSettings.fogDensity = settings.density;
53-
RenderSettings.fogStartDistance = settings.start;
54-
RenderSettings.fogEndDistance = settings.end;
55-
}
56-
5744
public override void PopulateCommandBuffer(CommandBuffer cb)
5845
{
5946
var settings = model.settings;
6047

6148
var material = context.materialFactory.Get(k_ShaderString);
6249
material.shaderKeywords = null;
63-
material.SetColor(Uniforms._FogColor, settings.color);
64-
material.SetFloat(Uniforms._Density, settings.density);
65-
material.SetFloat(Uniforms._Start, settings.start);
66-
material.SetFloat(Uniforms._End, settings.end);
50+
material.SetColor(Uniforms._FogColor, RenderSettings.fogColor);
51+
material.SetFloat(Uniforms._Density, RenderSettings.fogDensity);
52+
material.SetFloat(Uniforms._Start, RenderSettings.fogStartDistance);
53+
material.SetFloat(Uniforms._End, RenderSettings.fogEndDistance);
6754

68-
switch (settings.mode)
55+
switch (RenderSettings.fogMode)
6956
{
7057
case FogMode.Linear:
7158
material.EnableKeyword("FOG_LINEAR");

PostProcessing/Runtime/Models/FogModel.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ public class FogModel : PostProcessingModel
88
[Serializable]
99
public struct Settings
1010
{
11-
[Tooltip("Controls the color of that fog drawn in the scene.")]
12-
public Color color;
13-
14-
[Tooltip("Controls the mathematical function determining the way fog accumulates with distance from the camera. Options are Linear, Exponential and Exponential Squared.")]
15-
public FogMode mode;
16-
17-
[Tooltip("Controls the density of the fog effect in the Scene when using Exponential or Exponential Squared modes.")]
18-
public float density;
19-
20-
[Tooltip("Controls the distance from the camera where the fog will start in the scene.")]
21-
public float start;
22-
23-
[Tooltip("Controls the distance from the camera where the fog will completely obscure objects in the Scene.")]
24-
public float end;
25-
2611
[Tooltip("Should the fog affect the skybox?")]
2712
public bool excludeSkybox;
2813

@@ -32,11 +17,6 @@ public static Settings defaultSettings
3217
{
3318
return new Settings
3419
{
35-
color = new Color32(102, 108, 113, 154),
36-
mode = FogMode.Exponential,
37-
density = 0.001f,
38-
start = 0f,
39-
end = 600f,
4020
excludeSkybox = true
4121
};
4222
}

PostProcessing/Runtime/PostProcessingProfile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public class PostProcessingProfile : ScriptableObject
77
#pragma warning disable 0169 // "field x is never used"
88

99
public BuiltinDebugViewsModel debugViews = new BuiltinDebugViewsModel();
10+
public FogModel fog = new FogModel();
1011
public AntialiasingModel antialiasing = new AntialiasingModel();
1112
public AmbientOcclusionModel ambientOcclusion = new AmbientOcclusionModel();
1213
public ScreenSpaceReflectionModel screenSpaceReflection = new ScreenSpaceReflectionModel();
13-
public FogModel fog = new FogModel();
1414
public DepthOfFieldModel depthOfField = new DepthOfFieldModel();
1515
public MotionBlurModel motionBlur = new MotionBlurModel();
1616
public EyeAdaptationModel eyeAdaptation = new EyeAdaptationModel();

0 commit comments

Comments
 (0)