Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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 @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added remapping options for Depth Pyramid debug view mode
- Added an option to support AOV shader at runtime in HDRP settings (case 1265070)
- Added support of SSGI in the render graph mode.
- Added Simple mode to Earth Preset for PBR Sky

### Fixed
- Fixed several issues with physically-based DoF (TAA ghosting of the CoC buffer, smooth layer transitions, etc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ To change how much the atmosphere attenuates light, you can change the density o

[!include[](snippets/Volume-Override-Enable-Properties.md)]

### Model

| **Property** | **Description** |
| ------------------------------ | ------------------------------------------------------- |
| **Type** | Indicates a preset HDRP uses to simplify the Inspector. Selecting Earth will only show properties suitable to simulate Earth. |

### Planet

| **Property** | **Description** |
| ------------------------------ | ------------------------------------------------------------ |
| **Earth Preset** | Indicates whether HDRP should simplify the Inspector and only show properties suitable to simulate Earth. |
| **Spherical Mode** | Enables **Spherical Mode**. When in Spherical Mode, you can specify the location of the planet. Otherwise, the planet is always below the Camera in the world-space x-z plane. |
| **Planetary Radius** | The radius of the planet in meters. The radius is the distance from the center of the planet to the sea level. Only available in **Spherical Mode**. |
| **Planet Center Position** | The world-space position of the planet's center in meters. This does not affect the precomputation. Only available in **Spherical Mode**. |
Expand All @@ -50,6 +55,8 @@ To change how much the atmosphere attenuates light, you can change the density o

### Space

To make this section visible, set **Type** to **Earth (Advanced)** or **Custom Planet**.

| **Property** | **Description** |
| ----------------------------- | ------------------------------------------------------------ |
| **Space Rotation** | The orientation of space. |
Expand All @@ -58,7 +65,7 @@ To change how much the atmosphere attenuates light, you can change the density o

### Air

To make this section visible, disable **Earth Preset**.
To make this section visible, set **Type** to **Custom Planet**.

| **Property** | **Description** |
| ------------------------ | ------------------------------------------------------------ |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

namespace UnityEditor.Rendering.HighDefinition
Expand All @@ -7,7 +8,7 @@ namespace UnityEditor.Rendering.HighDefinition
[VolumeComponentEditor(typeof(PhysicallyBasedSky))]
class PhysicallyBasedSkyEditor : SkySettingsEditor
{
SerializedDataParameter m_EarthPreset;
SerializedDataParameter m_Type;
SerializedDataParameter m_SphericalMode;
SerializedDataParameter m_SeaLevel;
SerializedDataParameter m_PlanetaryRadius;
Expand Down Expand Up @@ -42,6 +43,11 @@ class PhysicallyBasedSkyEditor : SkySettingsEditor

SerializedDataParameter m_NumberOfBounces;

GUIContent m_ModelTypeLabel = new GUIContent("Type", "Specifies a preset to simplify the interface.");

GUIContent[] m_ModelTypes = { new GUIContent("Earth (Simple)"), new GUIContent("Earth (Advanced)"), new GUIContent("Custom Planet") };
int[] m_ModelTypeValues = { (int)PhysicallyBasedSkyModel.EarthSimple, (int)PhysicallyBasedSkyModel.EarthAdvanced, (int)PhysicallyBasedSkyModel.Custom };

public override void OnEnable()
{
base.OnEnable();
Expand All @@ -52,7 +58,7 @@ public override void OnEnable()

var o = new PropertyFetcher<PhysicallyBasedSky>(serializedObject);

m_EarthPreset = Unpack(o.Find(x => x.earthPreset));
m_Type = Unpack(o.Find(x => x.type));
m_SphericalMode = Unpack(o.Find(x => x.sphericalMode));
m_SeaLevel = Unpack(o.Find(x => x.seaLevel));
m_PlanetaryRadius = Unpack(o.Find(x => x.planetaryRadius));
Expand Down Expand Up @@ -90,50 +96,82 @@ public override void OnEnable()

public override void OnInspectorGUI()
{
EditorGUILayout.LabelField("Model");

using (new EditorGUILayout.HorizontalScope())
{
DrawOverrideCheckbox(m_Type);

using (new EditorGUI.DisabledScope(!m_Type.overrideState.boolValue))
{
m_Type.value.intValue = EditorGUILayout.IntPopup(m_ModelTypeLabel, m_Type.value.intValue, m_ModelTypes, m_ModelTypeValues);
}
}

PhysicallyBasedSkyModel type = (PhysicallyBasedSkyModel)m_Type.value.intValue;

EditorGUILayout.Space();
EditorGUILayout.LabelField("Planet");
PropertyField(m_EarthPreset);
bool isEarth = !m_EarthPreset.overrideState.boolValue || m_EarthPreset.value.boolValue;
if (!isEarth)

if (type == PhysicallyBasedSkyModel.EarthSimple)
PropertyField(m_SeaLevel);
else
{
PropertyField(m_PlanetaryRadius);
PropertyField(m_SphericalMode);
EditorGUI.indentLevel++;
bool isSpherical = !m_SphericalMode.overrideState.boolValue || m_SphericalMode.value.boolValue;
if (isSpherical)
{
PropertyField(m_PlanetCenterPosition);
if (type == PhysicallyBasedSkyModel.Custom)
PropertyField(m_PlanetaryRadius);
}
else
PropertyField(m_SeaLevel);
EditorGUI.indentLevel--;

PropertyField(m_PlanetRotation);
PropertyField(m_GroundColorTexture);
}

PropertyField(m_SphericalMode);
bool isSpherical = !m_SphericalMode.overrideState.boolValue || m_SphericalMode.value.boolValue;
if (isSpherical)
PropertyField(m_GroundTint);
if (type != PhysicallyBasedSkyModel.EarthSimple)
{
PropertyField(m_PlanetCenterPosition);
PropertyField(m_GroundEmissionTexture);
PropertyField(m_GroundEmissionMultiplier);
}
else

if (type != PhysicallyBasedSkyModel.EarthSimple)
{
PropertyField(m_SeaLevel);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Space");
PropertyField(m_SpaceRotation);
PropertyField(m_SpaceEmissionTexture);
PropertyField(m_SpaceEmissionMultiplier);
}

PropertyField(m_PlanetRotation);
PropertyField(m_GroundColorTexture);
PropertyField(m_GroundTint);
PropertyField(m_GroundEmissionTexture);
PropertyField(m_GroundEmissionMultiplier);

EditorGUILayout.LabelField("Space");
PropertyField(m_SpaceRotation);
PropertyField(m_SpaceEmissionTexture);
PropertyField(m_SpaceEmissionMultiplier);
if (!isEarth)
if (type == PhysicallyBasedSkyModel.Custom)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Air");
PropertyField(m_AirMaximumAltitude);
PropertyField(m_AirDensityR);
PropertyField(m_AirDensityG);
PropertyField(m_AirDensityB);
PropertyField(m_AirTint);
}

EditorGUILayout.Space();
EditorGUILayout.LabelField("Aerosols");
PropertyField(m_AerosolMaximumAltitude);
PropertyField(m_AerosolDensity);
PropertyField(m_AerosolTint);
PropertyField(m_AerosolAnisotropy);
PropertyField(m_AerosolTint);
if (type != PhysicallyBasedSkyModel.EarthSimple)
{
PropertyField(m_AerosolAnisotropy);
PropertyField(m_AerosolMaximumAltitude);
}

EditorGUILayout.Space();
EditorGUILayout.LabelField("Artistic Overrides");
PropertyField(m_ColorSaturation);
PropertyField(m_AlphaSaturation);
Expand All @@ -142,6 +180,7 @@ public override void OnInspectorGUI()
PropertyField(m_HorizonZenithShift);
PropertyField(m_ZenithTint);

EditorGUILayout.Space();
EditorGUILayout.LabelField("Miscellaneous");
PropertyField(m_NumberOfBounces);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using UnityEngine.Serialization;

namespace UnityEngine.Rendering.HighDefinition
{
public partial class PhysicallyBasedSky : IVersionable<PhysicallyBasedSky.Version>
{
/// <summary>
/// The version used during the migration
/// </summary>
protected enum Version
{
/// <summary>Version Step</summary>
Initial,
/// <summary>Version Step</summary>
TypeEnum,
}

/// <summary>
/// The migration steps for PhysicallyBasedSky
/// </summary>
protected static readonly MigrationDescription<Version, PhysicallyBasedSky> k_Migration = MigrationDescription.New(
MigrationStep.New(Version.TypeEnum, (PhysicallyBasedSky p) =>
{
#pragma warning disable 618 // Type or member is obsolete
p.type.value = p.m_ObsoleteEarthPreset.value ? PhysicallyBasedSkyModel.EarthAdvanced : PhysicallyBasedSkyModel.Custom;
p.type.overrideState = p.m_ObsoleteEarthPreset.overrideState;
#pragma warning restore 618
})
);

void Awake()
{
k_Migration.Migrate(this);
}

[SerializeField]
Version m_SkyVersion;
Version IVersionable<Version>.version { get => m_SkyVersion; set => m_SkyVersion = value; }

/// <summary>Obsolete field. Simplifies the interface by using parameters suitable to simulate Earth.</summary>
[SerializeField, FormerlySerializedAs("earthPreset"), Obsolete("For Data Migration")]
BoolParameter m_ObsoleteEarthPreset = new BoolParameter(true);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading