Skip to content

Hdrp - Fix volumetric fog presets #2062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 27, 2020
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
active: 1
m_AdvancedMode: 1
quality:
m_OverrideState: 1
m_Value: 3
enabled:
m_OverrideState: 1
m_Value: 1
Expand Down Expand Up @@ -113,7 +116,7 @@ MonoBehaviour:
m_Value: 0.75
min: 0
max: 1
fogControlMode:
m_FogControlMode:
m_OverrideState: 1
m_Value: 1
screenResolutionPercentage:
Expand All @@ -126,12 +129,12 @@ MonoBehaviour:
m_Value: 128
min: 1
max: 1024
volumetricFogBudget:
m_VolumetricFogBudget:
m_OverrideState: 0
m_Value: 0.25
min: 0
max: 1
resolutionDepthRatio:
m_ResolutionDepthRatio:
m_OverrideState: 0
m_Value: 0.5
min: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
active: 1
m_AdvancedMode: 1
quality:
m_OverrideState: 1
m_Value: 3
enabled:
m_OverrideState: 1
m_Value: 1
Expand Down Expand Up @@ -90,7 +93,7 @@ MonoBehaviour:
m_Value: 0.75
min: 0
max: 1
fogControlMode:
m_FogControlMode:
m_OverrideState: 1
m_Value: 1
screenResolutionPercentage:
Expand All @@ -103,12 +106,12 @@ MonoBehaviour:
m_Value: 128
min: 1
max: 1024
volumetricFogBudget:
m_VolumetricFogBudget:
m_OverrideState: 0
m_Value: 0.25
min: 0
max: 1
resolutionDepthRatio:
m_ResolutionDepthRatio:
m_OverrideState: 0
m_Value: 0.5
min: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
active: 1
m_AdvancedMode: 1
quality:
m_OverrideState: 1
m_Value: 3
enabled:
m_OverrideState: 1
m_Value: 1
Expand Down Expand Up @@ -283,7 +286,7 @@ MonoBehaviour:
m_Value: 0.75
min: 0
max: 1
fogControlMode:
m_FogControlMode:
m_OverrideState: 1
m_Value: 1
screenResolutionPercentage:
Expand All @@ -296,12 +299,12 @@ MonoBehaviour:
m_Value: 128
min: 1
max: 1024
volumetricFogBudget:
m_VolumetricFogBudget:
m_OverrideState: 0
m_Value: 0.25
min: 0
max: 1
resolutionDepthRatio:
m_ResolutionDepthRatio:
m_OverrideState: 0
m_Value: 0.5
min: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
active: 1
m_AdvancedMode: 1
quality:
m_OverrideState: 1
m_Value: 3
enabled:
m_OverrideState: 1
m_Value: 1
Expand Down Expand Up @@ -90,7 +93,7 @@ MonoBehaviour:
m_Value: 0.75
min: 0
max: 1
fogControlMode:
m_FogControlMode:
m_OverrideState: 1
m_Value: 1
screenResolutionPercentage:
Expand All @@ -103,12 +106,12 @@ MonoBehaviour:
m_Value: 128
min: 1
max: 1024
volumetricFogBudget:
m_VolumetricFogBudget:
m_OverrideState: 0
m_Value: 0.25
min: 0
max: 1
resolutionDepthRatio:
m_ResolutionDepthRatio:
m_OverrideState: 0
m_Value: 0.5
min: 0
Expand Down
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The version number for this package has increased due to a version update of a r
- Adding an "Include For Ray Tracing" toggle on lights to allow the user to exclude them when ray tracing is enabled in the frame settings of a camera.
- Added fog volumetric scattering support for path tracing.
- Added new algorithm for SSR with temporal accumulation
- Added quality preset of the new volumetric fog parameters.

### Fixed
- Fixed an issue where the Exposure Shader Graph node had clipped text. (case 1265057)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public class GeneralSection
public static readonly GUIContent SSRSettingsSubTitle = EditorGUIUtility.TrTextContent("Screen Space Reflection");
public static readonly GUIContent SSRMaxRaySteps = EditorGUIUtility.TrTextContent("Max Ray Steps");

public static readonly GUIContent FogSettingsSubTitle = EditorGUIUtility.TrTextContent("Volumetric Fog");
public static readonly GUIContent FogSettingsBudget = EditorGUIUtility.TrTextContent("Volumetric Fog Budget");
public static readonly GUIContent FogSettingsRatio = EditorGUIUtility.TrTextContent("Volumetric Fog Ratio");

public static readonly GUIContent defaultFrameSettingsContent = EditorGUIUtility.TrTextContent("Default Frame Settings For");

public static readonly GUIContent materialQualityLevelContent = EditorGUIUtility.TrTextContent("Default Material Quality Level", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum Expandable
LightingQuality = 1 << 25,
SSRQuality = 1 << 26,
VirtualTexturing = 1 << 27,
FogQuality = 1 << 28
}

static readonly ExpandedState<Expandable, HDRenderPipelineAsset> k_ExpandedState = new ExpandedState<Expandable, HDRenderPipelineAsset>(Expandable.CameraFrameSettings | Expandable.General, "HDRP");
Expand Down Expand Up @@ -88,7 +89,8 @@ static HDRenderPipelineUI()
CED.FoldoutGroup(Styles.lightingQualitySettings, Expandable.LightingQuality, k_ExpandedState,
CED.FoldoutGroup(Styles.SSAOQualitySettingSubTitle, Expandable.SSAOQuality, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout | FoldoutOption.NoSpaceAtEnd, Drawer_SectionSSAOQualitySettings),
CED.FoldoutGroup(Styles.contactShadowsSettingsSubTitle, Expandable.ContactShadowQuality, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout | FoldoutOption.NoSpaceAtEnd, Drawer_SectionContactShadowQualitySettings),
CED.FoldoutGroup(Styles.SSRSettingsSubTitle, Expandable.SSRQuality, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout | FoldoutOption.NoSpaceAtEnd, Drawer_SectionSSRQualitySettings)
CED.FoldoutGroup(Styles.SSRSettingsSubTitle, Expandable.SSRQuality, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout | FoldoutOption.NoSpaceAtEnd, Drawer_SectionSSRQualitySettings),
CED.FoldoutGroup(Styles.FogSettingsSubTitle, Expandable.FogQuality, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout | FoldoutOption.NoSpaceAtEnd, Drawer_SectionFogQualitySettings)
),
CED.FoldoutGroup(Styles.materialSectionTitle, Expandable.Material, k_ExpandedState, Drawer_SectionMaterialUnsorted),
CED.FoldoutGroup(Styles.postProcessSectionTitle, Expandable.PostProcess, k_ExpandedState, Drawer_SectionPostProcessSettings),
Expand Down Expand Up @@ -860,6 +862,53 @@ static void Drawer_SectionSSRQualitySettings(SerializedHDRenderPipelineAsset ser
}
}

static private bool m_ShowFogLowQualitySection = false;
static private bool m_ShowFogMediumQualitySection = false;
static private bool m_ShowFogHighQualitySection = false;

static void Drawer_SectionFogQualitySettings(SerializedHDRenderPipelineAsset serialized, Editor owner)
{
m_ShowFogLowQualitySection = EditorGUILayout.Foldout(m_ShowFogLowQualitySection, Styles.lowQualityContent);
CheckFoldoutClick(GUILayoutUtility.GetLastRect(), ref m_ShowFogLowQualitySection);
if (m_ShowFogLowQualitySection)
{
int quality = (int)ScalableSettingLevelParameter.Level.Low;
var budget = serialized.renderPipelineSettings.lightingQualitySettings.VolumetricFogBudget.GetArrayElementAtIndex(quality);
EditorGUILayout.PropertyField(budget, Styles.FogSettingsBudget);
budget.floatValue = Mathf.Clamp(budget.floatValue, 0.0f, 1.0f);
var ratio = serialized.renderPipelineSettings.lightingQualitySettings.VolumetricFogRatio.GetArrayElementAtIndex(quality);
EditorGUILayout.PropertyField(ratio, Styles.FogSettingsRatio);
ratio.floatValue = Mathf.Clamp(ratio.floatValue, 0.0f, 1.0f);
}

m_ShowFogMediumQualitySection = EditorGUILayout.Foldout(m_ShowFogMediumQualitySection, Styles.mediumQualityContent);
CheckFoldoutClick(GUILayoutUtility.GetLastRect(), ref m_ShowFogMediumQualitySection);
if (m_ShowFogMediumQualitySection)
{
int quality = (int)ScalableSettingLevelParameter.Level.Medium;
var budget = serialized.renderPipelineSettings.lightingQualitySettings.VolumetricFogBudget.GetArrayElementAtIndex(quality);
EditorGUILayout.PropertyField(budget, Styles.FogSettingsBudget);
budget.floatValue = Mathf.Clamp(budget.floatValue, 0.0f, 1.0f);
var ratio = serialized.renderPipelineSettings.lightingQualitySettings.VolumetricFogRatio.GetArrayElementAtIndex(quality);
EditorGUILayout.PropertyField(ratio, Styles.FogSettingsRatio);
ratio.floatValue = Mathf.Clamp(ratio.floatValue, 0.0f, 1.0f);
}

m_ShowFogHighQualitySection = EditorGUILayout.Foldout(m_ShowFogHighQualitySection, Styles.highQualityContent);
CheckFoldoutClick(GUILayoutUtility.GetLastRect(), ref m_ShowFogHighQualitySection);
if (m_ShowFogHighQualitySection)
{
int quality = (int)ScalableSettingLevelParameter.Level.High;
var budget = serialized.renderPipelineSettings.lightingQualitySettings.VolumetricFogBudget.GetArrayElementAtIndex(quality);
EditorGUILayout.PropertyField(budget, Styles.FogSettingsBudget);
budget.floatValue = Mathf.Clamp(budget.floatValue, 0.0f, 1.0f);
var ratio = serialized.renderPipelineSettings.lightingQualitySettings.VolumetricFogRatio.GetArrayElementAtIndex(quality);
EditorGUILayout.PropertyField(ratio, Styles.FogSettingsRatio);
ratio.floatValue = Mathf.Clamp(ratio.floatValue, 0.0f, 1.0f);
}
}


static void Drawer_SectionRenderingUnsorted(SerializedHDRenderPipelineAsset serialized, Editor owner)
{
EditorGUILayout.PropertyField(serialized.renderPipelineSettings.colorBufferFormat, Styles.colorBufferFormatContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class SerializedLightingQualitySettings
// SSR
public SerializedProperty SSRMaxRaySteps;

// Fog
public SerializedProperty VolumetricFogBudget;
public SerializedProperty VolumetricFogRatio;

public SerializedLightingQualitySettings(SerializedProperty root)
{
this.root = root;
Expand All @@ -36,6 +40,10 @@ public SerializedLightingQualitySettings(SerializedProperty root)

// SSR
SSRMaxRaySteps = root.Find((GlobalLightingQualitySettings s) => s.SSRMaxRaySteps);

// Fog
VolumetricFogBudget = root.Find((GlobalLightingQualitySettings s) => s.Fog_Budget);
VolumetricFogRatio = root.Find((GlobalLightingQualitySettings s) => s.Fog_DepthRatio);
}
}
}
Loading