Skip to content

Commit 30a5988

Browse files
remi-chapelainEvergreen
authored andcommitted
[HDRP] Adding Environment samples
This sample puts multiple environment effects together in the same scene with different lighting conditions. ![image](https://media.github.cds.internal.unity3d.com/user/1764/files/81df0ebe-0d07-4e4a-851f-83797b2c12b4) The scene includes examples focusing on the following effects: - Volumetric Clouds: Demonstrates simple, advanced and manual mode. - Lens Flare: How to update SRP Lens Flares data at runtime. - Night Sky: How to add stars and northern lights. - Time Of Day: Full 24h cycle with sun, moon and proper shadow map swapping. More information on this on the Sample showcase inside the sample. This PR changes slightly the behavior of atmospheric scattering, it now takes shadow map into account. When making the PR, we realized it would be nice to take into account to wrap mode of the cloud texture (to clamp instead of automatic repeat some advanced or manual cloud map for example). We'll see if we have time to do it in this PR. Docs has also been updated to exaplain visually what is a cloud LUT and cloud map in manual mode. ![image](https://media.github.cds.internal.unity3d.com/user/1764/files/8d4af8fb-e07c-49a6-b3be-4ad0a9d5cd7c) ![image](https://media.github.cds.internal.unity3d.com/user/1764/files/d9bbbeae-d625-4e38-8576-5760e1074254) In an ideal world it would have been nice to include a snippet to update cascade of dir light at different intervals but a bug was found ([UUM-72086](https://jira.unity3d.com/browse/UUM-72086)) when including it and we need to wait until it's fixed before including it.
1 parent e87fa93 commit 30a5988

File tree

122 files changed

+28389
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+28389
-40
lines changed

Packages/com.unity.render-pipelines.core/Samples~/Common/Scripts/Editor/SamplesShowcaseEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public class SamplesShowcaseEditor : Editor
1717
{
1818
private static readonly string UXMLPath = "SamplesSelectionUXML";
19-
public static readonly string[] supportedExtensions = {".shadergraph", ".vfx", ".cs", ".hlsl", ".shader", ".asset",".mat",".fbx",".prefab"};
19+
public static readonly string[] supportedExtensions = {".shadergraph", ".vfx", ".cs", ".hlsl", ".shader", ".asset",".mat",".fbx",".prefab", ".png"};
2020

2121
SerializedProperty currentIndex;
2222
Color headlineColor;

Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,15 @@ The Water samples contain the following scenes you can use to learn about HDRP's
8282
- Glacier: Demonstrates current, water deformers, floating objects, and a water mask.
8383
- Island: Demonstrates waves, foam, and the water excluder.
8484
- Rain: Demonstrates how to add pertubations to the normals using shader graph.
85-
- Waterline: Demonstrates how to override rendering of the waterline using a [Custom Pass](Custom-Pass.md).
85+
- Waterline: Demonstrates how to override rendering of the waterline using a [Custom Pass](Custom-Pass.md).
86+
87+
## Environment samples
88+
89+
![](Images/environment-samples.png)
90+
91+
This sample puts multiple environment effects together in the same scene with different lighting conditions.
92+
The scene includes examples focusing on the following effects:
93+
- Volumetric Clouds: Demonstrates simple, advanced and manual mode.
94+
- Lens Flare: How to update SRP Lens Flares data at runtime.
95+
- Night Sky: How to add stars and northern lights.
96+
- Time Of Day: Full 24h cycle with sun, moon and proper shadow map swapping.
6.36 KB
Loading
85.6 KB
Loading
194 KB
Loading

Packages/com.unity.render-pipelines.high-definition/Documentation~/volumetric-clouds-volume-override-reference.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Refer to [Create realistic clouds (volumetric clouds)](create-realistic-clouds-v
3131
| - **Cloud Map Resolution** | Specifies the resolution for the internal Texture HDRP uses for the cloud map. A lower resolution produces better performance, but less precise cloud type transitions. <br/><br/>This property only appears if you set **Cloud Control** to **Advanced**. |
3232
| - **Cloud Map** | Specifies the cloud map to use for the volumetric clouds. For information on the format of this Texture, see [Cloud map and cloud lookup table](#cloud-map-and-cloud-lookup-table). <br/><br/>This property only appears if you set **Cloud Control** to **Custom**. |
3333
| - **Cloud LUT** | Specifies the lookup table for the clouds. For information on the format of this Texture, see [Cloud map and cloud lookup table](#cloud-map-and-cloud-lookup-table). <br/><br/>This property only appears if you set **Cloud Control** to **Custom**. |
34-
| - **Cloud Map Tiling** | The **X** and **Y** UV tile rate for one or more cloud map Textures. HDRP uses the **X** and **Y** values to tile the clouds across the sky.<br/>If **Cloud Control** is set to **Advanced**, this affects **Cumulus Map**, **Alto Stratus Map**, **Cumulonimbus Map**, and **Rain Map**.<br/>If **Cloud Control** is set to **Custom**, this affects the Texture assigned to the **Cloud Map** property.<br/><br/>This property only appears if you set **Cloud Control** to **Advanced** or **Custom**. |
34+
| - **Cloud Map Tiling** | The **X** and **Y** UV tile rate for one or more cloud map Textures. HDRP uses the **X** and **Y** values to tile the clouds across the sky. When modifying those properties, cloud position is only maintained at the origin of the world (0,0,0). <br/>If **Cloud Control** is set to **Advanced**, this affects **Cumulus Map**, **Alto Stratus Map**, **Cumulonimbus Map**, and **Rain Map**.<br/>If **Cloud Control** is set to **Custom**, this affects the Texture assigned to the **Cloud Map** property.<br/><br/>This property only appears if you set **Cloud Control** to **Advanced** or **Custom**. |
3535
| - **Cloud Map Offset** | The **X** and **Y** UV offset for one or more cloud map Textures. HDRP uses the **X** and **Y** values to offset the clouds across the sky.<br/>If **Cloud Control** is set to **Advanced**, this affects **Cumulus Map**, **Alto Stratus Map**, **Cumulonimbus Map**, and **Rain Map**.<br/>If **Cloud Control** is set to **Custom**, this affects the Texture assigned to the **Cloud Map** property.<br/><br/>This property only appears if you set **Cloud Control** to **Advanced** or **Custom**, or if you set it to **Simple** and then set **Cloud Preset** to **Custom**. |
3636
| - **Density Multiplier** | The global density of the volumetric clouds. <br/><br/>This property only appears if you set **Cloud Control** to **Advanced** or **Custom**, or if you set it to **Simple** and then set **Cloud Preset** to **Custom**. |
3737
| - **Shape Factor** | Controls the amount of shaping to apply to the cloud volume. A higher value produces less cloud coverage and smaller clouds. <br/><br/>This property only appears if you set **Cloud Control** to **Advanced** or **Custom**, or if you set it to **Simple** and then set **Cloud Preset** to **Custom**. |
@@ -112,6 +112,15 @@ For the **Cloud LUT**, the color channels represent:
112112

113113
When importing these two map Textures, disable **sRGB**. For best results, do not use any compression.
114114

115+
![](Images/CloudLUT_Advanced.png)
116+
As a reference, here is the procedurally generated cloud LUT used for advanced mode. You can clearly see the 3 types of clouds (mid-altitude on the left, high altitude in the middle and cumulonimbus on the right).
117+
Also, there is variations in the green and blue channels to specify more of less erosion and ambient occlusion depending on the cloud profile.
118+
119+
![](Images/Volumetric-Clouds-manual-lut.png)
120+
121+
Here is an example cloud LUT that can be used in manual mode. On the top image, the LUT is divided into 8 32px wide parts, each representing a cloud type with a specific profile and altitude. (stratus on the left and cumulus on the right)
122+
On the bottom left, the cloud map uses grayscale values to map which type of clouds is used. For exemple a radial gradient using thoses values creates a circular cloud as seen on the bottom right using the profile set on the cloud LUT.
123+
For more examples, you can get the [environment samples](HDRP-Sample-Content.html#environment-samples) from the package manager.
124+
115125
**Note**: This cloud map is formatted differently to the cloud map that the [Cloud Layer](create-simple-clouds-cloud-layer.md) feature uses.
116126

117-
![](Images/volumetric-clouds-3.png)

Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using UnityEngine.Rendering;
44

55
using RayTracingMode = UnityEngine.Rendering.HighDefinition.RayTracingMode;
6+
using System;
67

78
namespace UnityEditor.Rendering.HighDefinition
89
{
@@ -253,16 +254,20 @@ public override void OnInspectorGUI()
253254
HDRenderPipelineUI.ExpandableGroup.Lighting,
254255
HDRenderPipelineUI.ExpandableLighting.Reflection, "m_RenderPipelineSettings.supportSSR");
255256
}
257+
256258
using var disableScope = new EditorGUI.DisabledScope(notSupported);
257259

258260
PropertyField(m_Enable, k_EnabledOpaque);
261+
if (!notSupported)
262+
HDEditorUtils.EnsureFrameSetting(FrameSettingsField.SSR, "Screen Space Reflection");
259263

260264
bool transparentSSRSupported = currentAsset.currentPlatformRenderPipelineSettings.supportSSR
261265
&& currentAsset.currentPlatformRenderPipelineSettings.supportSSRTransparent
262266
&& currentAsset.currentPlatformRenderPipelineSettings.supportTransparentDepthPrepass;
263267
if (transparentSSRSupported)
264268
{
265269
PropertyField(m_EnableTransparent, k_EnabledTransparent);
270+
HDEditorUtils.EnsureFrameSetting(FrameSettingsField.TransparentSSR, "Transparent");
266271
}
267272
else
268273
{

Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricClouds/VolumetricCloudsEditor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ void MicroDetailsSection()
194194
}
195195
}
196196

197+
bool IsWrapModeClamp(SerializedDataParameter tex) => tex.value.objectReferenceValue != null && (tex.value.objectReferenceValue as Texture).wrapMode == TextureWrapMode.Clamp;
198+
197199
void AdvancedControlMode()
198200
{
199201
// Cumulus
@@ -216,6 +218,9 @@ void AdvancedControlMode()
216218
PropertyField(m_CloudTiling, k_CloudMapTilingText);
217219
PropertyField(m_CloudOffset, k_CloudMapOffsetText);
218220

221+
if (IsWrapModeClamp(m_CumulusMap) || IsWrapModeClamp(m_AltoStratusMap) || IsWrapModeClamp(m_CumulonimbusMap))
222+
EditorGUILayout.HelpBox("One of the cloud map textures uses the clamp wrap mode, this wrap mode will be used for the global generated cloud map.", MessageType.Info);
223+
219224
// Properties of the clouds
220225
PropertyField(m_DensityMultiplier);
221226
PropertyField(m_ShapeFactor);

Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ internal bool useColorTemperature
26302630
internal Color EvaluateLightColor()
26312631
{
26322632
Color finalColor = legacyLight.color.linear * legacyLight.intensity;
2633-
2633+
26342634
if (legacyLight.useColorTemperature)
26352635
finalColor *= Mathf.CorrelatedColorTemperatureToRGB(legacyLight.colorTemperature);
26362636

Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDGpuLightsBuilder.LightLoop.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ private void CalculateDirectionalLightDataTextureInfo(
338338
GetContactShadowMask(additionalLightData, HDAdditionalLightData.ScalableSettings.UseContactShadow(m_Asset), hdCamera, ref lightData.contactShadowMask, ref lightData.isRayTracedContactShadow);
339339

340340
lightData.shadowIndex = shadowIndex;
341+
additionalLightData.shadowIndex = shadowIndex;
341342
}
342343

343344
private void CalculateLightDataTextureInfo(

0 commit comments

Comments
 (0)