Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d431184
Moved volumetric settings to a new category
alelievr Oct 12, 2020
1a12773
Added debug code + resources shader for 3D texture copy
alelievr Oct 12, 2020
f501716
First working version of density volume atlas compute copy + mipmaps …
alelievr Nov 10, 2020
04d5e6a
Updated debug
alelievr Nov 10, 2020
ce5d177
Implement 3D atlas for smaller textures (octree)
alelievr Nov 16, 2020
6e4bec1
Fixed texture 3D atlas mip generation
alelievr Nov 19, 2020
e700574
Changed volume texture from Texture3D to Texture ton acept render tex…
alelievr Nov 23, 2020
cb9e343
Updated comment
alelievr Nov 23, 2020
ddbf618
Merge branch 'master' into HDRP/density-volumes-improvements
alelievr Nov 23, 2020
ef96fca
Fix compilation after merge
alelievr Nov 23, 2020
8cb0f0d
Removed debug
alelievr Nov 23, 2020
8d1e34d
Trying to add substractive fog
alelievr Nov 24, 2020
d7fd2a0
Fixed volume debug
alelievr Nov 24, 2020
4e59872
Added exponential falloff
alelievr Nov 25, 2020
53f14b2
Removed subtractive fog
alelievr Nov 25, 2020
9f0ae80
Fixed density volume not added to atas
alelievr Nov 25, 2020
d0baedf
Merge branch 'master' into HDRP/density-volumes-improvements
alelievr Nov 30, 2020
9438065
Updated what's new
alelievr Nov 30, 2020
57b2359
Updated changelog
alelievr Nov 30, 2020
5d30609
Updated doc
alelievr Nov 30, 2020
d6fe9db
Updated doc images
alelievr Nov 30, 2020
c8cb4b5
cleanup
alelievr Nov 30, 2020
3ce19fa
Updated changelog again
alelievr Dec 1, 2020
e0eb741
Updated doc
alelievr Dec 1, 2020
603409b
Fixed Texture3D atlas child placement
alelievr Dec 1, 2020
48f99ce
Removed magic numbers and PR fixes
alelievr Dec 3, 2020
c084f63
Optimized voxel center computation
alelievr Dec 3, 2020
57d9b21
Merge branch 'master' into HDRP/density-volumes-improvements
sebastienlagarde Dec 15, 2020
09b5dec
Updated doc
alelievr Dec 15, 2020
397298f
Merge branch 'HDRP/density-volumes-improvements' of https://github.co…
alelievr Dec 15, 2020
bb86080
reverted resource modification
alelievr Dec 15, 2020
07fb372
Added protection for allocation > 2GB
alelievr Dec 15, 2020
5f6ba4f
Updated HDRP resources
alelievr Dec 15, 2020
90d81e5
PositivePow and removed debug
alelievr Dec 17, 2020
f1a0dbc
Added pragma only renderers
alelievr Dec 17, 2020
226cf5c
Trying to get linux vulkan CI to work somehow
alelievr Dec 17, 2020
9b79723
Fixed warning
alelievr Dec 18, 2020
cc34352
Fixed format
alelievr Dec 18, 2020
4eb2ca7
Merge branch 'master' into HDRP/density-volumes-improvements
sebastienlagarde Dec 18, 2020
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
4 changes: 4 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added rasterized area light shadows for AxF material
- Added View Bias for mesh decals.
- Added a cloud system and the CloudLayer volume override.
- Added a setting in the HDRP asset to change the Density Volume mask resolution of being locked at 32x32x32 (HDRP Asset > Lighting > Volumetrics > Max Density Volume Size).
- Added a Falloff Mode (Linear or Exponential) in the Density Volume for volume blending with Blend Distance.

### Fixed
- Fixed probe volumes debug views.
Expand All @@ -39,6 +41,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- The DrawRenderers function of CustomPassUtils class now takes a sortingCriteria in parameter.
- When in half res, RTR denoising is executed at half resolution and the upscale happens at the end.
- Removed the upscale radius from the RTR.
- Density Volumes can now take a 3D RenderTexture as mask, the mask can use RGBA format for RGB fog.
- Decreased the minimal Fog Distance value in the Density Volume to 0.05.

## [10.3.0] - 2020-12-01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ To create a Density Volume, right click in the Hierarchy and select __Rendering
| **Fog Distance** | Controls the density at the base of the fog and determines how far you can see through the fog in meters. At this distance, the fog has absorbed and out-scattered 63% of background light. |
| **Size** | Controls the dimensions of the Volume. |
| **Per Axis Control** | Enable this to control blend distance per axis instead of globally. |
| **Blend Distance** | Blend Distance creates a linear fade from the fog level in the Volume to the fog level outside it. This is not a percentage, it is the absolute distance from the edge of the Volume bounds, defined by the Size property, where the fade starts. Unity clamps this value between 0 and half of the lowest axis value in the Size property. If you use the Normal tab, you can alter a single float value named Blend Distance, which gives a uniform fade in every direction. If you open the Advanced tab, you can use two fades per axis, one for each direction. For example, on the x-axis you could have one for left-to-right and one for right-to-left. Setting the distance to 0 hides the fade, while setting the distance to 1 creates a fade. |
| **Blend Distance** | Blend Distance creates a fade from the fog level in the Volume to the fog level outside it. This is not a percentage, it is the absolute distance from the edge of the Volume bounds, defined by the Size property, where the fade starts. Unity clamps this value between 0 and half of the lowest axis value in the Size property. If you use the Normal tab, you can alter a single float value named Blend Distance, which gives a uniform fade in every direction. If you open the Advanced tab, you can use two fades per axis, one for each direction. For example, on the x-axis you could have one for left-to-right and one for right-to-left. Setting the distance to 0 hides the fade, while setting the distance to 1 creates a fade. |
| **Falloff Mode** | Controls the falloff function applied to the blending of **Blend Distance**. By default the falloff is linear but you can change it to exponential for a more realistic look. |
| **Invert Blend** | Reverses the direction of the fade. Setting the Blend Distances on each axis to its maximum possible value preserves the fog at the center of the Volume and fades the edges. Inverting the blend fades the center and preserves the edges instead. |
| **Distance Fade Start** | Distance from the camera at which the Density Volume starts to fade out. This is useful when optimizing a scene with many Density Volumes and making the more distant ones disappear|
| **Distance Fade End** | Distance from the camera at which the Density Volume has completely fade out. This is useful when optimizing a scene with many Density Volumes and making the more distant ones disappear|
| **Density Mask Texture** | Specifies a 3D texture mapped to the interior of the Volume. The Density Volume only uses the alpha channel of the texture. The value of the texture acts as a density multiplier. A value of 0 in the Texture results in a Volume of 0 density, and the texture value of 1 results in the original constant (homogeneous) volume. |
| **Density Mask Texture** | Specifies a 3D texture mapped to the interior of the Volume. The Density Volume only uses the RGB channels of the texture for the fog color and A for the fog density multiplier. A value of 0 in the Texture alpha channel results in a Volume of 0 density, and the value of 1 results in the original constant (homogeneous) volume. |
| **Scroll Speed** | Specifies the speed (per-axis) at which the Density Volume scrolls the texture. If you set every axis to 0, the Density Volume does not scroll the texture and the fog is static. |
| **Tiling** | Specifies the per-axis tiling rate of the texture. For example, setting the x-axis component to 2 means that the texture repeats 2 times on the x-axis within the interior of the volume. |

## Related Settings in the HDRP Asset

There are two settings related to density volumes in the HDRP Asset settings: **Max Density Volume Size** and **Max Density Volume On Screen**. You can find both of these settings in the HDRP Asset's **Lighting** section.

## Creating a Density Mask Texture

1. In image-editing software of your choice, prepare a grayscale flipbook texture and [import it as a 3D texture](https://docs.unity3d.com/2020.2/Documentation/Manual/class-Texture3D.html). For example, a texture of size 1024x32 describes a 3D texture of size 32x32x32 with 32 slices laid out one after another.
![](Images/HDRPAsset_VolumetricSettings.png)

2. Additionnaly, in the Texture Import Settings:
1. Set the __Texture Type__ to __Single Channel__.
The **Max Density Volume Size** controls the maximum resolution you can use for the **Density Mask Texture**. Changing this setting can have a large impact on memory usage. For information on how much memory HDRP allocates for the Density Volume system, see the info box below this setting in the HDRP Asset.

2. Set the __Channel__ to __Alpha__.
The **Max Density Volume On Screen** controls how many Density Volumes can appear on-screen at once. This setting also has an impact on memory.

3. (Optionnal) Set the __Alpha Source__ to __From Gray Scale__.
## Creating a Density Mask Texture

4. Click Apply.
1. In image-editing software of your choice, prepare an RGBA flipbook texture and [import it as a 3D texture](https://docs.unity3d.com/2020.2/Documentation/Manual/class-Texture3D.html). For example, a texture of size 1024x32 describes a 3D texture of size 32x32x32 with 32 slices laid out one after another.

3. Open a Density Volume component and assign the texture you just imported to the __Texture__ field in the __Density Mask Texture__ section.
2. Open a Density Volume component and assign the texture you just imported to the __Texture__ field in the __Density Mask Texture__ section.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public class ExampleComponent : VolumeComponent
}
```

### Density Volume Improvements

Density Volumes masks now support using 3D RenderTextures as masks. 3D mask textures now also use all four RGBA channel which allows volumetric fog to have different colors and density based on the 3D Texture.

The size limit of 32x32x32 for the mask textures has also been replaced by a setting in the HDRP asset called "Max Density Volume Resolution", under the Lighting > Volumetrics section. The upper limit for mask textures is now 256x256x256, an info box below the field tells you how much memory is allocated to store these textures. Note that increasing the resolution of the mask texture doesn't necessarily improve the quality of the volumetric, what's important is to have a good balance between the **Volumetrics** quality and the density volume resolution.

There is a new field to change the falloff HDRP applies when it blends the volume using the Blend Distance property. You can choose either Linear which is the default and previous technique, or Exponential which is more realistic.

Finally, the minimal value of the **Fog Distance** parameter was lowered to 0.05 instead of 1 and now allows thicker fog effects to be created.

### Cloud System

![](Images/HDRPFeatures-CloudLayer.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ static void Drawer_VolumeContent(SerializedDensityVolume serialized, Editor owne
serialized.editorNegativeFade.vector3Value = negFade;
}

EditorGUILayout.PropertyField(serialized.falloffMode, Styles.s_FalloffMode);

EditorGUILayout.Space();
EditorGUILayout.PropertyField(serialized.invertFade, Styles.s_InvertFadeLabel);

Expand All @@ -177,7 +179,20 @@ static void Drawer_VolumeContent(SerializedDensityVolume serialized, Editor owne

static void Drawer_DensityMaskTextureContent(SerializedDensityVolume serialized, Editor owner)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(serialized.volumeTexture, Styles.s_VolumeTextureLabel);
if (EditorGUI.EndChangeCheck())
{
var newTexture = serialized.volumeTexture.objectReferenceValue;
if (newTexture != null)
{
if (!(newTexture is RenderTexture rt && rt.dimension == UnityEngine.Rendering.TextureDimension.Tex3D || newTexture is Texture3D))
{
Debug.LogError($"Can't assign texture '{newTexture}' to the Density Volume because the dimension doesn't match the expected Texture3D dimension.");
serialized.volumeTexture.objectReferenceValue = null;
}
}
}
EditorGUILayout.PropertyField(serialized.textureScroll, Styles.s_TextureScrollLabel);
EditorGUILayout.PropertyField(serialized.textureTile, Styles.s_TextureTileLabel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ internal static class Styles
};

public static readonly GUIContent s_Size = new GUIContent("Size", "Modify the size of this Density Volume. This is independent of the Transform's Scale.");
public static readonly GUIContent s_AlbedoLabel = new GUIContent("Single Scattering Albedo", "The color this fog scatteres light to.");
public static readonly GUIContent s_AlbedoLabel = new GUIContent("Single Scattering Albedo", "The color this fog scatters light to.");
public static readonly GUIContent s_MeanFreePathLabel = new GUIContent("Fog Distance", "Density at the base of the fog. Determines how far you can see through the fog in meters.");
public static readonly GUIContent s_VolumeTextureLabel = new GUIContent("Texture", "The fog Texture for the Density Mask. Generate this Texture type using the Density Volume Texture Tool.");
public static readonly GUIContent s_TextureScrollLabel = new GUIContent("Scroll Speed", "Modify the speed for each axis at which HDRP scrolls the fog Texture.");
public static readonly GUIContent s_TextureTileLabel = new GUIContent("Tiling", "Modify the tiling of the fog Texture on each axis individually.");
public static readonly GUIContent s_BlendLabel = new GUIContent("Blend Distance", "Interior distance from the Size where the fog fades in completely.");
public static readonly GUIContent s_InvertFadeLabel = new GUIContent("Invert Blend", "Inverts blend values so 0 becomes the new maximum value and the original maximum value becomes 0.");
public static readonly GUIContent s_ManipulatonTypeContent = EditorGUIUtility.TrTextContent("Per Axis Control", "When checked, each face can be manipulated separatly. This also include fading options.");
public static readonly GUIContent s_FalloffMode = new GUIContent("Falloff Mode", "When Blend Distance is above 0, controls which kind of falloff is applied to the transition area.");
public static readonly GUIContent s_ManipulatonTypeContent = EditorGUIUtility.TrTextContent("Per Axis Control", "When checked, each face can be manipulated separately. This also include fading options.");

public static readonly GUIContent s_DistanceFadeStartLabel = new GUIContent("Distance Fade Start");
public static readonly GUIContent s_DistanceFadeEndLabel = new GUIContent("Distance Fade End");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

namespace UnityEditor.Rendering.HighDefinition
{
Expand All @@ -25,6 +26,8 @@ class SerializedDensityVolume
public SerializedProperty distanceFadeStart;
public SerializedProperty distanceFadeEnd;

public SerializedProperty falloffMode;

SerializedObject m_SerializedObject;

public SerializedDensityVolume(SerializedObject serializedObject)
Expand Down Expand Up @@ -54,6 +57,8 @@ public SerializedDensityVolume(SerializedObject serializedObject)

distanceFadeStart = densityParams.FindPropertyRelative("distanceFadeStart");
distanceFadeEnd = densityParams.FindPropertyRelative("distanceFadeEnd");

falloffMode = densityParams.FindPropertyRelative(nameof(DensityVolumeArtistParameters.falloffMode));
}

public void Apply()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class GeneralSection
public static readonly GUIContent lightingQualitySettings = EditorGUIUtility.TrTextContent("Lighting Quality Settings");

public static readonly GUIContent lightLayerSubTitle = EditorGUIUtility.TrTextContent("Light Layers");
public static readonly GUIContent volumetricSubTitle = EditorGUIUtility.TrTextContent("Volumetrics");
public static readonly GUIContent cookiesSubTitle = EditorGUIUtility.TrTextContent("Cookies");
public static readonly GUIContent reflectionsSubTitle = EditorGUIUtility.TrTextContent("Reflections");
public static readonly GUIContent skySubTitle = EditorGUIUtility.TrTextContent("Sky");
Expand Down Expand Up @@ -137,6 +138,8 @@ public class GeneralSection
internal const string probeVolumeInfo = "Warning: Probe Volumes is a highly experimental feature.\nIt is disabled by default for this reason.\nIt's functionality is subject to breaking changes and whole sale removal.\nIt is not recommended for use outside of for providing feedback.\nIt should not be used in production.\nTo enable, set:\nEnableProbeVolumes = 1\ninside of ShaderConfig.cs\and inside of the editor run:\nEdit->Render Pipeline->Generate Shader Includes\nProbe Volumes feature must also be enabled here.";
internal static readonly GUIContent probeVolumeAtlasResolution = EditorGUIUtility.TrTextContent("Atlas Resolution", "Resolution of the 3D texture atlas containing visible ProbeVolumes.");
internal static readonly GUIContent probeVolumeAtlasOctahedralDepthResolution = EditorGUIUtility.TrTextContent("Octahedral Depth Atlas Resolution", "Resolution of the 2D texture atlas containing visible ProbeVolumes octahedral depth data.");
public static readonly GUIContent maxDensityVolumeSizeStyle = EditorGUIUtility.TrTextContent("Max Density Volume Size", "Specifies the maximum size for the individual 3D density volume texture that HDRP uses for Density Volumes. This settings will affect your memory consumption.");
public static readonly GUIContent maxDensityVolumesOnScreenStyle = EditorGUIUtility.TrTextContent("Max Density Volumes On Screen", "Sets the maximum number of density volume HDRP can handle on screen at once. This settings will affect your memory consumption.");


public const string cacheErrorFormat = "This configuration will lead to more than 2 GB reserved for this cache at runtime! ({0} requested) Only {1} element will be reserved instead.";
Expand Down
Loading