From d54fdf5832cea8065b938ce85863ae7c91f235fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 9 Mar 2021 11:58:07 +0100 Subject: [PATCH 01/27] Rename Density Volume to Local Volumetric Fog UX and Documentation part --- .../Documentation~/Density-Volume.md | 28 +++++++++---------- .../Render-Pipeline-Debug-Window.md | 2 +- .../Documentation~/TableOfContents.md | 2 +- .../Upgrading-from-2020.1-to-2020.2.md | 6 ++-- .../Documentation~/whats-new-12.md | 8 +++--- .../VolumetricLighting/DensityVolumeEditor.cs | 4 +-- .../DensityVolumeUI.Drawer.cs | 2 +- .../DensityVolumeUI.Skin.cs | 4 +-- .../VolumetricLighting/VolumetricMenuItem.cs | 4 +-- .../RenderPipeline/HDRenderPipelineUI.Skin.cs | 4 +-- .../Runtime/Debug/DebugDisplay.cs | 2 +- .../Runtime/Debug/LightingDebug.cs | 6 ++-- .../LightLoop/GlobalLightLoopSettings.cs | 6 ++-- .../Runtime/Lighting/LightLoop/LightLoop.cs | 10 +++---- .../Lighting/LightLoop/lightlistbuild.compute | 4 +-- .../DensityVolume.Migration.cs | 2 +- .../VolumetricLighting/DensityVolume.cs | 10 +++---- .../DensityVolumeManager.cs | 10 +++---- .../VolumeVoxelization.compute | 2 +- .../RenderPipeline/HDRenderPipeline.cs | 2 +- 20 files changed, 59 insertions(+), 59 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md b/com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md index b4fbb59dda0..325a679dee2 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md @@ -1,13 +1,13 @@ -## Density Volume +## Local Volumetric Fog -You may want to have fog effects in your Scene that global fog can not produce by itself. In these cases you can use local fog. To add localized fog, use a Density Volume. A Density Volume is a an additive Volume of fog represented as an oriented bounding box. By default, fog is constant (homogeneous), but you can alter it by assigning a Density Mask 3D texture to the __Texture__ field under the __Density Mask Texture__ section. Currently, HDRP supports 3D textures at a resolution of 32x32x32. +You may want to have fog effects in your Scene that global fog can not produce by itself. In these cases you can use local fog. To add localized fog, use a Local Volumetric Fog. A Local Volumetric Fog is a an additive Volume of fog represented as an oriented bounding box. By default, fog is constant (homogeneous), but you can alter it by assigning a Density Mask 3D texture to the __Texture__ field under the __Density Mask Texture__ section. Currently, HDRP supports 3D textures at a resolution of 32x32x32. -HDRP voxelizes Density Volumes to enhance performance. This results in two limitations: +HDRP voxelizes Local Volumetric Fog to enhance performance. This results in two limitations: -- Density Volumes do not support volumetric shadowing. If you place a Density Volume between a Light and a surface, the Volume does not decrease the intensity of light that reaches the surface. -- Density Volumes are voxelized at a very coarse rate, with typically only 64 or 128 slices along the camera's focal axis. This can cause noticeable aliasing at the boundary of the Volume. You can hide the aliasing by using Density Volumes in conjunction with some global fog, if possible. You can also use a Density Mask and a non-zero Blend Distance to decrease the hardness of the edge. +- Local Volumetric Fog do not support volumetric shadowing. If you place a Local Volumetric Fog between a Light and a surface, the Volume does not decrease the intensity of light that reaches the surface. +- Local Volumetric Fog are voxelized at a very coarse rate, with typically only 64 or 128 slices along the camera's focal axis. This can cause noticeable aliasing at the boundary of the Volume. You can hide the aliasing by using Local Volumetric Fog in conjunction with some global fog, if possible. You can also use a Density Mask and a non-zero Blend Distance to decrease the hardness of the edge. -To create a Density Volume, right click in the Hierarchy and select __Volume > Density Volume__. Alternatively, you can use the menu bar at the top of the screen and navigate to __GameObject > Volume > Density Volume__. +To create a Local Volumetric Fog, right click in the Hierarchy and select __Volume > Local Volumetric Fog__. Alternatively, you can use the menu bar at the top of the screen and navigate to __GameObject > Volume > Local Volumetric Fog__. # Properties @@ -25,24 +25,24 @@ To create a Density Volume, right click in the Hierarchy and select __Volume > D | **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 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. | +| **Distance Fade Start** | Distance from the camera at which the Local Volumetric Fog starts to fade out. This is useful when optimizing a scene with many Local Volumetric Fog and making the more distant ones disappear| +| **Distance Fade End** | Distance from the camera at which the Local Volumetric Fog has completely fade out. This is useful when optimizing a scene with many Local Volumetric Fog and making the more distant ones disappear| +| **Density Mask Texture** | Specifies a 3D texture mapped to the interior of the Volume. The Local Volumetric Fog 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 Local Volumetric Fog scrolls the texture. If you set every axis to 0, the Local Volumetric Fog 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. +There are two settings related to Local Volumetric Fog in the HDRP Asset settings: **Max Local Volumetric Fog Size** and **Max Local Volumetric Fog On Screen**. You can find both of these settings in the HDRP Asset's **Lighting** section. ![](Images/HDRPAsset_VolumetricSettings.png) -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. +The **Max Local Volumetric Fog 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 Local Volumetric Fog system, see the info box below this setting in the HDRP Asset. -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. +The **Max Local Volumetric Fog On Screen** controls how many Local Volumetric Fog can appear on-screen at once. This setting also has an impact on memory. ## Creating a Density Mask Texture 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. -2. 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 Local Volumetric Fog component and assign the texture you just imported to the __Texture__ field in the __Density Mask Texture__ section. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md b/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md index a4f9697f384..9a3d68afdd4 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md @@ -167,7 +167,7 @@ The **Lighting** panel has tools that you can use to visualize various component | ------------------------------------ | ------------------------------------------------------------ | | **Fullscreen Debug Mode** | Use the drop-down to select a fullscreen lighting effect to debug. For example, you can visualize [Contact Shadows](Override-Contact-Shadows.md), the depth pyramid, and indirect diffuse lighting. | | **Tile/Cluster Debug** | Use the drop-down to select an internal HDRP lighting structure to visualize on screen.
• **None**: Select this option to turn off this debug feature.
• **Tile**: Select this option to show an overlay of each lighting tile, and the number of lights in them.
• **Cluster**: Select this option to show an overlay of each lighting cluster that intersects opaque geometry, and the number of lights in them.
• **Material Feature Variants**: Select this option to show the index of the lighting Shader variant that HDRP uses for a tile. You can find variant descriptions in the *lit.hlsl* file. | -| **- Tile/Cluster Debug By Category** | Use the drop-down to select the Light type that you want to show the Tile/Cluster debug information for. The options include [Light Types](Light-Component.md), [Decals](Decal-Projector.md), and [Density Volumes](Density-Volume.md).
This property only appears when you select **Tile** or **Cluster** from the **Tile/Cluster Debug** drop-down. | +| **- Tile/Cluster Debug By Category** | Use the drop-down to select the Light type that you want to show the Tile/Cluster debug information for. The options include [Light Types](Light-Component.md), [Decals](Decal-Projector.md), and [Local Volumetric Fog](Density-Volume.md).
This property only appears when you select **Tile** or **Cluster** from the **Tile/Cluster Debug** drop-down. | | **- Cluster Debug Mode** | Use the drop-down to select the visualization mode for the cluster. The options are:
**VisualizeOpaque**: Shows cluster information on opaque geometry.
**VisualizeSlice**: Shows cluster information at a set distance from the camera.
This property only appears when you select **Cluster** from the **Tile/Cluster Debug** drop-down.. | | **- Cluster Distance** | Use this slider to set the distance from the camera at which to display the cluster slice. This property only appears when you select **VisualizeSlice** from the **Cluster Debug Mode** drop-down. | | **Display Sky Reflection** | Enable the checkbox to display an overlay of the cube map that the current sky generates and HDRP uses for lighting. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md index d346131104d..d6a55505d83 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md @@ -133,7 +133,7 @@ * [Environment Lighting](Environment-Lighting.md) * [Clouds in HDRP](clouds-in-hdrp.md) * [Atmospheric Scattering](Atmospheric-Scattering.md) - * [Density Volume](Density-Volume.md) + * [Local Volumetric Fog](Density-Volume.md) * [Light Layers](Light-Layers.md) * [Shadows](Shadows-in-HDRP.md) * [Shadowmasks](Lighting-Mode-Shadowmask.md) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md index a0b8595abc1..7fe934ca092 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md @@ -249,10 +249,10 @@ With: protected override void Execute(CustomPassContext ctx) { ... } ``` -## Density Volume Mask Texture +## Local Volumetric Fog Mask Texture -Previously, to convert a 2D flipbook texture to the 3D format Density Mask Textures require, you needed to use the __Density Volume Texture Tool__ in the __Window > Rendering__ menu. -From Unity 2020.2, you can now do this conversion directly through the __Texture Importer__. For information on how to use the importer to convert the flipbook texture, see the [Density Volume documentation](Density-Volume.md). +Previously, to convert a 2D flipbook texture to the 3D format Density Mask Textures require, you needed to use the __Local Volumetric Fog Texture Tool__ in the __Window > Rendering__ menu. +From Unity 2020.2, you can now do this conversion directly through the __Texture Importer__. For information on how to use the importer to convert the flipbook texture, see the [Local Volumetric Fog documentation](Density-Volume.md). ## Diffusion Profiles diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md index b4f9670298c..4dc3a2a0f8f 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md @@ -15,11 +15,11 @@ Group of Materials / GameObject can be setup to use Force Emissive forward with ## Improvements -### Density Volume Improvements +### Local Volumetric Fog 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. +Local Volumetric Fog 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. +The size limit of 32x32x32 for the mask textures has also been replaced by a setting in the HDRP asset called "Max Local Volumetric Fog 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 Local Volumetric Fog 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. @@ -69,7 +69,7 @@ From HDRP 12.0, various top level menus are now different. This is to make the t * **C# Custom Pass** is now at **Assets > Create > Rendering > HDRP C# Custom Pass** * **C# Post Process Volume** is now at **Assets > Create > Rendering > HDRP C# Post Process Volume** * **GameObject** - * **Density Volume** is now at **GameObject > Volume > Density Volume** + * **Density Volume** is now at **GameObject > Volume > Local Volumetric Fog** * **Decal Projector** is now at **GameObject > Decal Projector** * **Sky and Fog Volume** is now at **GameObject > Volume > Sky and Fog Global Volume** diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs index 11aa54384e7..d6529e6b2a9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs @@ -127,7 +127,7 @@ void OnSceneGUI() s_BlendBox.DrawHandle(); if (EditorGUI.EndChangeCheck()) { - Undo.RecordObject(densityVolume, "Change Density Volume Blend"); + Undo.RecordObject(densityVolume, L10n.Tr("Change Local Volumetric Fog Blend")); if (densityVolume.parameters.m_EditorAdvancedFade) { @@ -172,7 +172,7 @@ void OnSceneGUI() s_ShapeBox.DrawHandle(); if (EditorGUI.EndChangeCheck()) { - Undo.RecordObjects(new Object[] { densityVolume, densityVolume.transform }, "ChangeDensity Volume Bounding Box"); + Undo.RecordObjects(new Object[] { densityVolume, densityVolume.transform }, L10n.Tr("Change Local Volumetric Fog Bounding Box")); Vector3 newSize = s_ShapeBox.size; densityVolume.parameters.size = newSize; diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs index 089ff804aae..1f41de23d66 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs @@ -188,7 +188,7 @@ static void Drawer_DensityMaskTextureContent(SerializedDensityVolume serialized, { 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."); + Debug.LogError($"Can't assign texture '{newTexture}' to the Local Volumetric Fog because the dimension doesn't match the expected Texture3D dimension."); serialized.volumeTexture.objectReferenceValue = null; } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs index 1b850bdba68..3fb68960244 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs @@ -15,10 +15,10 @@ internal static class Styles EditorGUIUtility.IconContent("PreMatCube", "|Modify the influence volume. (SHIFT+2)") }; - 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_Size = new GUIContent("Size", "Modify the size of this Local Volumetric Fog. This is independent of the Transform's Scale."); 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_VolumeTextureLabel = new GUIContent("Texture", "The fog Texture for the Density Mask. Generate this Texture type using the Local Volumetric Fog 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."); diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs index 09972eba99c..58f698579f9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs @@ -6,11 +6,11 @@ namespace UnityEditor.Rendering.HighDefinition { class VolumetricMenuItems { - [MenuItem("GameObject/Volume/Density Volume", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.gameObjectMenuPriority + 2)] + [MenuItem("GameObject/Volume/Local Volumetric Fog", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.gameObjectMenuPriority + 2)] static void CreateDensityVolumeGameObject(MenuCommand menuCommand) { var parent = menuCommand.context as GameObject; - var densityVolume = CoreEditorUtils.CreateGameObject("Density Volume", parent); + var densityVolume = CoreEditorUtils.CreateGameObject("Local Volumetric Fog", parent); densityVolume.AddComponent(); } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 75c32b8c7df..22538d9e5e0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -180,8 +180,8 @@ public class GeneralSection public static readonly GUIContent probeVolumeMemoryBudget = EditorGUIUtility.TrTextContent("Memory Budget", "Determines the width and height of the textures used to store GI data from probes. Note that the textures also have a fixed depth dimension."); 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; public static readonly GUIContent probeVolumeSHBands = EditorGUIUtility.TrTextContent("SH Bands", "Determines up to what SH bands the Probe Volume will use. Chosing L2 will lead to better quality, but also higher memory and runtime cost."); - 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 static readonly GUIContent maxDensityVolumeSizeStyle = EditorGUIUtility.TrTextContent("Max Local Volumetric Fog Size", "Specifies the maximum size for the individual 3D Local Volumetric Fog texture that HDRP uses for Local Volumetric Fog. This settings will affect your memory consumption."); + public static readonly GUIContent maxDensityVolumesOnScreenStyle = EditorGUIUtility.TrTextContent("Max Local Volumetric Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); public const string probeVolumeNotEnabled = "Warning: Probe Volumes are not enabled.\nIt is an highly experimental feature and 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 136919539a3..a69eb89ec36 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -1416,7 +1416,7 @@ void RegisterLightingDebug() }); } - list.Add(new DebugUI.BoolField { displayName = "Display Density Volume Atlas", getter = () => data.lightingDebugSettings.displayDensityVolumeAtlas, setter = value => data.lightingDebugSettings.displayDensityVolumeAtlas = value, onValueChanged = RefreshLightingDebug}); + list.Add(new DebugUI.BoolField { displayName = "Display Local Volumetric Fog Atlas", getter = () => data.lightingDebugSettings.displayDensityVolumeAtlas, setter = value => data.lightingDebugSettings.displayDensityVolumeAtlas = value, onValueChanged = RefreshLightingDebug}); if (data.lightingDebugSettings.displayDensityVolumeAtlas) { list.Add(new DebugUI.Container diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs index 751c20237d0..31a1ed95699 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs @@ -352,11 +352,11 @@ public bool IsDebugDisplayEnabled() /// True if reflection probes lights should be displayed in the scene. public bool showReflectionProbe = true; - /// Display the density volume atlas. + /// Display the Local Volumetric Fog atlas. public bool displayDensityVolumeAtlas = false; - /// Density volume atlas slice. + /// Local Volumetric Fog atlas slice. public uint densityVolumeAtlasSlice = 0; - /// True if Density Volume Atlas debug mode should be displayed for the currently selected Density Volume. + /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. public bool densityVolumeUseSelection = false; /// Tile and Cluster debug mode. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs index aacdbf9769d..1cd5e3ffd9f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs @@ -114,7 +114,7 @@ public enum CubeCookieResolution } /// - /// Possible values for one element of the density volume atlas. + /// Possible values for one element of the Local Volumetric Fog atlas. /// [Serializable] public enum DensityVolumeResolution @@ -218,9 +218,9 @@ public struct GlobalLightLoopSettings /// Maximum number of lights per ray tracing light cluster cell. public int maxLightsPerClusterCell; - /// Maximum size of one density volume texture. + /// Maximum size of one Local Volumetric Fog texture. public DensityVolumeResolution maxDensityVolumeSize; - /// Maximum number of density volumes at the same time on screen. + /// Maximum number of Local Volumetric Fog at the same time on screen. public int maxDensityVolumesOnScreen; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index df120e76c41..e67dcc49dc5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -66,7 +66,7 @@ internal enum LightCategory Area, Env, Decal, - DensityVolume, // WARNING: Currently lightlistbuild.compute assumes density volume is the last element in the LightCategory enum. Do not append new LightCategory types after DensityVolume. TODO: Fix .compute code. + DensityVolume, // WARNING: Currently lightlistbuild.compute assumes dLocal Volumetric Fog is the last element in the LightCategory enum. Do not append new LightCategory types after DensityVolume. TODO: Fix .compute code. Count } @@ -216,7 +216,7 @@ public enum TileClusterCategoryDebug : int ProbeVolumes = 8, /// Decals. Decal = 16, - /// Density Volumes. + /// Local Volumetric Fog. DensityVolumes = 32 }; @@ -2643,7 +2643,7 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu } } - // Inject density volumes into the clustered data structure for efficient look up. + // Inject Local Volumetric Fog into the clustered data structure for efficient look up. m_DensityVolumeCount = densityVolumes.bounds != null ? densityVolumes.bounds.Count : 0; for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex) @@ -2658,7 +2658,7 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu for (int i = 0, n = m_DensityVolumeCount; i < n; i++) { - // Density volumes are not lights and therefore should not affect light classification. + // Local Volumetric Fog are not lights and therefore should not affect light classification. LightFeatureFlags featureFlags = 0; CreateBoxVolumeDataAndBound(densityVolumes.bounds[i], LightCategory.DensityVolume, featureFlags, worldToViewCR, 0.0f, out LightVolumeData volumeData, out SFiniteLightBound bound); m_lightList.lightsPerView[viewIndex].lightVolumes.Add(volumeData); @@ -2784,7 +2784,7 @@ static uint PackProbeKey(float logVolume, LightVolumeType lightVolumeType, uint struct BuildGPULightListParameters { // Common - public int totalLightCount; // Regular + Env + Decal + Density Volumes + public int totalLightCount; // Regular + Env + Decal + Local Volumetric Fog public int viewCount; public bool runLightList; public bool clearLightLists; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute index 13278a192d2..318a75e08f4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute @@ -52,7 +52,7 @@ StructuredBuffer g_vBigTileLightList : register( t4 ); // don't sup // output buffer RWStructuredBuffer g_vLightList : register( u0 ); // don't support RWBuffer yet in unity -#define CATEGORY_LIST_SIZE (LIGHTCATEGORY_COUNT - 1) // Skip density volumes +#define CATEGORY_LIST_SIZE (LIGHTCATEGORY_COUNT - 1) // Skip Local Volumetric Fog groupshared unsigned int coarseList[LIGHT_LIST_MAX_COARSE_ENTRIES]; groupshared unsigned int prunedList[LIGHT_LIST_MAX_COARSE_ENTRIES]; // temporarily support room for all 64 while in LDS @@ -223,7 +223,7 @@ void TileLightListGen(uint3 dispatchThreadId : SV_DispatchThreadID, uint threadI for(int l=(int) t; l<(int) g_iNrVisibLights; l += NR_THREADS) { #endif - // Skip density volumes (lights are sorted by category). TODO: improve data locality + // Skip Local Volumetric Fog (lights are sorted by category). TODO: improve data locality if (_LightVolumeData[l].lightCategory == LIGHTCATEGORY_DENSITY_VOLUME) { break; } const ScreenSpaceBoundsIndices boundsIndices = GenerateScreenSpaceBoundsIndices(l, g_iNrVisibLights, unity_StereoEyeIndex); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.Migration.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.Migration.cs index ca581ca1c19..b5f26d188b8 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.Migration.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.Migration.cs @@ -40,7 +40,7 @@ enum Version data.parameters.size = data.transform.lossyScale; //missing migrated data. - //when migrated prior to this fix, density volumes have to be manually set on advance mode. + //when migrated prior to this fix, Local Volumetric Fog have to be manually set on advance mode. data.parameters.m_EditorAdvancedFade = true; }), MigrationStep.New(Version.FixUniformBlendDistanceToBeMetric, (DensityVolume data) => data.parameters.MigrateToFixUniformBlendDistanceToBeMetric()) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs index 95a6bc3d808..27d21da3e04 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs @@ -3,7 +3,7 @@ namespace UnityEngine.Rendering.HighDefinition { - /// Artist-friendly density volume parametrization. + /// Artist-friendly Local Volumetric Fog parametrization. [Serializable] public partial struct DensityVolumeArtistParameters { @@ -13,7 +13,7 @@ public partial struct DensityVolumeArtistParameters public float meanFreePath; // Should be chromatic - this is an optimization! /// Anisotropy of the phase function: [-1, 1]. Positive values result in forward scattering, and negative values - in backward scattering. [FormerlySerializedAs("asymmetry")] - public float anisotropy; // . Not currently available for density volumes + public float anisotropy; // . Not currently available for Local Volumetric Fog /// Texture containing density values. public Texture volumeMask; @@ -160,13 +160,13 @@ internal DensityVolumeEngineData ConvertToEngineData() } } // class DensityVolumeParameters - /// Density volume class. + /// Local Volumetric Fog class. [HelpURL(Documentation.baseURL + Documentation.version + Documentation.subURL + "Density-Volume" + Documentation.endURL)] [ExecuteAlways] - [AddComponentMenu("Rendering/Density Volume")] + [AddComponentMenu("Rendering/Local Volumetric Fog")] public partial class DensityVolume : MonoBehaviour { - /// Density volume parameters. + /// Local Volumetric Fog parameters. public DensityVolumeArtistParameters parameters = new DensityVolumeArtistParameters(Color.white, 10.0f, 0.0f); private Texture previousVolumeMask = null; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs index 948128cedf4..48429606eea 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs @@ -40,7 +40,7 @@ public Texture3DAtlas volumeAtlas m_VolumeAtlas = new Texture3DAtlas(densityVolumeAtlasFormat, (int)settings.maxDensityVolumeSize, elementCount); - // When HDRP is initialized and this atlas created, some density volume may have been initialized before so we add them here. + // When HDRP is initialized and this atlas created, some Local Volumetric Fog may have been initialized before so we add them here. foreach (var volume in m_Volumes) { if (volume.parameters.volumeMask != null) @@ -63,7 +63,7 @@ public void RegisterVolume(DensityVolume volume) { m_Volumes.Add(volume); - // In case the density volume format is not support (which is impossible because all HDRP target supports R8G8B8A8_UNorm) + // In case the Local Volumetric Fog format is not support (which is impossible because all HDRP target supports R8G8B8A8_UNorm) // we avoid doing operations on the atlas. // This happens in the CI on linux when an editor using OpenGL is building a player for Vulkan. if (!SystemInfo.IsFormatSupported(densityVolumeAtlasFormat, FormatUsage.LoadStore)) @@ -81,7 +81,7 @@ public void RegisterVolume(DensityVolume volume) internal void AddTextureIntoAtlas(Texture volumeTexture) { if (!volumeAtlas.AddTexture(volumeTexture)) - Debug.LogError($"No more space in the density volume atlas, consider increasing the max density volume on screen in the HDRP asset."); + Debug.LogError($"No more space in the Local Volumetric Fog atlas, consider increasing the max Local Volumetric Fog on screen in the HDRP asset."); } public void DeRegisterVolume(DensityVolume volume) @@ -89,7 +89,7 @@ public void DeRegisterVolume(DensityVolume volume) if (m_Volumes.Contains(volume)) m_Volumes.Remove(volume); - // In case the density volume format is not support (which is impossible because all HDRP target supports R8G8B8A8_UNorm) + // In case the Local Volumetric Fog format is not support (which is impossible because all HDRP target supports R8G8B8A8_UNorm) // we avoid doing operations on the atlas. // This happens in the CI on linux when an editor using OpenGL is building a player for Vulkan. if (!SystemInfo.IsFormatSupported(densityVolumeAtlasFormat, FormatUsage.LoadStore)) @@ -120,7 +120,7 @@ public List PrepareDensityVolumeData(CommandBuffer cmd, HDCamera return m_Volumes; } - // Note that this function will not release the manager itself as it have to live outside of HDRP to handle density volume components + // Note that this function will not release the manager itself as it have to live outside of HDRP to handle Local Volumetric Fog components internal void ReleaseAtlas() { // Release the atlas so next time the manager is used, it is reallocated with new HDRP settings. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute index 6d7b8015845..3b58ffb273f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute @@ -140,7 +140,7 @@ void FillVolumetricDensityBuffer(PositionInputs posInput, uint tileIndex, Jitter if (objectIndex >= _DensityVolumeIndexShift) { - // We have found the first density volume. + // We have found the first Local Volumetric Fog. break; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index b96678b56a2..d9c8502cd6d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -1975,7 +1975,7 @@ AOVRequestData aovRequest foreach (var material in m_MaterialList) material.Bind(cmd); - // Frustum cull density volumes on the CPU. Can be performed as soon as the camera is set up. + // Frustum cull Local Volumetric Fog on the CPU. Can be performed as soon as the camera is set up. DensityVolumeList densityVolumes = PrepareVisibleDensityVolumeList(hdCamera, cmd); // do AdaptiveProbeVolume stuff From ba0c96d82aea209b1a9fdd2f4d5cf01b89cdb35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 9 Mar 2021 12:13:34 +0100 Subject: [PATCH 02/27] Fixes from code review --- .../Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs | 2 +- .../Runtime/Lighting/LightLoop/LightLoop.cs | 2 +- .../Runtime/Lighting/LightLoop/LightLoop.cs.hlsl | 2 +- .../Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute | 2 +- .../Runtime/Lighting/LightLoop/lightlistbuild.compute | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs index 58f698579f9..6beeccf67d5 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs @@ -6,7 +6,7 @@ namespace UnityEditor.Rendering.HighDefinition { class VolumetricMenuItems { - [MenuItem("GameObject/Volume/Local Volumetric Fog", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.gameObjectMenuPriority + 2)] + [MenuItem("GameObject/Local Volumetric Fog", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.gameObjectMenuPriority + 2)] static void CreateDensityVolumeGameObject(MenuCommand menuCommand) { var parent = menuCommand.context as GameObject; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index e67dcc49dc5..00c14d8644d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -66,7 +66,7 @@ internal enum LightCategory Area, Env, Decal, - DensityVolume, // WARNING: Currently lightlistbuild.compute assumes dLocal Volumetric Fog is the last element in the LightCategory enum. Do not append new LightCategory types after DensityVolume. TODO: Fix .compute code. + DensityVolume, // WARNING: Currently lightlistbuild.compute assumes Local Volumetric Fog is the last element in the LightCategory enum. Do not append new LightCategory types after DensityVolume. TODO: Fix .compute code. Count } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl index 8626efc9500..6c3d48b4cb5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl @@ -19,7 +19,7 @@ #define LIGHTCATEGORY_AREA (1) #define LIGHTCATEGORY_ENV (2) #define LIGHTCATEGORY_DECAL (3) -#define LIGHTCATEGORY_DENSITY_VOLUME (4) +#define LIGHTCATEGORY_LOCAL_VOLUMETRIC_FOG (4) #define LIGHTCATEGORY_COUNT (5) // diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute index 954f8e3f197..733ad6710ed 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute @@ -411,7 +411,7 @@ void LIGHTLISTGEN(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_GroupID) WriteShiftIndex(t, LIGHTCATEGORY_ENV, _EnvLightIndexShift); WriteShiftIndex(t, LIGHTCATEGORY_DECAL, _DecalIndexShift); - WriteShiftIndex(t, LIGHTCATEGORY_DENSITY_VOLUME, _DensityVolumeIndexShift); + WriteShiftIndex(t, LIGHTCATEGORY_LOCAL_VOLUMETRIC_FOG, _DensityVolumeIndexShift); uint offs = start; for(int ll=0; ll Date: Tue, 9 Mar 2021 12:14:43 +0100 Subject: [PATCH 03/27] Changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 53afa64f771..d429e2471d5 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -96,7 +96,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard - Removed the material pass probe volumes evaluation mode. -- Changed GameObject/Rendering/Density Volume to GameObject/Volume/Density Volume +- Changed GameObject/Rendering/Density Volume to GameObject/Local Volumetric Fog - Changed GameObject/Rendering/Decal Projector to GameObject/Decal Projector - Changed GameObject/Volume/Sky and Fog Volume to GameObject/Volume/Sky and Fog Global Volume - Move the Decal Gizmo Color initialization to preferences From ec15732f544f4bc0e4ca49b5daa9101e376f4922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 9 Mar 2021 12:45:17 +0100 Subject: [PATCH 04/27] Fixes from code review --- .../Documentation~/Images/DensityVolume1.png | 4 ++-- .../Runtime/Lighting/LightLoop/LightLoop.cs.hlsl | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png index 945d539b289..331327bee8f 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59782a337b4dc428bcb0912fff10eb54b9dd25d0b2b071874fb72add7105eb21 -size 29667 +oid sha256:0e2ba6dc50fe22c56c50ff4cdaa10c5ce5a5c479af543d0af024c48d65b54ff2 +size 32847 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl index 6c3d48b4cb5..48aa9967647 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl @@ -19,6 +19,7 @@ #define LIGHTCATEGORY_AREA (1) #define LIGHTCATEGORY_ENV (2) #define LIGHTCATEGORY_DECAL (3) +#define LIGHTCATEGORY_DENSITY_VOLUME (4) #define LIGHTCATEGORY_LOCAL_VOLUMETRIC_FOG (4) #define LIGHTCATEGORY_COUNT (5) From 45119e0d68609dd0a7c27a15372e57f065c31123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Wed, 10 Mar 2021 15:35:29 +0100 Subject: [PATCH 05/27] Rename Density Volume to Local Volumetric Fog on the codebase - Deprecating old stuff that must be set the Obsolete flag to true on 21.2 --- .../Editor/CoreEditorUtils.cs | 34 ++++ .../ProbeVolume/ProbeVolumeUI.Drawer.cs | 2 +- .../Runtime/Utilities/CoreUtils.cs | 24 +++ ...sity-Volume.md => Local-Volumetric-Fog.md} | 2 +- .../Render-Pipeline-Debug-Window.md | 2 +- .../Documentation~/TableOfContents.md | 2 +- .../Upgrading-from-2020.1-to-2020.2.md | 2 +- ...eEditor.cs => LocalVolumetricFogEditor.cs} | 30 ++-- ....meta => LocalVolumetricFogEditor.cs.meta} | 2 +- ...awer.cs => LocalVolumetricFogUI.Drawer.cs} | 16 +- ...ta => LocalVolumetricFogUI.Drawer.cs.meta} | 0 ...I.Skin.cs => LocalVolumetricFogUI.Skin.cs} | 2 +- ...meta => LocalVolumetricFogUI.Skin.cs.meta} | 0 ...ume.cs => SerializedLocalVolumetricFog.cs} | 6 +- ...a => SerializedLocalVolumetricFog.cs.meta} | 0 .../VolumetricLighting/VolumetricMenuItem.cs | 6 +- .../RenderPipeline/HDRenderPipelineUI.Skin.cs | 8 +- .../RenderPipeline/HDRenderPipelineUI.cs | 37 ++-- .../SerializedGlobalLightLoopSettings.cs | 8 +- .../Runtime/Debug/DebugDisplay.cs | 23 +-- .../Runtime/Debug/LightingDebug.cs | 11 +- .../Lighting/AtmosphericScattering/Fog.cs | 4 +- .../LightLoop/GlobalLightLoopSettings.cs | 48 ++++- .../Runtime/Lighting/LightLoop/LightLoop.cs | 32 ++-- .../Lighting/LightLoop/LightLoop.cs.hlsl | 2 +- .../lightlistbuild-clustered.compute | 2 +- ...er => DebugLocalVolumetricFogAtlas.shader} | 2 +- ... DebugLocalVolumetricFogAtlas.shader.meta} | 0 ...ion.cs => LocalVolumetricFog.Migration.cs} | 10 +- ...a => LocalVolumetricFog.Migration.cs.meta} | 0 ...DensityVolume.cs => LocalVolumetricFog.cs} | 165 +++++++++++++++--- ...ume.cs.meta => LocalVolumetricFog.cs.meta} | 0 ...anager.cs => LocalVolumetricFogManager.cs} | 34 ++-- ...meta => LocalVolumetricFogManager.cs.meta} | 0 .../VolumeVoxelization.compute | 10 +- .../VolumetricLighting/VolumetricLighting.cs | 59 ++++--- .../VolumetricLighting.cs.hlsl | 36 ++-- .../Runtime/RenderPipeline/HDProfileId.cs | 6 +- .../RenderPipeline/HDRenderPipeline.Debug.cs | 30 ++-- .../RenderPipeline/HDRenderPipeline.cs | 4 +- .../RenderPipeline/RenderPipelineResources.cs | 4 +- .../HDRenderPipelineResources.asset | 2 +- 42 files changed, 453 insertions(+), 214 deletions(-) rename com.unity.render-pipelines.high-definition/Documentation~/{Density-Volume.md => Local-Volumetric-Fog.md} (99%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{DensityVolumeEditor.cs => LocalVolumetricFogEditor.cs} (90%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{DensityVolumeEditor.cs.meta => LocalVolumetricFogEditor.cs.meta} (83%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{DensityVolumeUI.Drawer.cs => LocalVolumetricFogUI.Drawer.cs} (91%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{DensityVolumeUI.Drawer.cs.meta => LocalVolumetricFogUI.Drawer.cs.meta} (100%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{DensityVolumeUI.Skin.cs => LocalVolumetricFogUI.Skin.cs} (98%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{DensityVolumeUI.Skin.cs.meta => LocalVolumetricFogUI.Skin.cs.meta} (100%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{SerializedDensityVolume.cs => SerializedLocalVolumetricFog.cs} (95%) rename com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/{SerializedDensityVolume.cs.meta => SerializedLocalVolumetricFog.cs.meta} (100%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DebugDensityVolumeAtlas.shader => DebugLocalVolumetricFogAtlas.shader} (97%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DebugDensityVolumeAtlas.shader.meta => DebugLocalVolumetricFogAtlas.shader.meta} (100%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DensityVolume.Migration.cs => LocalVolumetricFog.Migration.cs} (79%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DensityVolume.Migration.cs.meta => LocalVolumetricFog.Migration.cs.meta} (100%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DensityVolume.cs => LocalVolumetricFog.cs} (60%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DensityVolume.cs.meta => LocalVolumetricFog.cs.meta} (100%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DensityVolumeManager.cs => LocalVolumetricFogManager.cs} (80%) rename com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/{DensityVolumeManager.cs.meta => LocalVolumetricFogManager.cs.meta} (100%) diff --git a/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs b/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs index 09fe8f7de8b..4c48c6a59e8 100644 --- a/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs +++ b/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -8,6 +9,7 @@ using UnityEngine; using UnityEngine.Rendering; using UnityEditor.AnimatedValues; +using Component = UnityEngine.Component; namespace UnityEditor.Rendering { @@ -780,6 +782,38 @@ public static void DrawEnumPopup(SerializedProperty property, System.Type type, EditorGUI.showMixedValue = false; } + static Dictionary s_TrEnumDescriptionCache = new Dictionary(); + + /// Obtains the names of an enum taking into account the + public static GUIContent[] TrEnumFriendlyNames() + { + var enumType = typeof(T); + if (!s_TrEnumDescriptionCache.TryGetValue(enumType, out var enumFriendlyValues)) + { + enumFriendlyValues = CoreUtils.GetEnumFriendlyNames() + .Select(guiContent => EditorGUIUtility.TrTextContent(ObjectNames.NicifyVariableName(guiContent.text), guiContent.tooltip)) + .ToArray(); + + // Update the enums cache + s_TrEnumDescriptionCache[enumType] = enumFriendlyValues; + } + + return enumFriendlyValues; + } + + /// Draw a popup for an enum with values decorated with + /// the label + /// The data displayed + public static void DrawFriendlyNamesEnumPopup(GUIContent label, SerializedProperty property) + { + using (var checkScope = new EditorGUI.ChangeCheckScope()) + { + int newValue = EditorGUILayout.Popup(label, property.enumValueIndex, TrEnumFriendlyNames()); + if (checkScope.changed) + property.enumValueIndex = newValue; + } + } + /// Remove the keywords on the given materials /// The material to edit public static void RemoveMaterialKeywords(Material material) diff --git a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs index 146269ea85e..41f958991df 100644 --- a/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs @@ -3,7 +3,7 @@ using UnityEditor.Rendering; using UnityEditorInternal; -// TODO(Nicholas): deduplicate with DensityVolumeUI.Drawer.cs. +// TODO(Nicholas): deduplicate with LocalVolumetricFogUI.Drawer.cs. namespace UnityEditor.Rendering { using CED = CoreEditorDrawer; diff --git a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs index 8c446925204..d7daa2fe263 100644 --- a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs +++ b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using UnityEngine.Experimental.Rendering; @@ -1289,5 +1290,28 @@ public static void DrawRendererList(ScriptableRenderContext renderContext, Comma renderContext.DrawRenderers(rendererList.cullingResult, ref rendererList.drawSettings, ref rendererList.filteringSettings, ref renderStateBlock); } } + + static Dictionary s_EnumDescriptionCache = new Dictionary(); + + /// Obtains the names of an enum taking into account the + public static GUIContent[] GetEnumFriendlyNames() + { + var enumType = typeof(T); + if (!s_EnumDescriptionCache.TryGetValue(enumType, out var enumFriendlyValues)) + { + enumFriendlyValues = ((from object value in Enum.GetValues(enumType) + let attribute = enumType.GetMember(value.ToString())[0] + .GetCustomAttributes(typeof(DescriptionAttribute), false) + .FirstOrDefault() as DescriptionAttribute + select new GUIContent(attribute != null ? attribute.Description : value.ToString()))) + .Distinct() + .ToArray(); + + // Update the enums cache + s_EnumDescriptionCache[enumType] = enumFriendlyValues; + } + + return enumFriendlyValues; + } } } diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md b/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md similarity index 99% rename from com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md rename to com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md index 325a679dee2..9a05680e0fb 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Density-Volume.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md @@ -12,7 +12,7 @@ To create a Local Volumetric Fog, right click in the Hierarchy and select __Volu # Properties -![](Images/DensityVolume1.png) +![](Images/LocalVolumetricFog1.png) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md b/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md index 9a3d68afdd4..88214dedaa4 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md @@ -167,7 +167,7 @@ The **Lighting** panel has tools that you can use to visualize various component | ------------------------------------ | ------------------------------------------------------------ | | **Fullscreen Debug Mode** | Use the drop-down to select a fullscreen lighting effect to debug. For example, you can visualize [Contact Shadows](Override-Contact-Shadows.md), the depth pyramid, and indirect diffuse lighting. | | **Tile/Cluster Debug** | Use the drop-down to select an internal HDRP lighting structure to visualize on screen.
• **None**: Select this option to turn off this debug feature.
• **Tile**: Select this option to show an overlay of each lighting tile, and the number of lights in them.
• **Cluster**: Select this option to show an overlay of each lighting cluster that intersects opaque geometry, and the number of lights in them.
• **Material Feature Variants**: Select this option to show the index of the lighting Shader variant that HDRP uses for a tile. You can find variant descriptions in the *lit.hlsl* file. | -| **- Tile/Cluster Debug By Category** | Use the drop-down to select the Light type that you want to show the Tile/Cluster debug information for. The options include [Light Types](Light-Component.md), [Decals](Decal-Projector.md), and [Local Volumetric Fog](Density-Volume.md).
This property only appears when you select **Tile** or **Cluster** from the **Tile/Cluster Debug** drop-down. | +| **- Tile/Cluster Debug By Category** | Use the drop-down to select the Light type that you want to show the Tile/Cluster debug information for. The options include [Light Types](Light-Component.md), [Decals](Decal-Projector.md), and [Local Volumetric Fog](Local-Volumetric-Fog.md).
This property only appears when you select **Tile** or **Cluster** from the **Tile/Cluster Debug** drop-down. | | **- Cluster Debug Mode** | Use the drop-down to select the visualization mode for the cluster. The options are:
**VisualizeOpaque**: Shows cluster information on opaque geometry.
**VisualizeSlice**: Shows cluster information at a set distance from the camera.
This property only appears when you select **Cluster** from the **Tile/Cluster Debug** drop-down.. | | **- Cluster Distance** | Use this slider to set the distance from the camera at which to display the cluster slice. This property only appears when you select **VisualizeSlice** from the **Cluster Debug Mode** drop-down. | | **Display Sky Reflection** | Enable the checkbox to display an overlay of the cube map that the current sky generates and HDRP uses for lighting. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md index d6a55505d83..92e278f5de4 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md @@ -133,7 +133,7 @@ * [Environment Lighting](Environment-Lighting.md) * [Clouds in HDRP](clouds-in-hdrp.md) * [Atmospheric Scattering](Atmospheric-Scattering.md) - * [Local Volumetric Fog](Density-Volume.md) + * [Local Volumetric Fog](Local-Volumetric-Fog.md) * [Light Layers](Light-Layers.md) * [Shadows](Shadows-in-HDRP.md) * [Shadowmasks](Lighting-Mode-Shadowmask.md) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md index 7fe934ca092..1fafa0f3c44 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2020.1-to-2020.2.md @@ -252,7 +252,7 @@ protected override void Execute(CustomPassContext ctx) { ... } ## Local Volumetric Fog Mask Texture Previously, to convert a 2D flipbook texture to the 3D format Density Mask Textures require, you needed to use the __Local Volumetric Fog Texture Tool__ in the __Window > Rendering__ menu. -From Unity 2020.2, you can now do this conversion directly through the __Texture Importer__. For information on how to use the importer to convert the flipbook texture, see the [Local Volumetric Fog documentation](Density-Volume.md). +From Unity 2020.2, you can now do this conversion directly through the __Texture Importer__. For information on how to use the importer to convert the flipbook texture, see the [Local Volumetric Fog documentation](Local-Volumetric-Fog.md). ## Diffusion Profiles diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs similarity index 90% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs index d6529e6b2a9..00428f4ac83 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs @@ -6,8 +6,8 @@ namespace UnityEditor.Rendering.HighDefinition { [CanEditMultipleObjects] - [CustomEditor(typeof(DensityVolume))] - class DensityVolumeEditor : Editor + [CustomEditor(typeof(LocalVolumetricFog))] + class LocalVolumetricFogEditor : Editor { internal const EditMode.SceneViewEditMode k_EditShape = EditMode.SceneViewEditMode.ReflectionProbeBox; internal const EditMode.SceneViewEditMode k_EditBlend = EditMode.SceneViewEditMode.GridBox; @@ -15,20 +15,20 @@ class DensityVolumeEditor : Editor static HierarchicalBox s_ShapeBox; internal static HierarchicalBox s_BlendBox; - SerializedDensityVolume m_SerializedDensityVolume; + SerializedLocalVolumetricFog m_SerializedLocalVolumetricFog; void OnEnable() { - m_SerializedDensityVolume = new SerializedDensityVolume(serializedObject); + m_SerializedLocalVolumetricFog = new SerializedLocalVolumetricFog(serializedObject); if (s_ShapeBox == null || s_ShapeBox.Equals(null)) { - s_ShapeBox = new HierarchicalBox(DensityVolumeUI.Styles.k_GizmoColorBase, DensityVolumeUI.Styles.k_BaseHandlesColor); + s_ShapeBox = new HierarchicalBox(LocalVolumetricFogUI.Styles.k_GizmoColorBase, LocalVolumetricFogUI.Styles.k_BaseHandlesColor); s_ShapeBox.monoHandle = false; } if (s_BlendBox == null || s_BlendBox.Equals(null)) { - s_BlendBox = new HierarchicalBox(DensityVolumeUI.Styles.k_GizmoColorBase, InfluenceVolumeUI.k_HandlesColor, parent: s_ShapeBox); + s_BlendBox = new HierarchicalBox(LocalVolumetricFogUI.Styles.k_GizmoColorBase, InfluenceVolumeUI.k_HandlesColor, parent: s_ShapeBox); } } @@ -36,12 +36,12 @@ public override void OnInspectorGUI() { serializedObject.Update(); - DensityVolumeUI.Inspector.Draw(m_SerializedDensityVolume, this); + LocalVolumetricFogUI.Inspector.Draw(m_SerializedLocalVolumetricFog, this); - m_SerializedDensityVolume.Apply(); + m_SerializedLocalVolumetricFog.Apply(); } - static Vector3 CenterBlendLocalPosition(DensityVolume densityVolume) + static Vector3 CenterBlendLocalPosition(LocalVolumetricFog densityVolume) { if (densityVolume.parameters.m_EditorAdvancedFade) { @@ -61,7 +61,7 @@ static Vector3 CenterBlendLocalPosition(DensityVolume densityVolume) return Vector3.zero; } - static Vector3 BlendSize(DensityVolume densityVolume) + static Vector3 BlendSize(LocalVolumetricFog densityVolume) { Vector3 size = densityVolume.parameters.size; if (densityVolume.parameters.m_EditorAdvancedFade) @@ -77,7 +77,7 @@ static Vector3 BlendSize(DensityVolume densityVolume) } [DrawGizmo(GizmoType.Selected | GizmoType.Active)] - static void DrawGizmosSelected(DensityVolume densityVolume, GizmoType gizmoType) + static void DrawGizmosSelected(LocalVolumetricFog densityVolume, GizmoType gizmoType) { if (s_BlendBox == null || s_BlendBox.Equals(null) || s_ShapeBox == null || s_ShapeBox.Equals(null)) @@ -102,11 +102,11 @@ static void DrawGizmosSelected(DensityVolume densityVolume, GizmoType gizmoType) void OnSceneGUI() { - //Note: for each handle to be independent when multi-selecting DensityVolume, - //We cannot rely hereon SerializedDensityVolume which is the collection of - //selected DensityVolume. Thus code is almost the same of the UI. + //Note: for each handle to be independent when multi-selecting LocalVolumetricFog, + //We cannot rely hereon SerializedLocalVolumetricFog which is the collection of + //selected LocalVolumetricFog. Thus code is almost the same of the UI. - DensityVolume densityVolume = target as DensityVolume; + LocalVolumetricFog densityVolume = target as LocalVolumetricFog; switch (EditMode.editMode) { diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs.meta similarity index 83% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs.meta rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs.meta index 6e670868c6a..dbb0cc211f1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeEditor.cs.meta +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ffb0e1717cab7a40ad62507bc855683 +guid: 41f29ba1c7ed90c4bb3d2eb4e94fbaf6 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Drawer.cs similarity index 91% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Drawer.cs index 1f41de23d66..b622ae8ac8c 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Drawer.cs @@ -4,9 +4,9 @@ namespace UnityEditor.Rendering.HighDefinition { - using CED = CoreEditorDrawer; + using CED = CoreEditorDrawer; - static partial class DensityVolumeUI + static partial class LocalVolumetricFogUI { // also used for AdvancedModes [System.Flags] @@ -16,7 +16,7 @@ enum Expandable DensityMaskTexture = 1 << 1 } - readonly static ExpandedState k_ExpandedState = new ExpandedState(Expandable.Volume | Expandable.DensityMaskTexture, "HDRP"); + readonly static ExpandedState k_ExpandedState = new ExpandedState(Expandable.Volume | Expandable.DensityMaskTexture, "HDRP"); public static readonly CED.IDrawer Inspector = CED.Group( CED.Group( @@ -33,11 +33,11 @@ enum Expandable ) ); - static void Drawer_ToolBar(SerializedDensityVolume serialized, Editor owner) + static void Drawer_ToolBar(SerializedLocalVolumetricFog serialized, Editor owner) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); - EditMode.DoInspectorToolbar(new[] { DensityVolumeEditor.k_EditShape, DensityVolumeEditor.k_EditBlend }, Styles.s_Toolbar_Contents, () => + EditMode.DoInspectorToolbar(new[] { LocalVolumetricFogEditor.k_EditShape, LocalVolumetricFogEditor.k_EditBlend }, Styles.s_Toolbar_Contents, () => { var bounds = new Bounds(); foreach (Component targetObject in owner.targets) @@ -51,13 +51,13 @@ static void Drawer_ToolBar(SerializedDensityVolume serialized, Editor owner) GUILayout.EndHorizontal(); } - static void Drawer_PrimarySettings(SerializedDensityVolume serialized, Editor owner) + static void Drawer_PrimarySettings(SerializedLocalVolumetricFog serialized, Editor owner) { EditorGUILayout.PropertyField(serialized.albedo, Styles.s_AlbedoLabel); EditorGUILayout.PropertyField(serialized.meanFreePath, Styles.s_MeanFreePathLabel); } - static void Drawer_VolumeContent(SerializedDensityVolume serialized, Editor owner) + static void Drawer_VolumeContent(SerializedLocalVolumetricFog serialized, Editor owner) { //keep previous data as value are stored in percent Vector3 previousSize = serialized.size.vector3Value; @@ -177,7 +177,7 @@ static void Drawer_VolumeContent(SerializedDensityVolume serialized, Editor owne } } - static void Drawer_DensityMaskTextureContent(SerializedDensityVolume serialized, Editor owner) + static void Drawer_DensityMaskTextureContent(SerializedLocalVolumetricFog serialized, Editor owner) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serialized.volumeTexture, Styles.s_VolumeTextureLabel); diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Drawer.cs.meta similarity index 100% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Drawer.cs.meta rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Drawer.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Skin.cs similarity index 98% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Skin.cs index 3fb68960244..a222e1e43ce 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Skin.cs @@ -2,7 +2,7 @@ namespace UnityEditor.Rendering.HighDefinition { - static partial class DensityVolumeUI + static partial class LocalVolumetricFogUI { internal static class Styles { diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Skin.cs.meta similarity index 100% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/DensityVolumeUI.Skin.cs.meta rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogUI.Skin.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedDensityVolume.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedLocalVolumetricFog.cs similarity index 95% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedDensityVolume.cs rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedLocalVolumetricFog.cs index 60915799fc8..ebc2f4e7fa0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedDensityVolume.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedLocalVolumetricFog.cs @@ -3,7 +3,7 @@ namespace UnityEditor.Rendering.HighDefinition { - class SerializedDensityVolume + class SerializedLocalVolumetricFog { public SerializedProperty densityParams; public SerializedProperty albedo; @@ -30,7 +30,7 @@ class SerializedDensityVolume SerializedObject m_SerializedObject; - public SerializedDensityVolume(SerializedObject serializedObject) + public SerializedLocalVolumetricFog(SerializedObject serializedObject) { m_SerializedObject = serializedObject; @@ -58,7 +58,7 @@ public SerializedDensityVolume(SerializedObject serializedObject) distanceFadeStart = densityParams.FindPropertyRelative("distanceFadeStart"); distanceFadeEnd = densityParams.FindPropertyRelative("distanceFadeEnd"); - falloffMode = densityParams.FindPropertyRelative(nameof(DensityVolumeArtistParameters.falloffMode)); + falloffMode = densityParams.FindPropertyRelative(nameof(LocalVolumetricFogArtistParameters.falloffMode)); } public void Apply() diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedDensityVolume.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedLocalVolumetricFog.cs.meta similarity index 100% rename from com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedDensityVolume.cs.meta rename to com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/SerializedLocalVolumetricFog.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs index 6beeccf67d5..0014e0094ea 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs @@ -6,13 +6,13 @@ namespace UnityEditor.Rendering.HighDefinition { class VolumetricMenuItems { - [MenuItem("GameObject/Local Volumetric Fog", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.gameObjectMenuPriority + 2)] - static void CreateDensityVolumeGameObject(MenuCommand menuCommand) + [MenuItem("GameObject/Local Volumetric Fog", priority = CoreUtils.Priorities.gameObjectMenuPriority + 2)] + static void CreateLocalVolumetricFogGameObject(MenuCommand menuCommand) { var parent = menuCommand.context as GameObject; var densityVolume = CoreEditorUtils.CreateGameObject("Local Volumetric Fog", parent); - densityVolume.AddComponent(); + densityVolume.AddComponent(); } [MenuItem("GameObject/Light/Experimental/Probe Volume", priority = CoreUtils.Sections.section8)] diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 22538d9e5e0..207814b3a74 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -134,7 +134,7 @@ public class GeneralSection public static readonly GUIContent supportSSGIContent = EditorGUIUtility.TrTextContent("Screen Space Global Illumination", "When enabled, HDRP allocates memory for processing screen space global illumination (SSGI). This allows you to use SSGI in your Unity Project."); public static readonly GUIContent supportedSSSContent = EditorGUIUtility.TrTextContent("Subsurface Scattering", "When enabled, HDRP allocates memory for processing subsurface scattering (SSS). This allows you to use SSS in your Unity Project."); public static readonly GUIContent sssSampleBudget = EditorGUIUtility.TrTextContent("Sample Budget", "Maximum number of samples the Subsurface Scattering algorithm is allowed to take."); - public static readonly GUIContent supportVolumetricContent = EditorGUIUtility.TrTextContent("Volumetrics", "When enabled, HDRP allocates Shader variants and memory for volumetric effects. This allows you to use volumetric lighting and fog in your Unity Project."); + public static readonly GUIContent supportVolumetricFogContent = EditorGUIUtility.TrTextContent("Volumetric Fog", "When enabled, HDRP allocates Shader variants and memory for volumetric effects. This allows you to use volumetric lighting and fog in your Unity Project."); public static readonly GUIContent supportVolumetricCloudsContent = EditorGUIUtility.TrTextContent("Volumetric Clouds", "When enabled, HDRP allocates memory for processing volumetric clouds. This allows you to use volumetric clouds in your Unity Project."); public static readonly GUIContent volumetricResolutionContent = EditorGUIUtility.TrTextContent("High Quality ", "When enabled, HDRP increases the resolution of volumetric lighting buffers. Warning: There is a high performance cost, do not enable on consoles."); public static readonly GUIContent supportLightLayerContent = EditorGUIUtility.TrTextContent("Light Layers", "When enabled, HDRP allocates memory for processing Light Layers. This allows you to use Light Layers in your Unity Project. For deferred rendering, this allocation includes an extra render target in memory and extra cost."); @@ -180,8 +180,8 @@ public class GeneralSection public static readonly GUIContent probeVolumeMemoryBudget = EditorGUIUtility.TrTextContent("Memory Budget", "Determines the width and height of the textures used to store GI data from probes. Note that the textures also have a fixed depth dimension."); 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; public static readonly GUIContent probeVolumeSHBands = EditorGUIUtility.TrTextContent("SH Bands", "Determines up to what SH bands the Probe Volume will use. Chosing L2 will lead to better quality, but also higher memory and runtime cost."); - public static readonly GUIContent maxDensityVolumeSizeStyle = EditorGUIUtility.TrTextContent("Max Local Volumetric Fog Size", "Specifies the maximum size for the individual 3D Local Volumetric Fog texture that HDRP uses for Local Volumetric Fog. This settings will affect your memory consumption."); - public static readonly GUIContent maxDensityVolumesOnScreenStyle = EditorGUIUtility.TrTextContent("Max Local Volumetric Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); + public static readonly GUIContent maxLocalVolumetricFogSizeStyle = EditorGUIUtility.TrTextContent("Max Size", "Specifies the maximum size for the individual 3D Local Volumetric Fog texture that HDRP uses for Local Volumetric Fog. This settings will affect your memory consumption."); + public static readonly GUIContent maxLocalVolumetricFogsOnScreenStyle = EditorGUIUtility.TrTextContent("Max Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); public const string probeVolumeNotEnabled = "Warning: Probe Volumes are not enabled.\nIt is an highly experimental feature and 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; @@ -288,7 +288,7 @@ public class GeneralSection { supportSSRContent , memoryDrawback }, { supportSSAOContent , memoryDrawback }, { supportedSSSContent , memoryDrawback }, - { supportVolumetricContent , memoryDrawback }, + { supportVolumetricFogContent , memoryDrawback }, //k_SupportLightLayerContent is special case handled separately { MSAASampleCountContent , memoryDrawback }, { supportDecalContent , string.Format("{0}, {1}", memoryDrawback, lotDBufferDrawback) }, diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs index 33f7d36598e..a7b01775331 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs @@ -1,8 +1,8 @@ +using System.Text; using UnityEngine; +using UnityEngine.Experimental.Rendering; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; -using System.Text; -using UnityEngine.Experimental.Rendering; using static UnityEngine.Rendering.HighDefinition.RenderPipelineSettings; namespace UnityEditor.Rendering.HighDefinition @@ -88,7 +88,6 @@ static HDRenderPipelineUI() CED.FoldoutGroup(Styles.lightingSectionTitle, Expandable.Lighting, k_ExpandedState, CED.Group(GroupOption.Indent, Drawer_SectionLightingUnsorted), CED.FoldoutGroup(Styles.volumetricSubTitle, Expandable.Volumetric, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout, Drawer_Volumetric), - CED.FoldoutGroup(Styles.volumetricCloudsSubTitle, Expandable.VolumetricClouds, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout, Drawer_VolumetricClouds), CED.FoldoutGroup(Styles.probeVolumeSubTitle, Expandable.ProbeVolume, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout, Drawer_SectionProbeVolume), CED.FoldoutGroup(Styles.cookiesSubTitle, Expandable.Cookie, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout, Drawer_SectionCookies), CED.FoldoutGroup(Styles.reflectionsSubTitle, Expandable.Reflection, k_ExpandedState, FoldoutOption.Indent | FoldoutOption.SubFoldout, Drawer_SectionReflection), @@ -242,26 +241,26 @@ static void Drawer_SectionGeneral(SerializedHDRenderPipelineAsset serialized, Ed static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor owner) { - EditorGUILayout.PropertyField(serialized.renderPipelineSettings.supportVolumetrics, Styles.supportVolumetricContent); + EditorGUILayout.PropertyField(serialized.renderPipelineSettings.supportVolumetrics, Styles.supportVolumetricFogContent); using (new EditorGUI.DisabledGroupScope(!serialized.renderPipelineSettings.supportVolumetrics.boolValue)) { + EditorGUI.indentLevel++; var lightSettings = serialized.renderPipelineSettings.lightLoopSettings; - EditorGUILayout.PropertyField(lightSettings.maxDensityVolumeSize, Styles.maxDensityVolumeSizeStyle); - EditorGUILayout.PropertyField(lightSettings.maxDensityVolumesOnScreen, Styles.maxDensityVolumesOnScreenStyle); - // Clamp values - lightSettings.maxDensityVolumeSize.intValue = Mathf.Clamp(lightSettings.maxDensityVolumeSize.intValue, (int)DensityVolumeResolution.Resolution32, (int)DensityVolumeResolution.Resolution256); - lightSettings.maxDensityVolumesOnScreen.intValue = Mathf.Clamp(lightSettings.maxDensityVolumesOnScreen.intValue, 1, HDRenderPipeline.k_MaxVisibleDensityVolumeCount); + CoreEditorUtils.DrawFriendlyNamesEnumPopup(Styles.maxLocalVolumetricFogSizeStyle, lightSettings.maxLocalVolumetricFogSize); - if (lightSettings.maxDensityVolumeSize.hasMultipleDifferentValues || lightSettings.maxDensityVolumesOnScreen.hasMultipleDifferentValues) + EditorGUILayout.PropertyField(lightSettings.maxLocalVolumetricFogsOnScreen, Styles.maxLocalVolumetricFogsOnScreenStyle); + lightSettings.maxLocalVolumetricFogsOnScreen.intValue = Mathf.Clamp(lightSettings.maxLocalVolumetricFogsOnScreen.intValue, 1, HDRenderPipeline.k_MaxVisibleLocalVolumetricFogCount); + + if (lightSettings.maxLocalVolumetricFogSize.hasMultipleDifferentValues || lightSettings.maxLocalVolumetricFogsOnScreen.hasMultipleDifferentValues) EditorGUILayout.HelpBox(Styles.multipleDifferenteValueMessage, MessageType.Info); else { long currentCache = Texture3DAtlas.GetApproxCacheSizeInByte( - lightSettings.maxDensityVolumeSize.intValue, - lightSettings.maxDensityVolumesOnScreen.intValue, - DensityVolumeManager.densityVolumeAtlasFormat, + lightSettings.maxLocalVolumetricFogSize.intValue, + lightSettings.maxLocalVolumetricFogsOnScreen.intValue, + LocalVolumetricFogManager.densityVolumeAtlasFormat, true ); @@ -269,9 +268,9 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor { int count = Texture3DAtlas.GetMaxElementCountForWeightInByte( HDRenderPipeline.k_MaxCacheSize, - lightSettings.maxDensityVolumeSize.intValue, - lightSettings.maxDensityVolumesOnScreen.intValue, - DensityVolumeManager.densityVolumeAtlasFormat, + lightSettings.maxLocalVolumetricFogSize.intValue, + lightSettings.maxLocalVolumetricFogsOnScreen.intValue, + LocalVolumetricFogManager.densityVolumeAtlasFormat, true ); string message = string.Format(Styles.cacheErrorFormat, HDEditorUtils.HumanizeWeight(currentCache), count); @@ -283,11 +282,9 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor EditorGUILayout.HelpBox(message, MessageType.Info); } } + EditorGUI.indentLevel--; } - } - static void Drawer_VolumetricClouds(SerializedHDRenderPipelineAsset serialized, Editor owner) - { EditorGUILayout.PropertyField(serialized.renderPipelineSettings.supportVolumetricClouds, Styles.supportVolumetricCloudsContent); } @@ -1310,7 +1307,7 @@ static void SupportedSettingsInfoSection(SerializedHDRenderPipelineAsset seriali AppendSupport(builder, serialized.renderPipelineSettings.supportSSR, Styles.supportSSRContent); AppendSupport(builder, serialized.renderPipelineSettings.supportSSAO, Styles.supportSSAOContent); AppendSupport(builder, serialized.renderPipelineSettings.supportSubsurfaceScattering, Styles.supportedSSSContent); - AppendSupport(builder, serialized.renderPipelineSettings.supportVolumetrics, Styles.supportVolumetricContent); + AppendSupport(builder, serialized.renderPipelineSettings.supportVolumetrics, Styles.supportVolumetricFogContent); if (serialized.renderPipelineSettings.supportLightLayers.hasMultipleDifferentValues) builder.AppendLine().AppendFormat(supportedFormaterMultipleValue, Styles.supportLightLayerContent.text); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs index d6e9dc8a54e..b589742e5a1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs @@ -29,8 +29,8 @@ class SerializedGlobalLightLoopSettings public SerializedProperty maxDecalsOnScreen; public SerializedProperty maxPlanarReflectionOnScreen; public SerializedProperty maxLightsPerClusterCell; - public SerializedProperty maxDensityVolumeSize; - public SerializedProperty maxDensityVolumesOnScreen; + public SerializedProperty maxLocalVolumetricFogSize; + public SerializedProperty maxLocalVolumetricFogsOnScreen; public SerializedGlobalLightLoopSettings(SerializedProperty root) { @@ -63,8 +63,8 @@ public SerializedGlobalLightLoopSettings(SerializedProperty root) maxPlanarReflectionOnScreen = root.Find((GlobalLightLoopSettings s) => s.maxPlanarReflectionOnScreen); maxLightsPerClusterCell = root.Find((GlobalLightLoopSettings s) => s.maxLightsPerClusterCell); - maxDensityVolumeSize = root.Find((GlobalLightLoopSettings s) => s.maxDensityVolumeSize); - maxDensityVolumesOnScreen = root.Find((GlobalLightLoopSettings s) => s.maxDensityVolumesOnScreen); + maxLocalVolumetricFogSize = root.Find((GlobalLightLoopSettings s) => s.maxLocalVolumetricFogSize); + maxLocalVolumetricFogsOnScreen = root.Find((GlobalLightLoopSettings s) => s.maxLocalVolumetricFogsOnScreen); } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index a69eb89ec36..ace4c00249a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -1416,26 +1416,26 @@ void RegisterLightingDebug() }); } - list.Add(new DebugUI.BoolField { displayName = "Display Local Volumetric Fog Atlas", getter = () => data.lightingDebugSettings.displayDensityVolumeAtlas, setter = value => data.lightingDebugSettings.displayDensityVolumeAtlas = value, onValueChanged = RefreshLightingDebug}); - if (data.lightingDebugSettings.displayDensityVolumeAtlas) + list.Add(new DebugUI.BoolField { displayName = "Display Local Volumetric Fog Atlas", getter = () => data.lightingDebugSettings.displayLocalVolumetricFogAtlas, setter = value => data.lightingDebugSettings.displayLocalVolumetricFogAtlas = value, onValueChanged = RefreshLightingDebug}); + if (data.lightingDebugSettings.displayLocalVolumetricFogAtlas) { list.Add(new DebugUI.Container { children = { - new DebugUI.UIntField { displayName = "Slice", getter = () => data.lightingDebugSettings.densityVolumeAtlasSlice, setter = value => data.lightingDebugSettings.densityVolumeAtlasSlice = value, min = () => 0, max = () => GetDensityVolumeSliceCount()}, + new DebugUI.UIntField { displayName = "Slice", getter = () => data.lightingDebugSettings.densityVolumeAtlasSlice, setter = value => data.lightingDebugSettings.densityVolumeAtlasSlice = value, min = () => 0, max = () => GetLocalVolumetricFogSliceCount()}, new DebugUI.BoolField { displayName = "Use Selection", getter = () => data.lightingDebugSettings.densityVolumeUseSelection, setter = value => data.lightingDebugSettings.densityVolumeUseSelection = value, flags = DebugUI.Flags.EditorOnly, onValueChanged = RefreshLightingDebug}, } }); } - uint GetDensityVolumeSliceCount() + uint GetLocalVolumetricFogSliceCount() { #if UNITY_EDITOR if (data.lightingDebugSettings.densityVolumeUseSelection) { var selectedGO = UnityEditor.Selection.activeGameObject; - if (selectedGO != null && selectedGO.TryGetComponent(out var densityVolume)) + if (selectedGO != null && selectedGO.TryGetComponent(out var densityVolume)) { var texture = densityVolume.parameters.volumeMask; @@ -1446,7 +1446,7 @@ uint GetDensityVolumeSliceCount() } else #endif - return (uint)DensityVolumeManager.manager.volumeAtlas.GetAtlas().volumeDepth - 1; + return (uint)LocalVolumetricFogManager.manager.volumeAtlas.GetAtlas().volumeDepth - 1; } list.Add(new DebugUI.FloatField { displayName = "Debug Overlay Screen Ratio", getter = () => data.debugOverlayRatio, setter = v => data.debugOverlayRatio = v, min = () => 0.1f, max = () => 1f}); @@ -1891,16 +1891,7 @@ void FillFullScreenDebugEnum(ref GUIContent[] strings, ref int[] values, FullScr void FillTileClusterDebugEnum() { - string[] names = Enum.GetNames(typeof(TileClusterCategoryDebug)); - for (int i = 0; i < names.Length; ++i) - { - var n = names[i]; - names[i] = n.Replace("Environment", "ReflectionProbes"); - } - - s_TileAndClusterDebugStrings = names - .Select(t => new GUIContent(t)) - .ToArray(); + s_TileAndClusterDebugStrings = CoreUtils.GetEnumFriendlyNames(); s_TileAndClusterDebugValues = (int[])Enum.GetValues(typeof(TileClusterCategoryDebug)); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs index 31a1ed95699..beda57bde92 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs @@ -1,4 +1,5 @@ using System; +using UnityEngine.Serialization; namespace UnityEngine.Rendering.HighDefinition { @@ -353,7 +354,15 @@ public bool IsDebugDisplayEnabled() public bool showReflectionProbe = true; /// Display the Local Volumetric Fog atlas. - public bool displayDensityVolumeAtlas = false; + [Obsolete("Use displayLocalVolumetricFogAtlas instead", false)] + public bool displayDensityVolumeAtlas + { + get => displayLocalVolumetricFogAtlas; + set => displayLocalVolumetricFogAtlas = value; + } + + /// Display the Local Volumetric Fog atlas. + public bool displayLocalVolumetricFogAtlas = false; /// Local Volumetric Fog atlas slice. public uint densityVolumeAtlasSlice = 0; /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/Fog.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/Fog.cs index 42825e703ab..6db40fde769 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/Fog.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/Fog.cs @@ -220,8 +220,8 @@ void UpdateShaderVariablesGlobalCBFogParameters(ref ShaderVariablesGlobal cb, HD cb._FogColor = new Color(fogColor.r, fogColor.g, fogColor.b, 0.0f); cb._MipFogParameters = new Vector4(mipFogNear.value, mipFogFar.value, mipFogMaxMip.value, 0.0f); - DensityVolumeArtistParameters param = new DensityVolumeArtistParameters(albedo.value, meanFreePath.value, anisotropy.value); - DensityVolumeEngineData data = param.ConvertToEngineData(); + LocalVolumetricFogArtistParameters param = new LocalVolumetricFogArtistParameters(albedo.value, meanFreePath.value, anisotropy.value); + LocalVolumetricFogEngineData data = param.ConvertToEngineData(); cb._HeightFogBaseScattering = data.scattering; cb._HeightFogBaseExtinction = data.extinction; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs index 1cd5e3ffd9f..6b75dd04360 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using UnityEngine.Serialization; using UnityEngine.Experimental.Rendering; @@ -117,6 +118,7 @@ public enum CubeCookieResolution /// Possible values for one element of the Local Volumetric Fog atlas. /// [Serializable] + [Obsolete("DensityVolumeResolution has been deprecated (UnityUpgradable) -> LocalVolumetricFogResolution", false)] public enum DensityVolumeResolution { /// 3D volume of 32x32x32 voxels. @@ -129,6 +131,26 @@ public enum DensityVolumeResolution Resolution256 = 256, } + /// + /// Possible values for one element of the Local Volumetric Fog atlas. + /// + [Serializable] + public enum LocalVolumetricFogResolution + { + /// 3D volume of 32x32x32 voxels. + [Description("32x32x32")] + Resolution32 = 32, + /// 3D volume of 64x64x64 voxels. + [Description("64x64x64")] + Resolution64 = 64, + /// 3D volume of 128x128x128 voxels. + [Description("128x128x128")] + Resolution128 = 128, + /// 3D volume of 256x256x256 voxels. + [Description("256x256x256")] + Resolution256 = 256, + } + /// /// Global Light Loop Settings. /// @@ -164,8 +186,8 @@ public struct GlobalLightLoopSettings maxDecalsOnScreen = 512, maxPlanarReflectionOnScreen = 16, maxLightsPerClusterCell = 8, - maxDensityVolumeSize = DensityVolumeResolution.Resolution32, - maxDensityVolumesOnScreen = 64, // 8MB texture atlas allocated by default + maxLocalVolumetricFogSize = LocalVolumetricFogResolution.Resolution32, + maxLocalVolumetricFogsOnScreen = 64, // 8MB texture atlas allocated by default }; /// Cookie atlas resolution. @@ -219,8 +241,26 @@ public struct GlobalLightLoopSettings public int maxLightsPerClusterCell; /// Maximum size of one Local Volumetric Fog texture. - public DensityVolumeResolution maxDensityVolumeSize; + [Obsolete("Use maxLocalVolumetricFogSize instead", false)] + public DensityVolumeResolution maxDensityVolumeSize + { + get => (DensityVolumeResolution) maxLocalVolumetricFogSize; + set => maxLocalVolumetricFogSize = (LocalVolumetricFogResolution) value; + } + + /// Maximum number of Local Volumetric Fog at the same time on screen. + [Obsolete("Use maxLocalVolumetricFogsOnScreen instead", false)] + public int maxDensityVolumesOnScreen + { + get => maxLocalVolumetricFogsOnScreen; + set => maxLocalVolumetricFogsOnScreen = value; + } + + /// Maximum size of one Local Volumetric Fog texture. + public LocalVolumetricFogResolution maxLocalVolumetricFogSize; + /// Maximum number of Local Volumetric Fog at the same time on screen. - public int maxDensityVolumesOnScreen; + [Range(1, 512)] + public int maxLocalVolumetricFogsOnScreen; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 00c14d8644d..a00c67a121b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using UnityEngine.Experimental.Rendering; namespace UnityEngine.Rendering.HighDefinition @@ -66,7 +67,7 @@ internal enum LightCategory Area, Env, Decal, - DensityVolume, // WARNING: Currently lightlistbuild.compute assumes Local Volumetric Fog is the last element in the LightCategory enum. Do not append new LightCategory types after DensityVolume. TODO: Fix .compute code. + LocalVolumetricFog, // WARNING: Currently lightlistbuild.compute assumes Local Volumetric Fog is the last element in the LightCategory enum. Do not append new LightCategory types after LocalVolumetricFog. TODO: Fix .compute code. Count } @@ -203,21 +204,32 @@ public enum TileClusterCategoryDebug : int /// Area lights. Area = 2, /// Area and punctual lights. + [Description("Area and Punctual")] AreaAndPunctual = 3, /// Environment lights. + [Description("Reflection Probes")] Environment = 4, /// Environment and punctual lights. + [Description("Reflection Probes and Punctual")] EnvironmentAndPunctual = 5, /// Environment and area lights. + [Description("Reflection Probes and Area")] EnvironmentAndArea = 6, /// All lights. + [Description("Reflection Probes, Area and Punctual")] EnvironmentAndAreaAndPunctual = 7, /// Probe Volumes. + [Description("Probe Volumes")] ProbeVolumes = 8, /// Decals. Decal = 16, /// Local Volumetric Fog. - DensityVolumes = 32 + [Obsolete("Use LocalVolumetricFogs", false)] + [Description("Local Volumetric Fogs")] + DensityVolumes = 32, + + [Description("Local Volumetric Fogs")] + LocalVolumetricFogs = 32 }; [GenerateHLSL(needAccessors = false, generateCBuffer = true)] @@ -243,7 +255,7 @@ unsafe struct ShaderVariablesLightList public uint _EnvLightIndexShift; public uint _DecalIndexShift; - public uint _DensityVolumeIndexShift; + public uint _LocalVolumetricFogIndexShift; public uint _Pad0_SVLL; public uint _Pad1_SVLL; public uint _Pad2_SVLL; @@ -529,7 +541,7 @@ public void Allocate() internal LightList m_lightList; int m_TotalLightCount = 0; - int m_DensityVolumeCount = 0; + int m_LocalVolumetricFogCount = 0; bool m_EnableBakeShadowMask = false; // Track if any light require shadow mask. In this case we will need to enable the keyword shadow mask ComputeShader buildScreenAABBShader { get { return defaultResources.shaders.buildScreenAABBCS; } } @@ -2561,7 +2573,7 @@ void PrepareGPUProbeData(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu // Return true if BakedShadowMask are enabled bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cullResults, - HDProbeCullingResults hdProbeCullingResults, DensityVolumeList densityVolumes, DebugDisplaySettings debugDisplaySettings, AOVRequestData aovRequest) + HDProbeCullingResults hdProbeCullingResults, LocalVolumetricFogList densityVolumes, DebugDisplaySettings debugDisplaySettings, AOVRequestData aovRequest) { var debugLightFilter = debugDisplaySettings.GetDebugLightFilterMode(); var hasDebugLightFilter = debugLightFilter != DebugLightFilterMode.None; @@ -2644,7 +2656,7 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu } // Inject Local Volumetric Fog into the clustered data structure for efficient look up. - m_DensityVolumeCount = densityVolumes.bounds != null ? densityVolumes.bounds.Count : 0; + m_LocalVolumetricFogCount = densityVolumes.bounds != null ? densityVolumes.bounds.Count : 0; for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex) { @@ -2656,17 +2668,17 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu worldToViewCR.SetColumn(3, new Vector4(0, 0, 0, 1)); } - for (int i = 0, n = m_DensityVolumeCount; i < n; i++) + for (int i = 0, n = m_LocalVolumetricFogCount; i < n; i++) { // Local Volumetric Fog are not lights and therefore should not affect light classification. LightFeatureFlags featureFlags = 0; - CreateBoxVolumeDataAndBound(densityVolumes.bounds[i], LightCategory.DensityVolume, featureFlags, worldToViewCR, 0.0f, out LightVolumeData volumeData, out SFiniteLightBound bound); + CreateBoxVolumeDataAndBound(densityVolumes.bounds[i], LightCategory.LocalVolumetricFog, featureFlags, worldToViewCR, 0.0f, out LightVolumeData volumeData, out SFiniteLightBound bound); m_lightList.lightsPerView[viewIndex].lightVolumes.Add(volumeData); m_lightList.lightsPerView[viewIndex].bounds.Add(bound); } } - m_TotalLightCount = m_lightList.lights.Count + m_lightList.envLights.Count + decalDatasCount + m_DensityVolumeCount; + m_TotalLightCount = m_lightList.lights.Count + m_lightList.envLights.Count + decalDatasCount + m_LocalVolumetricFogCount; Debug.Assert(m_TotalLightCount == m_lightList.lightsPerView[0].bounds.Count); Debug.Assert(m_TotalLightCount == m_lightList.lightsPerView[0].lightVolumes.Count); @@ -3184,7 +3196,7 @@ unsafe BuildGPULightListParameters PrepareBuildGPULightListParameters(HDCamera cb.g_iNumSamplesMSAA = (int)hdCamera.msaaSamples; cb._EnvLightIndexShift = (uint)m_lightList.lights.Count; cb._DecalIndexShift = (uint)(m_lightList.lights.Count + m_lightList.envLights.Count); - cb._DensityVolumeIndexShift = (uint)(m_lightList.lights.Count + m_lightList.envLights.Count + decalDatasCount); + cb._LocalVolumetricFogIndexShift = (uint)(m_lightList.lights.Count + m_lightList.envLights.Count + decalDatasCount); // Copy the constant buffer into the parameter struct. parameters.lightListCB = cb; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl index 48aa9967647..125effb22b1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl @@ -111,7 +111,7 @@ CBUFFER_START(ShaderVariablesLightList) int g_iNumSamplesMSAA; uint _EnvLightIndexShift; uint _DecalIndexShift; - uint _DensityVolumeIndexShift; + uint _LocalVolumetricFogIndexShift; uint _Pad0_SVLL; uint _Pad1_SVLL; uint _Pad2_SVLL; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute index 733ad6710ed..30a08f1d553 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild-clustered.compute @@ -411,7 +411,7 @@ void LIGHTLISTGEN(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_GroupID) WriteShiftIndex(t, LIGHTCATEGORY_ENV, _EnvLightIndexShift); WriteShiftIndex(t, LIGHTCATEGORY_DECAL, _DecalIndexShift); - WriteShiftIndex(t, LIGHTCATEGORY_LOCAL_VOLUMETRIC_FOG, _DensityVolumeIndexShift); + WriteShiftIndex(t, LIGHTCATEGORY_LOCAL_VOLUMETRIC_FOG, _LocalVolumetricFogIndexShift); uint offs = start; for(int ll=0; llObsolete, do not use. [Obsolete("Never worked correctly due to having engine working in percent. Will be removed soon.")] @@ -25,7 +25,7 @@ internal void MigrateToFixUniformBlendDistanceToBeMetric() } } - public partial class DensityVolume : IVersionable + public partial class LocalVolumetricFog : IVersionable { enum Version { @@ -34,8 +34,8 @@ enum Version FixUniformBlendDistanceToBeMetric, } - static readonly MigrationDescription k_Migration = MigrationDescription.New( - MigrationStep.New(Version.ScaleIndependent, (DensityVolume data) => + static readonly MigrationDescription k_Migration = MigrationDescription.New( + MigrationStep.New(Version.ScaleIndependent, (LocalVolumetricFog data) => { data.parameters.size = data.transform.lossyScale; @@ -43,7 +43,7 @@ enum Version //when migrated prior to this fix, Local Volumetric Fog have to be manually set on advance mode. data.parameters.m_EditorAdvancedFade = true; }), - MigrationStep.New(Version.FixUniformBlendDistanceToBeMetric, (DensityVolume data) => data.parameters.MigrateToFixUniformBlendDistanceToBeMetric()) + MigrationStep.New(Version.FixUniformBlendDistanceToBeMetric, (LocalVolumetricFog data) => data.parameters.MigrateToFixUniformBlendDistanceToBeMetric()) ); [SerializeField] diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.Migration.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.Migration.cs.meta similarity index 100% rename from com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.Migration.cs.meta rename to com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.Migration.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs similarity index 60% rename from com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs rename to com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs index 27d21da3e04..075054b04a3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs @@ -5,7 +5,7 @@ namespace UnityEngine.Rendering.HighDefinition { /// Artist-friendly Local Volumetric Fog parametrization. [Serializable] - public partial struct DensityVolumeArtistParameters + public partial struct LocalVolumetricFogArtistParameters { /// Single scattering albedo: [0, 1]. Alpha is ignored. public Color albedo; @@ -52,7 +52,7 @@ public partial struct DensityVolumeArtistParameters public Vector3 textureOffset; /// When Blend Distance is above 0, controls which kind of falloff is applied to the transition area. - public DensityVolumeFalloffMode falloffMode; + public LocalVolumetricFogFalloffMode falloffMode; /// Minimum fog distance you can set in the meanFreePath parameter internal const float kMinFogDistance = 0.05f; @@ -61,7 +61,7 @@ public partial struct DensityVolumeArtistParameters /// Single scattering albedo. /// Mean free path. /// Anisotropy. - public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _anisotropy) + public LocalVolumetricFogArtistParameters(Color color, float _meanFreePath, float _anisotropy) { albedo = color; meanFreePath = _meanFreePath; @@ -81,7 +81,7 @@ public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _an distanceFadeStart = 10000; distanceFadeEnd = 10000; - falloffMode = DensityVolumeFalloffMode.Linear; + falloffMode = LocalVolumetricFogFalloffMode.Linear; m_EditorPositiveFade = Vector3.zero; m_EditorNegativeFade = Vector3.zero; @@ -118,15 +118,15 @@ internal void Constrain() distanceFadeEnd = Mathf.Max(distanceFadeStart, distanceFadeEnd); } - internal DensityVolumeEngineData ConvertToEngineData() + internal LocalVolumetricFogEngineData ConvertToEngineData() { - DensityVolumeEngineData data = new DensityVolumeEngineData(); + LocalVolumetricFogEngineData data = new LocalVolumetricFogEngineData(); data.extinction = VolumeRenderingUtils.ExtinctionFromMeanFreePath(meanFreePath); data.scattering = VolumeRenderingUtils.ScatteringFromExtinctionAndAlbedo(data.extinction, (Vector4)albedo); - var atlas = DensityVolumeManager.manager.volumeAtlas.GetAtlas(); - data.atlasOffset = DensityVolumeManager.manager.volumeAtlas.GetTextureOffset(volumeMask); + var atlas = LocalVolumetricFogManager.manager.volumeAtlas.GetAtlas(); + data.atlasOffset = LocalVolumetricFogManager.manager.volumeAtlas.GetTextureOffset(volumeMask); data.atlasOffset.x /= (float)atlas.width; data.atlasOffset.y /= (float)atlas.height; data.atlasOffset.z /= (float)atlas.volumeDepth; @@ -158,16 +158,16 @@ internal DensityVolumeEngineData ConvertToEngineData() return data; } - } // class DensityVolumeParameters + } // class LocalVolumetricFogParameters /// Local Volumetric Fog class. - [HelpURL(Documentation.baseURL + Documentation.version + Documentation.subURL + "Density-Volume" + Documentation.endURL)] + [HelpURL(Documentation.baseURL + Documentation.version + Documentation.subURL + "Local-Volumetric-Fog" + Documentation.endURL)] [ExecuteAlways] [AddComponentMenu("Rendering/Local Volumetric Fog")] - public partial class DensityVolume : MonoBehaviour + public partial class LocalVolumetricFog : MonoBehaviour { /// Local Volumetric Fog parameters. - public DensityVolumeArtistParameters parameters = new DensityVolumeArtistParameters(Color.white, 10.0f, 0.0f); + public LocalVolumetricFogArtistParameters parameters = new LocalVolumetricFogArtistParameters(Color.white, 10.0f, 0.0f); private Texture previousVolumeMask = null; #if UNITY_EDITOR @@ -191,7 +191,7 @@ internal void PrepareParameters(float time) if (updated) { if (parameters.volumeMask != null) - DensityVolumeManager.manager.AddTextureIntoAtlas(parameters.volumeMask); + LocalVolumetricFogManager.manager.AddTextureIntoAtlas(parameters.volumeMask); NotifyUpdatedTexure(); previousVolumeMask = parameters.volumeMask; @@ -213,26 +213,26 @@ private void NotifyUpdatedTexure() private void OnEnable() { - DensityVolumeManager.manager.RegisterVolume(this); + LocalVolumetricFogManager.manager.RegisterVolume(this); #if UNITY_EDITOR // Handle scene visibility - UnityEditor.SceneVisibilityManager.visibilityChanged += UpdateDensityVolumeVisibility; + UnityEditor.SceneVisibilityManager.visibilityChanged += UpdateLocalVolumetricFogVisibility; #endif } #if UNITY_EDITOR - void UpdateDensityVolumeVisibility() + void UpdateLocalVolumetricFogVisibility() { if (UnityEditor.SceneVisibilityManager.instance.IsHidden(gameObject)) { - if (DensityVolumeManager.manager.ContainsVolume(this)) - DensityVolumeManager.manager.DeRegisterVolume(this); + if (LocalVolumetricFogManager.manager.ContainsVolume(this)) + LocalVolumetricFogManager.manager.DeRegisterVolume(this); } else { - if (!DensityVolumeManager.manager.ContainsVolume(this)) - DensityVolumeManager.manager.RegisterVolume(this); + if (!LocalVolumetricFogManager.manager.ContainsVolume(this)) + LocalVolumetricFogManager.manager.RegisterVolume(this); } } @@ -240,10 +240,10 @@ void UpdateDensityVolumeVisibility() private void OnDisable() { - DensityVolumeManager.manager.DeRegisterVolume(this); + LocalVolumetricFogManager.manager.DeRegisterVolume(this); #if UNITY_EDITOR - UnityEditor.SceneVisibilityManager.visibilityChanged -= UpdateDensityVolumeVisibility; + UnityEditor.SceneVisibilityManager.visibilityChanged -= UpdateLocalVolumetricFogVisibility; #endif } @@ -256,4 +256,125 @@ private void OnValidate() parameters.Constrain(); } } + + /// Deprecated DensityVolume + [Obsolete("LocalVolumetricFog has been deprecated (UnityUpgradable) -> Local Volumetric Fog", false)] + public class DensityVolume : LocalVolumetricFog + { + } + + /// Deprecated DensityVolume + [Obsolete("DensityVolumeArtistParameters has been deprecated (UnityUpgradable) -> LocalVolumetricFogArtistParameters", false)] + public struct DensityVolumeArtistParameters + { + LocalVolumetricFogArtistParameters m_Parameters; + + /// Single scattering albedo: [0, 1]. Alpha is ignored. + public Color albedo + { + get => m_Parameters.albedo; + set => m_Parameters.albedo = value; + } + + /// Mean free path, in meters: [1, inf]. + public float meanFreePath + { + get => m_Parameters.meanFreePath; + set => m_Parameters.meanFreePath = value; + } + + /// Anisotropy of the phase function: [-1, 1]. Positive values result in forward scattering, and negative values - in backward scattering. + public float anisotropy + { + get => m_Parameters.anisotropy; + set => m_Parameters.anisotropy = value; + } + + /// Texture containing density values. + public Texture volumeMask + { + get => m_Parameters.volumeMask; + set => m_Parameters.volumeMask = value; + } + + /// Scrolling speed of the density texture. + public Vector3 textureScrollingSpeed + { + get => m_Parameters.textureScrollingSpeed; + set => m_Parameters.textureScrollingSpeed = value; + } + + /// Tiling rate of the density texture. + public Vector3 textureTiling + { + get => m_Parameters.textureTiling; + set => m_Parameters.textureTiling = value; + } + + /// Edge fade factor along the positive X, Y and Z axes. + public Vector3 positiveFade + { + get => m_Parameters.positiveFade; + set => m_Parameters.positiveFade = value; + } + + /// Edge fade factor along the negative X, Y and Z axes. + public Vector3 negativeFade + { + get => m_Parameters.negativeFade; + set => m_Parameters.negativeFade = value; + } + + /// Dimensions of the volume. + public Vector3 size + { + get => m_Parameters.size; + set => m_Parameters.size = value; + } + + /// Inverts the fade gradient. + public bool invertFade + { + get => m_Parameters.invertFade; + set => m_Parameters.invertFade = value; + } + + /// Distance at which density fading starts. + public float distanceFadeStart + { + get => m_Parameters.distanceFadeStart; + set => m_Parameters.distanceFadeStart = value; + } + + /// Distance at which density fading ends. + public float distanceFadeEnd + { + get => m_Parameters.distanceFadeEnd; + set => m_Parameters.distanceFadeEnd = value; + } + + /// Allows translation of the tiling density texture. + [SerializeField] + public Vector3 textureOffset + { + get => m_Parameters.textureOffset; + set => m_Parameters.textureOffset = value; + } + + /// When Blend Distance is above 0, controls which kind of falloff is applied to the transition area. + public DensityVolumeFalloffMode falloffMode + { + get => (DensityVolumeFalloffMode) m_Parameters.falloffMode; + set => m_Parameters.falloffMode = (LocalVolumetricFogFalloffMode) value; + } + + /// Constructor. + /// Single scattering albedo. + /// Mean free path. + /// Anisotropy. + public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _anisotropy) + { + m_Parameters = new LocalVolumetricFogArtistParameters(color, _meanFreePath, _anisotropy); + } + } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs.meta similarity index 100% rename from com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolume.cs.meta rename to com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs similarity index 80% rename from com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs rename to com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs index 48429606eea..e4637655a42 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs @@ -3,17 +3,17 @@ namespace UnityEngine.Rendering.HighDefinition { - class DensityVolumeManager + class LocalVolumetricFogManager { public static readonly GraphicsFormat densityVolumeAtlasFormat = GraphicsFormat.R8G8B8A8_UNorm; - static DensityVolumeManager m_Manager; - public static DensityVolumeManager manager + static LocalVolumetricFogManager m_Manager; + public static LocalVolumetricFogManager manager { get { if (m_Manager == null) - m_Manager = new DensityVolumeManager(); + m_Manager = new LocalVolumetricFogManager(); return m_Manager; } } @@ -30,15 +30,15 @@ public Texture3DAtlas volumeAtlas // Prevent allocating too big textures: int elementCount = Texture3DAtlas.GetMaxElementCountForWeightInByte( HDRenderPipeline.k_MaxCacheSize, - (int)settings.maxDensityVolumeSize, - settings.maxDensityVolumesOnScreen, + (int)settings.maxLocalVolumetricFogSize, + settings.maxLocalVolumetricFogsOnScreen, densityVolumeAtlasFormat, true ); - elementCount = Mathf.Clamp(elementCount, 1, settings.maxDensityVolumesOnScreen); + elementCount = Mathf.Clamp(elementCount, 1, settings.maxLocalVolumetricFogsOnScreen); - m_VolumeAtlas = new Texture3DAtlas(densityVolumeAtlasFormat, (int)settings.maxDensityVolumeSize, elementCount); + m_VolumeAtlas = new Texture3DAtlas(densityVolumeAtlasFormat, (int)settings.maxLocalVolumetricFogSize, elementCount); // When HDRP is initialized and this atlas created, some Local Volumetric Fog may have been initialized before so we add them here. foreach (var volume in m_Volumes) @@ -52,14 +52,14 @@ public Texture3DAtlas volumeAtlas } } - List m_Volumes = null; + List m_Volumes = null; - DensityVolumeManager() + LocalVolumetricFogManager() { - m_Volumes = new List(); + m_Volumes = new List(); } - public void RegisterVolume(DensityVolume volume) + public void RegisterVolume(LocalVolumetricFog volume) { m_Volumes.Add(volume); @@ -84,7 +84,7 @@ internal void AddTextureIntoAtlas(Texture volumeTexture) Debug.LogError($"No more space in the Local Volumetric Fog atlas, consider increasing the max Local Volumetric Fog on screen in the HDRP asset."); } - public void DeRegisterVolume(DensityVolume volume) + public void DeRegisterVolume(LocalVolumetricFog volume) { if (m_Volumes.Contains(volume)) m_Volumes.Remove(volume); @@ -103,16 +103,16 @@ public void DeRegisterVolume(DensityVolume volume) } } - public bool ContainsVolume(DensityVolume volume) => m_Volumes.Contains(volume); + public bool ContainsVolume(LocalVolumetricFog volume) => m_Volumes.Contains(volume); - public List PrepareDensityVolumeData(CommandBuffer cmd, HDCamera currentCam) + public List PrepareLocalVolumetricFogData(CommandBuffer cmd, HDCamera currentCam) { //Update volumes float time = currentCam.time; - foreach (DensityVolume volume in m_Volumes) + foreach (LocalVolumetricFog volume in m_Volumes) volume.PrepareParameters(time); - using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.UpdateDensityVolumeAtlas))) + using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.UpdateLocalVolumetricFogAtlas))) { volumeAtlas.Update(cmd); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs.meta similarity index 100% rename from com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DensityVolumeManager.cs.meta rename to com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs.meta diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute index 3b58ffb273f..c1779508258 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute @@ -41,7 +41,7 @@ //-------------------------------------------------------------------------------------------------- StructuredBuffer _VolumeBounds; -StructuredBuffer _VolumeData; +StructuredBuffer _VolumeData; TEXTURE3D(_VolumeMaskAtlas); @@ -82,7 +82,7 @@ float ComputeFadeFactor(float3 coordNDC, float dist, return fade; } -float4 SampleVolumeMask(DensityVolumeEngineData volumeData, float3 voxelCenterNDC, float3 duvw_dx, float3 duvw_dy, float3 duvw_dz) +float4 SampleVolumeMask(LocalVolumetricFogEngineData volumeData, float3 voxelCenterNDC, float3 duvw_dx, float3 duvw_dy, float3 duvw_dz) { float maxLod = log2(volumeData.maskSize.w); // TODO: expose the LoD bias parameter. @@ -138,7 +138,7 @@ void FillVolumetricDensityBuffer(PositionInputs posInput, uint tileIndex, Jitter { uint objectIndex = FetchIndex(volumeStart, offset); - if (objectIndex >= _DensityVolumeIndexShift) + if (objectIndex >= _LocalVolumetricFogIndexShift) { // We have found the first Local Volumetric Fog. break; @@ -151,7 +151,7 @@ void FillVolumetricDensityBuffer(PositionInputs posInput, uint tileIndex, Jitter #else // USE_BIG_TILE_LIGHTLIST - volumeCount = _NumVisibleDensityVolumes; + volumeCount = _NumVisibleLocalVolumetricFogs; volumeStart = 0; #endif // USE_BIG_TILE_LIGHTLIST @@ -182,7 +182,7 @@ void FillVolumetricDensityBuffer(PositionInputs posInput, uint tileIndex, Jitter for (uint volumeOffset = 0; volumeOffset < volumeCount; volumeOffset++) { #ifdef USE_BIG_TILE_LIGHTLIST - uint volumeIndex = FetchIndex(volumeStart, volumeOffset) - _DensityVolumeIndexShift; + uint volumeIndex = FetchIndex(volumeStart, volumeOffset) - _LocalVolumetricFogIndexShift; #else uint volumeIndex = FetchIndex(volumeStart, volumeOffset); #endif diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs index d800a201bd8..924375b9199 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs @@ -5,10 +5,10 @@ namespace UnityEngine.Rendering.HighDefinition { - // Optimized version of 'DensityVolumeArtistParameters'. + // Optimized version of 'LocalVolumetricFogArtistParameters'. // TODO: pack better. This data structure contains a bunch of UNORMs. [GenerateHLSL] - struct DensityVolumeEngineData + struct LocalVolumetricFogEngineData { public Vector3 scattering; // [0, 1] public float extinction; // [0, 1] @@ -21,12 +21,12 @@ struct DensityVolumeEngineData public Vector3 rcpNegFaceFade; public int useVolumeMask; // bool public Vector3 atlasOffset; // coordinates in the atlas in pixels - public DensityVolumeFalloffMode falloffMode; + public LocalVolumetricFogFalloffMode falloffMode; public Vector4 maskSize; // xyz: atlas size / mask size, w: mask size in pixels - public static DensityVolumeEngineData GetNeutralValues() + public static LocalVolumetricFogEngineData GetNeutralValues() { - DensityVolumeEngineData data; + LocalVolumetricFogEngineData data; data.scattering = Vector3.zero; data.extinction = 0; @@ -40,7 +40,7 @@ public static DensityVolumeEngineData GetNeutralValues() data.endTimesRcpDistFadeLen = 1; data.useVolumeMask = 0; data.maskSize = Vector4.zero; - data.falloffMode = DensityVolumeFalloffMode.Linear; + data.falloffMode = LocalVolumetricFogFalloffMode.Linear; return data; } @@ -53,7 +53,7 @@ unsafe struct ShaderVariablesVolumetric public fixed float _VBufferCoordToViewDirWS[ShaderConfig.k_XRMaxViewsForCBuffer * 16]; public float _VBufferUnitDepthTexelSpacing; - public uint _NumVisibleDensityVolumes; + public uint _NumVisibleLocalVolumetricFogs; public float _CornetteShanksConstant; public uint _VBufferHistoryIsValid; @@ -82,6 +82,7 @@ unsafe struct ShaderVariablesVolumetric /// [GenerateHLSL] + [Obsolete("DensityVolumeFalloffMode has been deprecated (UnityUpgradable) -> LocalVolumetricFogFalloffMode", false)] public enum DensityVolumeFalloffMode { /// @@ -90,6 +91,16 @@ public enum DensityVolumeFalloffMode Exponential, } + /// + [GenerateHLSL] + public enum LocalVolumetricFogFalloffMode + { + /// + Linear, + /// + Exponential, + } + class VolumeRenderingUtils { public static float MeanFreePathFromExtinction(float extinction) @@ -118,10 +129,10 @@ public static Vector3 AlbedoFromMeanFreePathAndScattering(float meanFreePath, Ve } } - struct DensityVolumeList + struct LocalVolumetricFogList { public List bounds; - public List density; + public List density; } struct VBufferParameters @@ -219,8 +230,8 @@ public partial class HDRenderPipeline ComputeShader m_VolumetricLightingFilteringCS = null; List m_VisibleVolumeBounds = null; - List m_VisibleVolumeData = null; - internal const int k_MaxVisibleDensityVolumeCount = 512; + List m_VisibleVolumeData = null; + internal const int k_MaxVisibleLocalVolumetricFogCount = 512; // Static keyword is required here else we get a "DestroyBuffer can only be called from the main thread" ComputeBuffer m_VisibleVolumeBoundsBuffer = null; @@ -592,9 +603,9 @@ internal void CreateVolumetricLightingBuffers() Debug.Assert(m_VolumetricLightingCS != null); m_VisibleVolumeBounds = new List(); - m_VisibleVolumeData = new List(); - m_VisibleVolumeBoundsBuffer = new ComputeBuffer(k_MaxVisibleDensityVolumeCount, Marshal.SizeOf(typeof(OrientedBBox))); - m_VisibleVolumeDataBuffer = new ComputeBuffer(k_MaxVisibleDensityVolumeCount, Marshal.SizeOf(typeof(DensityVolumeEngineData))); + m_VisibleVolumeData = new List(); + m_VisibleVolumeBoundsBuffer = new ComputeBuffer(k_MaxVisibleLocalVolumetricFogCount, Marshal.SizeOf(typeof(OrientedBBox))); + m_VisibleVolumeDataBuffer = new ComputeBuffer(k_MaxVisibleLocalVolumetricFogCount, Marshal.SizeOf(typeof(LocalVolumetricFogEngineData))); } internal void DestroyVolumetricLightingBuffers() @@ -678,14 +689,14 @@ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, HDCame cb._VBufferRcpInstancedViewCount = 1.0f / hdCamera.viewCount; } - DensityVolumeList PrepareVisibleDensityVolumeList(HDCamera hdCamera, CommandBuffer cmd) + LocalVolumetricFogList PrepareVisibleLocalVolumetricFogList(HDCamera hdCamera, CommandBuffer cmd) { - DensityVolumeList densityVolumes = new DensityVolumeList(); + LocalVolumetricFogList densityVolumes = new LocalVolumetricFogList(); if (!Fog.IsVolumetricFogEnabled(hdCamera)) return densityVolumes; - using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.PrepareVisibleDensityVolumeList))) + using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.PrepareVisibleLocalVolumetricFogList))) { Vector3 camPosition = hdCamera.camera.transform.position; Vector3 camOffset = Vector3.zero;// World-origin-relative @@ -699,11 +710,11 @@ DensityVolumeList PrepareVisibleDensityVolumeList(HDCamera hdCamera, CommandBuff m_VisibleVolumeData.Clear(); // Collect all visible finite volume data, and upload it to the GPU. - var volumes = DensityVolumeManager.manager.PrepareDensityVolumeData(cmd, hdCamera); + var volumes = LocalVolumetricFogManager.manager.PrepareLocalVolumetricFogData(cmd, hdCamera); - for (int i = 0; i < Math.Min(volumes.Count, k_MaxVisibleDensityVolumeCount); i++) + for (int i = 0; i < Math.Min(volumes.Count, k_MaxVisibleLocalVolumetricFogCount); i++) { - DensityVolume volume = volumes[i]; + LocalVolumetricFog volume = volumes[i]; // TODO: cache these? var obb = new OrientedBBox(Matrix4x4.TRS(volume.transform.position, volume.transform.rotation, volume.parameters.size)); @@ -777,7 +788,7 @@ unsafe void UpdateShaderVariableslVolumetrics(ref ShaderVariablesVolumetric cb, for (int j = 0; j < 16; ++j) cb._VBufferCoordToViewDirWS[i * 16 + j] = m_PixelCoordToViewDirWS[i][j]; cb._VBufferUnitDepthTexelSpacing = HDUtils.ComputZPlaneTexelSpacing(1.0f, vFoV, resolution.y); - cb._NumVisibleDensityVolumes = (uint)m_VisibleVolumeBounds.Count; + cb._NumVisibleLocalVolumetricFogs = (uint)m_VisibleVolumeBounds.Count; cb._CornetteShanksConstant = CornetteShanksPhasePartConstant(fog.anisotropy.value); cb._VBufferHistoryIsValid = hdCamera.volumetricHistoryIsValid ? 1u : 0u; @@ -789,9 +800,9 @@ unsafe void UpdateShaderVariableslVolumetrics(ref ShaderVariablesVolumetric cb, xySeqOffset.Set(m_xySeq[sampleIndex].x, m_xySeq[sampleIndex].y, m_zSeq[sampleIndex], frameIndex); cb._VBufferSampleOffset = xySeqOffset; - var volumeAtlas = DensityVolumeManager.manager.volumeAtlas.GetAtlas(); + var volumeAtlas = LocalVolumetricFogManager.manager.volumeAtlas.GetAtlas(); cb._VolumeMaskDimensions = Vector4.zero; - if (DensityVolumeManager.manager.volumeAtlas.GetAtlas() != null) + if (LocalVolumetricFogManager.manager.volumeAtlas.GetAtlas() != null) { cb._VolumeMaskDimensions.x = volumeAtlas.width; // 1 / number of textures cb._VolumeMaskDimensions.y = volumeAtlas.height; @@ -851,7 +862,7 @@ VolumeVoxelizationParameters PrepareVolumeVoxelizationParameters(HDCamera hdCame var cvp = currParams.viewportSize; parameters.resolution = new Vector4(cvp.x, cvp.y, 1.0f / cvp.x, 1.0f / cvp.y); - parameters.volumeAtlas = DensityVolumeManager.manager.volumeAtlas.GetAtlas(); + parameters.volumeAtlas = LocalVolumetricFogManager.manager.volumeAtlas.GetAtlas(); if (parameters.volumeAtlas == null) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl index 8e6afc3aa80..7bc7ebae6cc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl @@ -5,14 +5,14 @@ #ifndef VOLUMETRICLIGHTING_CS_HLSL #define VOLUMETRICLIGHTING_CS_HLSL // -// UnityEngine.Rendering.HighDefinition.DensityVolumeFalloffMode: static fields +// UnityEngine.Rendering.HighDefinition.LocalVolumetricFogFalloffMode: static fields // #define DENSITYVOLUMEFALLOFFMODE_LINEAR (0) #define DENSITYVOLUMEFALLOFFMODE_EXPONENTIAL (1) -// Generated from UnityEngine.Rendering.HighDefinition.DensityVolumeEngineData +// Generated from UnityEngine.Rendering.HighDefinition.LocalVolumetricFogEngineData // PackingRules = Exact -struct DensityVolumeEngineData +struct LocalVolumetricFogEngineData { float3 scattering; float extinction; @@ -34,7 +34,7 @@ struct DensityVolumeEngineData CBUFFER_START(ShaderVariablesVolumetric) float4x4 _VBufferCoordToViewDirWS[2]; float _VBufferUnitDepthTexelSpacing; - uint _NumVisibleDensityVolumes; + uint _NumVisibleLocalVolumetricFogs; float _CornetteShanksConstant; uint _VBufferHistoryIsValid; float4 _VBufferSampleOffset; @@ -56,57 +56,57 @@ CBUFFER_START(ShaderVariablesVolumetric) CBUFFER_END // -// Accessors for UnityEngine.Rendering.HighDefinition.DensityVolumeEngineData +// Accessors for UnityEngine.Rendering.HighDefinition.LocalVolumetricFogEngineData // -float3 GetScattering(DensityVolumeEngineData value) +float3 GetScattering(LocalVolumetricFogEngineData value) { return value.scattering; } -float GetExtinction(DensityVolumeEngineData value) +float GetExtinction(LocalVolumetricFogEngineData value) { return value.extinction; } -float3 GetTextureTiling(DensityVolumeEngineData value) +float3 GetTextureTiling(LocalVolumetricFogEngineData value) { return value.textureTiling; } -int GetInvertFade(DensityVolumeEngineData value) +int GetInvertFade(LocalVolumetricFogEngineData value) { return value.invertFade; } -float3 GetTextureScroll(DensityVolumeEngineData value) +float3 GetTextureScroll(LocalVolumetricFogEngineData value) { return value.textureScroll; } -float GetRcpDistFadeLen(DensityVolumeEngineData value) +float GetRcpDistFadeLen(LocalVolumetricFogEngineData value) { return value.rcpDistFadeLen; } -float3 GetRcpPosFaceFade(DensityVolumeEngineData value) +float3 GetRcpPosFaceFade(LocalVolumetricFogEngineData value) { return value.rcpPosFaceFade; } -float GetEndTimesRcpDistFadeLen(DensityVolumeEngineData value) +float GetEndTimesRcpDistFadeLen(LocalVolumetricFogEngineData value) { return value.endTimesRcpDistFadeLen; } -float3 GetRcpNegFaceFade(DensityVolumeEngineData value) +float3 GetRcpNegFaceFade(LocalVolumetricFogEngineData value) { return value.rcpNegFaceFade; } -int GetUseVolumeMask(DensityVolumeEngineData value) +int GetUseVolumeMask(LocalVolumetricFogEngineData value) { return value.useVolumeMask; } -float3 GetAtlasOffset(DensityVolumeEngineData value) +float3 GetAtlasOffset(LocalVolumetricFogEngineData value) { return value.atlasOffset; } -int GetFalloffMode(DensityVolumeEngineData value) +int GetFalloffMode(LocalVolumetricFogEngineData value) { return value.falloffMode; } -float4 GetMaskSize(DensityVolumeEngineData value) +float4 GetMaskSize(LocalVolumetricFogEngineData value) { return value.maskSize; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs index c3be36b2a9b..b80602e3cb3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs @@ -73,7 +73,7 @@ internal enum HDProfileId DisplayPlanarReflectionProbeAtlas, BlitTextureInPotAtlas, AreaLightCookieConvolution, - DisplayDensityVolumeAtlas, + DisplayLocalVolumetricFogAtlas, UpdateSkyEnvironmentConvolution, RenderSkyToCubemap, @@ -88,8 +88,8 @@ internal enum HDProfileId VolumeVoxelization, VolumetricLighting, VolumetricLightingFiltering, - PrepareVisibleDensityVolumeList, - UpdateDensityVolumeAtlas, + PrepareVisibleLocalVolumetricFogList, + UpdateLocalVolumetricFogAtlas, VolumetricClouds, VolumetricCloudsPrepare, diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs index f9f0cc25bf1..20e9b870d78 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs @@ -22,7 +22,7 @@ public partial class HDRenderPipeline Material m_DebugExposure; Material m_DebugViewTilesMaterial; Material m_DebugHDShadowMapMaterial; - Material m_DebugDensityVolumeMaterial; + Material m_DebugLocalVolumetricFogMaterial; Material m_DebugBlitMaterial; #if ENABLE_VIRTUALTEXTURES Material m_VTDebugBlit; @@ -48,7 +48,7 @@ void InitializeDebug() m_DebugExposure = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugExposurePS); m_DebugViewTilesMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugViewTilesPS); m_DebugHDShadowMapMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugHDShadowMapPS); - m_DebugDensityVolumeMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugDensityVolumeAtlasPS); + m_DebugLocalVolumetricFogMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugLocalVolumetricFogAtlasPS); m_DebugBlitMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugBlitQuad); #if ENABLE_VIRTUALTEXTURES m_VTDebugBlit = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugViewVirtualTexturingBlit); @@ -65,7 +65,7 @@ void CleanupDebug() CoreUtils.Destroy(m_DebugExposure); CoreUtils.Destroy(m_DebugViewTilesMaterial); CoreUtils.Destroy(m_DebugHDShadowMapMaterial); - CoreUtils.Destroy(m_DebugDensityVolumeMaterial); + CoreUtils.Destroy(m_DebugLocalVolumetricFogMaterial); CoreUtils.Destroy(m_DebugBlitMaterial); #if ENABLE_VIRTUALTEXTURES CoreUtils.Destroy(m_VTDebugBlit); @@ -497,32 +497,32 @@ void RenderAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, } } - class RenderDensityVolumeAtlasDebugOverlayPassData + class RenderLocalVolumetricFogAtlasDebugOverlayPassData : DebugOverlayPassData { public float slice; public Texture3DAtlas atlas; - public Material debugDensityVolumeMaterial; + public Material debugLocalVolumetricFogMaterial; public bool useSelection; } - void RenderDensityVolumeAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, TextureHandle depthBuffer) + void RenderLocalVolumetricFogAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, TextureHandle depthBuffer) { - if (!m_CurrentDebugDisplaySettings.data.lightingDebugSettings.displayDensityVolumeAtlas) + if (!m_CurrentDebugDisplaySettings.data.lightingDebugSettings.displayLocalVolumetricFogAtlas) return; - using (var builder = renderGraph.AddRenderPass("RenderDensityVolumeAtlasOverlay" , out var passData, ProfilingSampler.Get(HDProfileId.DisplayDensityVolumeAtlas))) + using (var builder = renderGraph.AddRenderPass("RenderLocalVolumetricFogAtlasOverlay" , out var passData, ProfilingSampler.Get(HDProfileId.DisplayLocalVolumetricFogAtlas))) { passData.debugOverlay = m_DebugOverlay; passData.colorBuffer = builder.UseColorBuffer(colorBuffer, 0); passData.depthBuffer = builder.UseDepthBuffer(depthBuffer, DepthAccess.ReadWrite); - passData.debugDensityVolumeMaterial = m_DebugDensityVolumeMaterial; + passData.debugLocalVolumetricFogMaterial = m_DebugLocalVolumetricFogMaterial; passData.slice = (float)m_CurrentDebugDisplaySettings.data.lightingDebugSettings.densityVolumeAtlasSlice; - passData.atlas = DensityVolumeManager.manager.volumeAtlas; + passData.atlas = LocalVolumetricFogManager.manager.volumeAtlas; passData.useSelection = m_CurrentDebugDisplaySettings.data.lightingDebugSettings.densityVolumeUseSelection; builder.SetRenderFunc( - (RenderDensityVolumeAtlasDebugOverlayPassData data, RenderGraphContext ctx) => + (RenderLocalVolumetricFogAtlasDebugOverlayPassData data, RenderGraphContext ctx) => { var atlasTexture = data.atlas.GetAtlas(); var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); @@ -536,7 +536,7 @@ void RenderDensityVolumeAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle { var obj = UnityEditor.Selection.activeGameObject; - if (obj != null && obj.TryGetComponent(out var densityVolume)) + if (obj != null && obj.TryGetComponent(out var densityVolume)) { var texture = densityVolume.parameters.volumeMask; @@ -550,10 +550,10 @@ void RenderDensityVolumeAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle } #endif data.debugOverlay.SetViewport(ctx.cmd); - ctx.cmd.DrawProcedural(Matrix4x4.identity, data.debugDensityVolumeMaterial, 0, MeshTopology.Triangles, 3, 1, mpb); + ctx.cmd.DrawProcedural(Matrix4x4.identity, data.debugLocalVolumetricFogMaterial, 0, MeshTopology.Triangles, 3, 1, mpb); data.debugOverlay.Next(); data.debugOverlay.SetViewport(ctx.cmd); - ctx.cmd.DrawProcedural(Matrix4x4.identity, data.debugDensityVolumeMaterial, 1, MeshTopology.Triangles, 3, 1, mpb); + ctx.cmd.DrawProcedural(Matrix4x4.identity, data.debugLocalVolumetricFogMaterial, 1, MeshTopology.Triangles, 3, 1, mpb); data.debugOverlay.Next(); }); } @@ -796,7 +796,7 @@ void RenderDebugOverlays(RenderGraph renderGraph, if (m_CurrentDebugDisplaySettings.data.lightingDebugSettings.displayPlanarReflectionProbeAtlas) RenderAtlasDebugOverlay(renderGraph, colorBuffer, depthBuffer, m_TextureCaches.reflectionPlanarProbeCache.GetTexCache(), (int)m_CurrentDebugDisplaySettings.data.lightingDebugSettings.planarReflectionProbeMipLevel, applyExposure: true, "RenderPlanarProbeAtlasOverlay", HDProfileId.DisplayPlanarReflectionProbeAtlas); - RenderDensityVolumeAtlasDebugOverlay(renderGraph, colorBuffer, depthBuffer); + RenderLocalVolumetricFogAtlasDebugOverlay(renderGraph, colorBuffer, depthBuffer); RenderTileClusterDebugOverlay(renderGraph, colorBuffer, depthBuffer, lightLists, depthPyramidTexture, hdCamera); RenderShadowsDebugOverlay(renderGraph, colorBuffer, depthBuffer, shadowResult); RenderDecalOverlay(renderGraph, colorBuffer, depthBuffer, hdCamera); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index d9c8502cd6d..d82ba28e0c6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -830,7 +830,7 @@ protected override void Dispose(bool disposing) CustomPassVolume.Cleanup(); - DensityVolumeManager.manager.ReleaseAtlas(); + LocalVolumetricFogManager.manager.ReleaseAtlas(); CleanupPrepass(); CoreUtils.Destroy(m_ColorResolveMaterial); @@ -1976,7 +1976,7 @@ AOVRequestData aovRequest material.Bind(cmd); // Frustum cull Local Volumetric Fog on the CPU. Can be performed as soon as the camera is set up. - DensityVolumeList densityVolumes = PrepareVisibleDensityVolumeList(hdCamera, cmd); + LocalVolumetricFogList densityVolumes = PrepareVisibleLocalVolumetricFogList(hdCamera, cmd); // do AdaptiveProbeVolume stuff BindAPVRuntimeResources(cmd, hdCamera); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs index e6fc4685906..94bec6b65aa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs @@ -94,8 +94,8 @@ public sealed class ShaderResources [Reload("Runtime/Material/SubsurfaceScattering/CombineLighting.shader")] public Shader combineLightingPS; - [Reload("Runtime/Lighting/VolumetricLighting/DebugDensityVolumeAtlas.shader")] - public Shader debugDensityVolumeAtlasPS; + [Reload("Runtime/Lighting/VolumetricLighting/DebugLocalVolumetricFogAtlas.shader")] + public Shader debugLocalVolumetricFogAtlasPS; // General [Reload("Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader")] diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset b/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset index cf3bf08cc0e..082352640fb 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset @@ -54,7 +54,7 @@ MonoBehaviour: debugDisplayProbeVolumePS: {fileID: 4800000, guid: e7c19cfee7a88394fbb53652b9644cc0, type: 3} subsurfaceScatteringCS: {fileID: 7200000, guid: b06a7993621def248addd55d0fe931b1, type: 3} combineLightingPS: {fileID: 4800000, guid: 2e37131331fbdca449b1a2bc47a639ca, type: 3} - debugDensityVolumeAtlasPS: {fileID: 4800000, guid: 8371b763f09c7304889c22aa97ebdfd2, type: 3} + debugLocalVolumetricFogAtlasPS: {fileID: 4800000, guid: 8371b763f09c7304889c22aa97ebdfd2, type: 3} cameraMotionVectorsPS: {fileID: 4800000, guid: 035941b63024d1943af48811c1db20d9, type: 3} clearStencilBufferPS: {fileID: 4800000, guid: 8ea49ef16606acd489439e676ab84040, type: 3} copyStencilBufferPS: {fileID: 4800000, guid: 3d1574f1cdfa0ce4995f9bc79ed7f8ec, type: 3} From 474a6f8ca63936eba1d2862ce4ab6bf25aad784e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Wed, 10 Mar 2021 16:03:21 +0100 Subject: [PATCH 06/27] UX changes --- .../Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 207814b3a74..b45a1d2e2f8 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -180,8 +180,8 @@ public class GeneralSection public static readonly GUIContent probeVolumeMemoryBudget = EditorGUIUtility.TrTextContent("Memory Budget", "Determines the width and height of the textures used to store GI data from probes. Note that the textures also have a fixed depth dimension."); 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; public static readonly GUIContent probeVolumeSHBands = EditorGUIUtility.TrTextContent("SH Bands", "Determines up to what SH bands the Probe Volume will use. Chosing L2 will lead to better quality, but also higher memory and runtime cost."); - public static readonly GUIContent maxLocalVolumetricFogSizeStyle = EditorGUIUtility.TrTextContent("Max Size", "Specifies the maximum size for the individual 3D Local Volumetric Fog texture that HDRP uses for Local Volumetric Fog. This settings will affect your memory consumption."); - public static readonly GUIContent maxLocalVolumetricFogsOnScreenStyle = EditorGUIUtility.TrTextContent("Max Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); + public static readonly GUIContent maxLocalVolumetricFogSizeStyle = EditorGUIUtility.TrTextContent("Max Local Fog Size", "Specifies the maximum size for the individual 3D Local Volumetric Fog texture that HDRP uses for Local Volumetric Fog. This settings will affect your memory consumption."); + public static readonly GUIContent maxLocalVolumetricFogsOnScreenStyle = EditorGUIUtility.TrTextContent("Max Local Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); public const string probeVolumeNotEnabled = "Warning: Probe Volumes are not enabled.\nIt is an highly experimental feature and 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; From 7a6f876494da827e0832b63c52ed9e114f97099e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Thu, 11 Mar 2021 10:15:27 +0100 Subject: [PATCH 07/27] Update screenshot --- .../Documentation~/Images/DensityVolume1.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png index 331327bee8f..4c2a138a1b9 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e2ba6dc50fe22c56c50ff4cdaa10c5ce5a5c479af543d0af024c48d65b54ff2 -size 32847 +oid sha256:5f49c0c0a187d2da802c01fa6efa19fffa53f2624c824eaaf5cf95bc9def3233 +size 32652 From fd048c008c4faef91048dcf8c1738a22e3d49b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Thu, 11 Mar 2021 13:57:52 +0100 Subject: [PATCH 08/27] Deprecated.cs, move variables to be named localVolumetricFog --- .../Editor/CoreEditorUtils.cs | 32 --- .../Runtime/Debugging/DebugUI.Fields.cs | 24 +- .../Runtime/Utilities/CoreUtils.cs | 25 +- .../LocalVolumetricFogEditor.cs | 96 ++++---- .../VolumetricLighting/VolumetricMenuItem.cs | 5 +- .../RenderPipeline/HDRenderPipelineUI.cs | 6 +- .../Runtime/Debug/DebugDisplay.cs | 22 +- .../Runtime/Debug/LightingDebug.cs | 21 +- .../Runtime/Deprecated.cs | 214 ++++++++++++++++++ .../Runtime/Deprecated.cs.meta | 11 + .../LightLoop/GlobalLightLoopSettings.cs | 46 +--- .../Runtime/Lighting/LightLoop/LightLoop.cs | 35 +-- .../LocalVolumetricFog.Migration.cs | 4 - .../VolumetricLighting/LocalVolumetricFog.cs | 121 ---------- .../LocalVolumetricFogManager.cs | 10 +- .../VolumetricLighting/VolumetricLighting.cs | 21 +- .../RenderPipeline/HDRenderPipeline.Debug.cs | 8 +- .../RenderPipeline/HDRenderPipeline.cs | 4 +- 18 files changed, 351 insertions(+), 354 deletions(-) create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs.meta diff --git a/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs b/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs index 4c48c6a59e8..2f950000f3e 100644 --- a/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs +++ b/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs @@ -782,38 +782,6 @@ public static void DrawEnumPopup(SerializedProperty property, System.Type type, EditorGUI.showMixedValue = false; } - static Dictionary s_TrEnumDescriptionCache = new Dictionary(); - - /// Obtains the names of an enum taking into account the - public static GUIContent[] TrEnumFriendlyNames() - { - var enumType = typeof(T); - if (!s_TrEnumDescriptionCache.TryGetValue(enumType, out var enumFriendlyValues)) - { - enumFriendlyValues = CoreUtils.GetEnumFriendlyNames() - .Select(guiContent => EditorGUIUtility.TrTextContent(ObjectNames.NicifyVariableName(guiContent.text), guiContent.tooltip)) - .ToArray(); - - // Update the enums cache - s_TrEnumDescriptionCache[enumType] = enumFriendlyValues; - } - - return enumFriendlyValues; - } - - /// Draw a popup for an enum with values decorated with - /// the label - /// The data displayed - public static void DrawFriendlyNamesEnumPopup(GUIContent label, SerializedProperty property) - { - using (var checkScope = new EditorGUI.ChangeCheckScope()) - { - int newValue = EditorGUILayout.Popup(label, property.enumValueIndex, TrEnumFriendlyNames()); - if (checkScope.changed) - property.enumValueIndex = newValue; - } - } - /// Remove the keywords on the given materials /// The material to edit public static void RemoveMaterialKeywords(Material material) diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index 064c491ac81..d2bab41c5f5 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -1,5 +1,9 @@ using System; +using System.Collections.Generic; +using System.ComponentModel; using System.Linq; +using System.Reflection; +using UnityEditor; using UnityEngine.Assertions; namespace UnityEngine.Rendering @@ -279,15 +283,23 @@ public Type autoEnum { set { - enumNames = Enum.GetNames(value).Select(x => new GUIContent(x)).ToArray(); - - // Linq.Cast on a typeless Array breaks the JIT on PS4/Mono so we have to do it manually - //enumValues = Enum.GetValues(value).Cast().ToArray(); - var values = Enum.GetValues(value); enumValues = new int[values.Length]; + enumNames = new GUIContent[values.Length]; for (int i = 0; i < values.Length; i++) - enumValues[i] = (int)values.GetValue(i); + { + var enumValue = values.GetValue(i); + var memInfo = value.GetMember(value.GetEnumName(enumValue)); + var name = memInfo[0] + .GetCustomAttributes(typeof(InspectorNameAttribute), false) + .FirstOrDefault() is InspectorNameAttribute attribute ? attribute.displayName : enumValue.ToString(); + + if (memInfo[0].GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() is ObsoleteAttribute) + name += "(Obsolete)"; + + enumNames[i] = EditorGUIUtility.TrTextContent(ObjectNames.NicifyVariableName(name)); + enumValues[i] = (int)enumValue; + } InitIndexes(); InitQuickSeparators(); diff --git a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs index d7daa2fe263..691318ec0be 100644 --- a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs +++ b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Reflection; +using UnityEditor; using UnityEngine.Experimental.Rendering; namespace UnityEngine.Rendering @@ -1290,28 +1292,5 @@ public static void DrawRendererList(ScriptableRenderContext renderContext, Comma renderContext.DrawRenderers(rendererList.cullingResult, ref rendererList.drawSettings, ref rendererList.filteringSettings, ref renderStateBlock); } } - - static Dictionary s_EnumDescriptionCache = new Dictionary(); - - /// Obtains the names of an enum taking into account the - public static GUIContent[] GetEnumFriendlyNames() - { - var enumType = typeof(T); - if (!s_EnumDescriptionCache.TryGetValue(enumType, out var enumFriendlyValues)) - { - enumFriendlyValues = ((from object value in Enum.GetValues(enumType) - let attribute = enumType.GetMember(value.ToString())[0] - .GetCustomAttributes(typeof(DescriptionAttribute), false) - .FirstOrDefault() as DescriptionAttribute - select new GUIContent(attribute != null ? attribute.Description : value.ToString()))) - .Distinct() - .ToArray(); - - // Update the enums cache - s_EnumDescriptionCache[enumType] = enumFriendlyValues; - } - - return enumFriendlyValues; - } } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs index 00428f4ac83..bef66a9c9b3 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/LocalVolumetricFogEditor.cs @@ -41,16 +41,16 @@ public override void OnInspectorGUI() m_SerializedLocalVolumetricFog.Apply(); } - static Vector3 CenterBlendLocalPosition(LocalVolumetricFog densityVolume) + static Vector3 CenterBlendLocalPosition(LocalVolumetricFog localVolumetricFog) { - if (densityVolume.parameters.m_EditorAdvancedFade) + if (localVolumetricFog.parameters.m_EditorAdvancedFade) { - Vector3 size = densityVolume.parameters.size; - Vector3 posBlend = densityVolume.parameters.m_EditorPositiveFade; + Vector3 size = localVolumetricFog.parameters.size; + Vector3 posBlend = localVolumetricFog.parameters.m_EditorPositiveFade; posBlend.x *= size.x; posBlend.y *= size.y; posBlend.z *= size.z; - Vector3 negBlend = densityVolume.parameters.m_EditorNegativeFade; + Vector3 negBlend = localVolumetricFog.parameters.m_EditorNegativeFade; negBlend.x *= size.x; negBlend.y *= size.y; negBlend.z *= size.z; @@ -61,41 +61,41 @@ static Vector3 CenterBlendLocalPosition(LocalVolumetricFog densityVolume) return Vector3.zero; } - static Vector3 BlendSize(LocalVolumetricFog densityVolume) + static Vector3 BlendSize(LocalVolumetricFog localVolumetricFog) { - Vector3 size = densityVolume.parameters.size; - if (densityVolume.parameters.m_EditorAdvancedFade) + Vector3 size = localVolumetricFog.parameters.size; + if (localVolumetricFog.parameters.m_EditorAdvancedFade) { - Vector3 blendSize = (Vector3.one - densityVolume.parameters.m_EditorPositiveFade - densityVolume.parameters.m_EditorNegativeFade); + Vector3 blendSize = (Vector3.one - localVolumetricFog.parameters.m_EditorPositiveFade - localVolumetricFog.parameters.m_EditorNegativeFade); blendSize.x *= size.x; blendSize.y *= size.y; blendSize.z *= size.z; return blendSize; } else - return size - densityVolume.parameters.m_EditorUniformFade * 2f * Vector3.one; + return size - localVolumetricFog.parameters.m_EditorUniformFade * 2f * Vector3.one; } [DrawGizmo(GizmoType.Selected | GizmoType.Active)] - static void DrawGizmosSelected(LocalVolumetricFog densityVolume, GizmoType gizmoType) + static void DrawGizmosSelected(LocalVolumetricFog localVolumetricFog, GizmoType gizmoType) { if (s_BlendBox == null || s_BlendBox.Equals(null) || s_ShapeBox == null || s_ShapeBox.Equals(null)) return; - using (new Handles.DrawingScope(Matrix4x4.TRS(densityVolume.transform.position, densityVolume.transform.rotation, Vector3.one))) + using (new Handles.DrawingScope(Matrix4x4.TRS(localVolumetricFog.transform.position, localVolumetricFog.transform.rotation, Vector3.one))) { // Blend box - s_BlendBox.center = CenterBlendLocalPosition(densityVolume); - s_BlendBox.size = BlendSize(densityVolume); - Color baseColor = densityVolume.parameters.albedo; + s_BlendBox.center = CenterBlendLocalPosition(localVolumetricFog); + s_BlendBox.size = BlendSize(localVolumetricFog); + Color baseColor = localVolumetricFog.parameters.albedo; baseColor.a = 8 / 255f; s_BlendBox.baseColor = baseColor; s_BlendBox.DrawHull(EditMode.editMode == k_EditBlend); // Bounding box. s_ShapeBox.center = Vector3.zero; - s_ShapeBox.size = densityVolume.parameters.size; + s_ShapeBox.size = localVolumetricFog.parameters.size; s_ShapeBox.DrawHull(EditMode.editMode == k_EditShape); } } @@ -106,35 +106,35 @@ void OnSceneGUI() //We cannot rely hereon SerializedLocalVolumetricFog which is the collection of //selected LocalVolumetricFog. Thus code is almost the same of the UI. - LocalVolumetricFog densityVolume = target as LocalVolumetricFog; + LocalVolumetricFog localVolumetricFog = target as LocalVolumetricFog; switch (EditMode.editMode) { case k_EditBlend: - using (new Handles.DrawingScope(Matrix4x4.TRS(densityVolume.transform.position, densityVolume.transform.rotation, Vector3.one))) + using (new Handles.DrawingScope(Matrix4x4.TRS(localVolumetricFog.transform.position, localVolumetricFog.transform.rotation, Vector3.one))) { //contained must be initialized in all case s_ShapeBox.center = Vector3.zero; - s_ShapeBox.size = densityVolume.parameters.size; + s_ShapeBox.size = localVolumetricFog.parameters.size; - Color baseColor = densityVolume.parameters.albedo; + Color baseColor = localVolumetricFog.parameters.albedo; baseColor.a = 8 / 255f; s_BlendBox.baseColor = baseColor; - s_BlendBox.monoHandle = !densityVolume.parameters.m_EditorAdvancedFade; - s_BlendBox.center = CenterBlendLocalPosition(densityVolume); - s_BlendBox.size = BlendSize(densityVolume); + s_BlendBox.monoHandle = !localVolumetricFog.parameters.m_EditorAdvancedFade; + s_BlendBox.center = CenterBlendLocalPosition(localVolumetricFog); + s_BlendBox.size = BlendSize(localVolumetricFog); EditorGUI.BeginChangeCheck(); s_BlendBox.DrawHandle(); if (EditorGUI.EndChangeCheck()) { - Undo.RecordObject(densityVolume, L10n.Tr("Change Local Volumetric Fog Blend")); + Undo.RecordObject(localVolumetricFog, L10n.Tr("Change Local Volumetric Fog Blend")); - if (densityVolume.parameters.m_EditorAdvancedFade) + if (localVolumetricFog.parameters.m_EditorAdvancedFade) { //work in local space to compute the change on positiveFade and negativeFade Vector3 newCenterBlendLocalPosition = s_BlendBox.center; Vector3 halfSize = s_BlendBox.size * 0.5f; - Vector3 size = densityVolume.parameters.size; + Vector3 size = localVolumetricFog.parameters.size; Vector3 posFade = newCenterBlendLocalPosition + halfSize; posFade.x = 0.5f - posFade.x / size.x; posFade.y = 0.5f - posFade.y / size.y; @@ -143,14 +143,14 @@ void OnSceneGUI() negFade.x = 0.5f + negFade.x / size.x; negFade.y = 0.5f + negFade.y / size.y; negFade.z = 0.5f + negFade.z / size.z; - densityVolume.parameters.m_EditorPositiveFade = posFade; - densityVolume.parameters.m_EditorNegativeFade = negFade; + localVolumetricFog.parameters.m_EditorPositiveFade = posFade; + localVolumetricFog.parameters.m_EditorNegativeFade = negFade; } else { float uniformDistance = (s_ShapeBox.size.x - s_BlendBox.size.x) * 0.5f; float max = Mathf.Min(s_ShapeBox.size.x, s_ShapeBox.size.y, s_ShapeBox.size.z) * 0.5f; - densityVolume.parameters.m_EditorUniformFade = Mathf.Clamp(uniformDistance, 0f, max); + localVolumetricFog.parameters.m_EditorUniformFade = Mathf.Clamp(uniformDistance, 0f, max); } } } @@ -158,24 +158,24 @@ void OnSceneGUI() case k_EditShape: //important: if the origin of the handle's space move along the handle, //handles displacement will appears as moving two time faster. - using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, densityVolume.transform.rotation, Vector3.one))) + using (new Handles.DrawingScope(Matrix4x4.TRS(Vector3.zero, localVolumetricFog.transform.rotation, Vector3.one))) { //contained must be initialized in all case - s_ShapeBox.center = Quaternion.Inverse(densityVolume.transform.rotation) * densityVolume.transform.position; - s_ShapeBox.size = densityVolume.parameters.size; + s_ShapeBox.center = Quaternion.Inverse(localVolumetricFog.transform.rotation) * localVolumetricFog.transform.position; + s_ShapeBox.size = localVolumetricFog.parameters.size; - Vector3 previousSize = densityVolume.parameters.size; - Vector3 previousPositiveFade = densityVolume.parameters.m_EditorPositiveFade; - Vector3 previousNegativeFade = densityVolume.parameters.m_EditorNegativeFade; + Vector3 previousSize = localVolumetricFog.parameters.size; + Vector3 previousPositiveFade = localVolumetricFog.parameters.m_EditorPositiveFade; + Vector3 previousNegativeFade = localVolumetricFog.parameters.m_EditorNegativeFade; EditorGUI.BeginChangeCheck(); s_ShapeBox.DrawHandle(); if (EditorGUI.EndChangeCheck()) { - Undo.RecordObjects(new Object[] { densityVolume, densityVolume.transform }, L10n.Tr("Change Local Volumetric Fog Bounding Box")); + Undo.RecordObjects(new Object[] { localVolumetricFog, localVolumetricFog.transform }, L10n.Tr("Change Local Volumetric Fog Bounding Box")); Vector3 newSize = s_ShapeBox.size; - densityVolume.parameters.size = newSize; + localVolumetricFog.parameters.size = newSize; Vector3 newPositiveFade = new Vector3( newSize.x < 0.00001 ? 0 : previousPositiveFade.x * previousSize.x / newSize.x, @@ -207,31 +207,31 @@ void OnSceneGUI() } } } - densityVolume.parameters.m_EditorPositiveFade = newPositiveFade; - densityVolume.parameters.m_EditorNegativeFade = newNegativeFade; + localVolumetricFog.parameters.m_EditorPositiveFade = newPositiveFade; + localVolumetricFog.parameters.m_EditorNegativeFade = newNegativeFade; //update normal mode blend float max = Mathf.Min(newSize.x, newSize.y, newSize.z) * 0.5f; - float newUniformFade = Mathf.Clamp(densityVolume.parameters.m_EditorUniformFade, 0f, max); - densityVolume.parameters.m_EditorUniformFade = newUniformFade; + float newUniformFade = Mathf.Clamp(localVolumetricFog.parameters.m_EditorUniformFade, 0f, max); + localVolumetricFog.parameters.m_EditorUniformFade = newUniformFade; //update engine used percents - if (densityVolume.parameters.m_EditorAdvancedFade) + if (localVolumetricFog.parameters.m_EditorAdvancedFade) { - densityVolume.parameters.positiveFade = newPositiveFade; - densityVolume.parameters.negativeFade = newNegativeFade; + localVolumetricFog.parameters.positiveFade = newPositiveFade; + localVolumetricFog.parameters.negativeFade = newNegativeFade; } else { - densityVolume.parameters.positiveFade = - densityVolume.parameters.negativeFade = new Vector3( + localVolumetricFog.parameters.positiveFade = + localVolumetricFog.parameters.negativeFade = new Vector3( 1.0f - (newSize.x > 0.00000001 ? (newSize.x - newUniformFade) / newSize.x : 0f), 1.0f - (newSize.y > 0.00000001 ? (newSize.y - newUniformFade) / newSize.y : 0f), 1.0f - (newSize.z > 0.00000001 ? (newSize.z - newUniformFade) / newSize.z : 0f)); } - Vector3 delta = densityVolume.transform.rotation * s_ShapeBox.center - densityVolume.transform.position; - densityVolume.transform.position += delta; + Vector3 delta = localVolumetricFog.transform.rotation * s_ShapeBox.center - localVolumetricFog.transform.position; + localVolumetricFog.transform.position += delta; } } break; diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs index 0014e0094ea..afedbb414e7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs @@ -10,9 +10,8 @@ class VolumetricMenuItems static void CreateLocalVolumetricFogGameObject(MenuCommand menuCommand) { var parent = menuCommand.context as GameObject; - var densityVolume = CoreEditorUtils.CreateGameObject("Local Volumetric Fog", parent); - - densityVolume.AddComponent(); + var localVolumetricFog = CoreEditorUtils.CreateGameObject("Local Volumetric Fog", parent); + localVolumetricFog.AddComponent(); } [MenuItem("GameObject/Light/Experimental/Probe Volume", priority = CoreUtils.Sections.section8)] diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs index a7b01775331..36cdb332196 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs @@ -248,7 +248,7 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor EditorGUI.indentLevel++; var lightSettings = serialized.renderPipelineSettings.lightLoopSettings; - CoreEditorUtils.DrawFriendlyNamesEnumPopup(Styles.maxLocalVolumetricFogSizeStyle, lightSettings.maxLocalVolumetricFogSize); + lightSettings.maxLocalVolumetricFogSize.intValue = (int)(LocalVolumetricFogResolution)EditorGUILayout.EnumPopup(Styles.maxLocalVolumetricFogSizeStyle, (LocalVolumetricFogResolution)lightSettings.maxLocalVolumetricFogSize.intValue); EditorGUILayout.PropertyField(lightSettings.maxLocalVolumetricFogsOnScreen, Styles.maxLocalVolumetricFogsOnScreenStyle); lightSettings.maxLocalVolumetricFogsOnScreen.intValue = Mathf.Clamp(lightSettings.maxLocalVolumetricFogsOnScreen.intValue, 1, HDRenderPipeline.k_MaxVisibleLocalVolumetricFogCount); @@ -260,7 +260,7 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor long currentCache = Texture3DAtlas.GetApproxCacheSizeInByte( lightSettings.maxLocalVolumetricFogSize.intValue, lightSettings.maxLocalVolumetricFogsOnScreen.intValue, - LocalVolumetricFogManager.densityVolumeAtlasFormat, + LocalVolumetricFogManager.localVolumetricFogAtlasFormat, true ); @@ -270,7 +270,7 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor HDRenderPipeline.k_MaxCacheSize, lightSettings.maxLocalVolumetricFogSize.intValue, lightSettings.maxLocalVolumetricFogsOnScreen.intValue, - LocalVolumetricFogManager.densityVolumeAtlasFormat, + LocalVolumetricFogManager.localVolumetricFogAtlasFormat, true ); string message = string.Format(Styles.cacheErrorFormat, HDEditorUtils.HumanizeWeight(currentCache), count); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index ace4c00249a..cadd8b8cbbe 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -159,8 +159,6 @@ public class DebugDisplaySettings : IDebugData static int[] s_MaterialFullScreenDebugValues = null; static GUIContent[] s_MsaaSamplesDebugStrings = null; static int[] s_MsaaSamplesDebugValues = null; - static GUIContent[] s_TileAndClusterDebugStrings = null; - static int[] s_TileAndClusterDebugValues = null; static List s_CameraNames = new List(); static GUIContent[] s_CameraNamesStrings = null; @@ -320,8 +318,6 @@ internal DebugDisplaySettings() s_RenderingFullScreenDebugValues = s_RenderingFullScreenDebugValues.Where((val, idx) => (idx + FullScreenDebugMode.MinRenderingFullScreenDebug) != FullScreenDebugMode.QuadOverdraw).ToArray(); } - FillTileClusterDebugEnum(); - s_MaterialFullScreenDebugStrings[(int)FullScreenDebugMode.ValidateDiffuseColor - ((int)FullScreenDebugMode.MinMaterialFullScreenDebug)] = new GUIContent("Diffuse Color"); s_MaterialFullScreenDebugStrings[(int)FullScreenDebugMode.ValidateSpecularColor - ((int)FullScreenDebugMode.MinMaterialFullScreenDebug)] = new GUIContent("Metal or SpecularColor"); @@ -1348,7 +1344,7 @@ void RegisterLightingDebug() { var clusterDebugContainer = new DebugUI.Container(); - clusterDebugContainer.children.Add(new DebugUI.EnumField { displayName = "Tile/Cluster Debug By Category", getter = () => (int)data.lightingDebugSettings.tileClusterDebugByCategory, setter = value => data.lightingDebugSettings.tileClusterDebugByCategory = (TileClusterCategoryDebug)value, enumNames = s_TileAndClusterDebugStrings, enumValues = s_TileAndClusterDebugValues, getIndex = () => data.tileClusterDebugByCategoryEnumIndex, setIndex = value => data.tileClusterDebugByCategoryEnumIndex = value }); + clusterDebugContainer.children.Add(new DebugUI.EnumField { displayName = "Tile/Cluster Debug By Category", getter = () => (int)data.lightingDebugSettings.tileClusterDebugByCategory, setter = value => data.lightingDebugSettings.tileClusterDebugByCategory = (TileClusterCategoryDebug)value, autoEnum = typeof(TileClusterCategoryDebug), getIndex = () => data.tileClusterDebugByCategoryEnumIndex, setIndex = value => data.tileClusterDebugByCategoryEnumIndex = value }); if (data.lightingDebugSettings.tileClusterDebug == TileClusterDebug.Cluster) { clusterDebugContainer.children.Add(new DebugUI.EnumField { displayName = "Cluster Debug Mode", getter = () => (int)data.lightingDebugSettings.clusterDebugMode, setter = value => data.lightingDebugSettings.clusterDebugMode = (ClusterDebugMode)value, autoEnum = typeof(ClusterDebugMode), onValueChanged = RefreshLightingDebug, getIndex = () => data.clusterDebugModeEnumIndex, setIndex = value => data.clusterDebugModeEnumIndex = value }); @@ -1423,8 +1419,8 @@ void RegisterLightingDebug() { children = { - new DebugUI.UIntField { displayName = "Slice", getter = () => data.lightingDebugSettings.densityVolumeAtlasSlice, setter = value => data.lightingDebugSettings.densityVolumeAtlasSlice = value, min = () => 0, max = () => GetLocalVolumetricFogSliceCount()}, - new DebugUI.BoolField { displayName = "Use Selection", getter = () => data.lightingDebugSettings.densityVolumeUseSelection, setter = value => data.lightingDebugSettings.densityVolumeUseSelection = value, flags = DebugUI.Flags.EditorOnly, onValueChanged = RefreshLightingDebug}, + new DebugUI.UIntField { displayName = "Slice", getter = () => data.lightingDebugSettings.localVolumetricFogAtlasSlice, setter = value => data.lightingDebugSettings.localVolumetricFogAtlasSlice = value, min = () => 0, max = () => GetLocalVolumetricFogSliceCount()}, + new DebugUI.BoolField { displayName = "Use Selection", getter = () => data.lightingDebugSettings.localVolumetricFogUseSelection, setter = value => data.lightingDebugSettings.localVolumetricFogUseSelection = value, flags = DebugUI.Flags.EditorOnly, onValueChanged = RefreshLightingDebug}, } }); } @@ -1432,12 +1428,12 @@ void RegisterLightingDebug() uint GetLocalVolumetricFogSliceCount() { #if UNITY_EDITOR - if (data.lightingDebugSettings.densityVolumeUseSelection) + if (data.lightingDebugSettings.localVolumetricFogUseSelection) { var selectedGO = UnityEditor.Selection.activeGameObject; - if (selectedGO != null && selectedGO.TryGetComponent(out var densityVolume)) + if (selectedGO != null && selectedGO.TryGetComponent(out var localVolumetricFog)) { - var texture = densityVolume.parameters.volumeMask; + var texture = localVolumetricFog.parameters.volumeMask; if (texture != null) return (uint)(texture is RenderTexture rt ? rt.volumeDepth : texture is Texture3D t3D ? t3D.depth : 1) - 1; @@ -1889,12 +1885,6 @@ void FillFullScreenDebugEnum(ref GUIContent[] strings, ref int[] values, FullScr } } - void FillTileClusterDebugEnum() - { - s_TileAndClusterDebugStrings = CoreUtils.GetEnumFriendlyNames(); - s_TileAndClusterDebugValues = (int[])Enum.GetValues(typeof(TileClusterCategoryDebug)); - } - static string FormatVector(Vector3 v) { return string.Format("({0:F6}, {1:F6}, {2:F6})", v.x, v.y, v.z); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs index beda57bde92..294cf78325b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs @@ -226,7 +226,7 @@ internal enum ProbeVolumeAtlasSliceMode /// Lighting Debug Settings. /// [Serializable] - public class LightingDebugSettings + public partial class LightingDebugSettings { /// /// Returns true if any lighting debug mode is enabled. @@ -314,9 +314,6 @@ public bool IsDebugDisplayEnabled() public ExposureDebugMode exposureDebugMode = ExposureDebugMode.None; /// Exposure compensation to apply on current scene exposure. public float debugExposure = 0.0f; - /// Obsolete, please use the lens attenuation mode in HDRP Default Settings. - [Obsolete("Please use the lens attenuation mode in HDRP Default Settings", true)] - public float debugLensAttenuation = 0.65f; /// Whether to show tonemap curve in the histogram debug view or not. public bool showTonemapCurveAlongHistogramView = true; /// Whether to center the histogram debug view around the middle-grey point or not. @@ -352,21 +349,15 @@ public bool IsDebugDisplayEnabled() public bool showAreaLight = true; /// True if reflection probes lights should be displayed in the scene. public bool showReflectionProbe = true; - + /// Display the Local Volumetric Fog atlas. - [Obsolete("Use displayLocalVolumetricFogAtlas instead", false)] - public bool displayDensityVolumeAtlas - { - get => displayLocalVolumetricFogAtlas; - set => displayLocalVolumetricFogAtlas = value; - } + public bool displayLocalVolumetricFogAtlas = false; - /// Display the Local Volumetric Fog atlas. - public bool displayLocalVolumetricFogAtlas = false; /// Local Volumetric Fog atlas slice. - public uint densityVolumeAtlasSlice = 0; + public uint localVolumetricFogAtlasSlice = 0; + /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. - public bool densityVolumeUseSelection = false; + public bool localVolumetricFogUseSelection = false; /// Tile and Cluster debug mode. public TileClusterDebug tileClusterDebug = TileClusterDebug.None; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs new file mode 100644 index 00000000000..e897e87b5a2 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -0,0 +1,214 @@ +using System; + +namespace UnityEngine.Rendering.HighDefinition +{ + /// + /// Possible values for one element of the Local Volumetric Fog atlas. + /// + [Serializable] + [Obsolete("DensityVolumeResolution has been deprecated (UnityUpgradable) -> LocalVolumetricFogResolution", false)] + public enum DensityVolumeResolution + { + /// 3D volume of 32x32x32 voxels. + Resolution32 = 32, + /// 3D volume of 64x64x64 voxels. + Resolution64 = 64, + /// 3D volume of 128x128x128 voxels. + Resolution128 = 128, + /// 3D volume of 256x256x256 voxels. + Resolution256 = 256, + } + + public partial struct GlobalLightLoopSettings + { + // We keep this property for the migration code (we need to know how many cookies we could have before). + [SerializeField, Obsolete("There is no more texture array for cookies, use cookie atlases properties instead.", false)] + internal int cookieTexArraySize; + + /// Maximum size of one Local Volumetric Fog texture. + [Obsolete("Use maxLocalVolumetricFogSize instead", false)] + public DensityVolumeResolution maxDensityVolumeSize + { + get => (DensityVolumeResolution)maxLocalVolumetricFogSize; + set => maxLocalVolumetricFogSize = (LocalVolumetricFogResolution)value; + } + + /// Maximum number of Local Volumetric Fog at the same time on screen. + [Obsolete("Use maxLocalVolumetricFogsOnScreen instead", false)] + public int maxDensityVolumesOnScreen + { + get => maxLocalVolumetricFogsOnScreen; + set => maxLocalVolumetricFogsOnScreen = value; + } + } + + /// Deprecated DensityVolume + [Obsolete("LocalVolumetricFog has been deprecated (UnityUpgradable) -> Local Volumetric Fog", false)] + public class DensityVolume : LocalVolumetricFog + { + } + + /// + [GenerateHLSL] + [Obsolete("DensityVolumeFalloffMode has been deprecated (UnityUpgradable) -> LocalVolumetricFogFalloffMode", false)] + public enum DensityVolumeFalloffMode + { + /// + Linear, + /// + Exponential, + } + + /// Deprecated DensityVolumeArtistParameters + [Obsolete("DensityVolumeArtistParameters has been deprecated (UnityUpgradable) -> LocalVolumetricFogArtistParameters", false)] + public struct DensityVolumeArtistParameters + { + LocalVolumetricFogArtistParameters m_Parameters; + + /// Single scattering albedo: [0, 1]. Alpha is ignored. + public Color albedo + { + get => m_Parameters.albedo; + set => m_Parameters.albedo = value; + } + + /// Mean free path, in meters: [1, inf]. + public float meanFreePath + { + get => m_Parameters.meanFreePath; + set => m_Parameters.meanFreePath = value; + } + + /// Anisotropy of the phase function: [-1, 1]. Positive values result in forward scattering, and negative values - in backward scattering. + public float anisotropy + { + get => m_Parameters.anisotropy; + set => m_Parameters.anisotropy = value; + } + + /// Texture containing density values. + public Texture volumeMask + { + get => m_Parameters.volumeMask; + set => m_Parameters.volumeMask = value; + } + + /// Scrolling speed of the density texture. + public Vector3 textureScrollingSpeed + { + get => m_Parameters.textureScrollingSpeed; + set => m_Parameters.textureScrollingSpeed = value; + } + + /// Tiling rate of the density texture. + public Vector3 textureTiling + { + get => m_Parameters.textureTiling; + set => m_Parameters.textureTiling = value; + } + + /// Edge fade factor along the positive X, Y and Z axes. + public Vector3 positiveFade + { + get => m_Parameters.positiveFade; + set => m_Parameters.positiveFade = value; + } + + /// Edge fade factor along the negative X, Y and Z axes. + public Vector3 negativeFade + { + get => m_Parameters.negativeFade; + set => m_Parameters.negativeFade = value; + } + + /// Dimensions of the volume. + public Vector3 size + { + get => m_Parameters.size; + set => m_Parameters.size = value; + } + + /// Inverts the fade gradient. + public bool invertFade + { + get => m_Parameters.invertFade; + set => m_Parameters.invertFade = value; + } + + /// Distance at which density fading starts. + public float distanceFadeStart + { + get => m_Parameters.distanceFadeStart; + set => m_Parameters.distanceFadeStart = value; + } + + /// Distance at which density fading ends. + public float distanceFadeEnd + { + get => m_Parameters.distanceFadeEnd; + set => m_Parameters.distanceFadeEnd = value; + } + + /// Allows translation of the tiling density texture. + [SerializeField] + public Vector3 textureOffset + { + get => m_Parameters.textureOffset; + set => m_Parameters.textureOffset = value; + } + + /// When Blend Distance is above 0, controls which kind of falloff is applied to the transition area. + public DensityVolumeFalloffMode falloffMode + { + get => (DensityVolumeFalloffMode) m_Parameters.falloffMode; + set => m_Parameters.falloffMode = (LocalVolumetricFogFalloffMode) value; + } + + /// Constructor. + /// Single scattering albedo. + /// Mean free path. + /// Anisotropy. + public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _anisotropy) + { + m_Parameters = new LocalVolumetricFogArtistParameters(color, _meanFreePath, _anisotropy); + } + } + + public partial struct LocalVolumetricFogArtistParameters + { + /// Obsolete, do not use. + [Obsolete("Never worked correctly due to having engine working in percent. Will be removed soon.")] + public bool advancedFade => true; + } + + public partial class LightingDebugSettings + { + /// Obsolete, please use the lens attenuation mode in HDRP Default Settings. + [Obsolete("Please use the lens attenuation mode in HDRP Default Settings", true)] + public float debugLensAttenuation = 0.65f; + + /// Display the Local Volumetric Fog atlas. + [Obsolete("Use displayLocalVolumetricFogAtlas instead", false)] + public bool displayDensityVolumeAtlas + { + get => displayLocalVolumetricFogAtlas; + set => displayLocalVolumetricFogAtlas = value; + } + + /// Local Volumetric Fog atlas slice. + [Obsolete("Use localVolumetricFogAtlasSlice instead", false)] + public uint densityVolumeAtlasSlice + { + get => localVolumetricFogAtlasSlice; + set => localVolumetricFogAtlasSlice = value; + } + + /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. + [Obsolete("Use localVolumetricFogUseSelection instead", false)] + public bool densityVolumeUseSelection + { + get => localVolumetricFogUseSelection; + set => localVolumetricFogUseSelection = value; + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs.meta new file mode 100644 index 00000000000..d44054ac2a7 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d990601afff56de429147b9fdb7e5778 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs index 6b75dd04360..8b26488ee2f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs @@ -114,23 +114,6 @@ public enum CubeCookieResolution CubeCookieResolution4096 = 4096 } - /// - /// Possible values for one element of the Local Volumetric Fog atlas. - /// - [Serializable] - [Obsolete("DensityVolumeResolution has been deprecated (UnityUpgradable) -> LocalVolumetricFogResolution", false)] - public enum DensityVolumeResolution - { - /// 3D volume of 32x32x32 voxels. - Resolution32 = 32, - /// 3D volume of 64x64x64 voxels. - Resolution64 = 64, - /// 3D volume of 128x128x128 voxels. - Resolution128 = 128, - /// 3D volume of 256x256x256 voxels. - Resolution256 = 256, - } - /// /// Possible values for one element of the Local Volumetric Fog atlas. /// @@ -138,16 +121,16 @@ public enum DensityVolumeResolution public enum LocalVolumetricFogResolution { /// 3D volume of 32x32x32 voxels. - [Description("32x32x32")] + [InspectorName("32x32x32")] Resolution32 = 32, /// 3D volume of 64x64x64 voxels. - [Description("64x64x64")] + [InspectorName("64x64x64")] Resolution64 = 64, /// 3D volume of 128x128x128 voxels. - [Description("128x128x128")] + [InspectorName("128x128x128")] Resolution128 = 128, /// 3D volume of 256x256x256 voxels. - [Description("256x256x256")] + [InspectorName("256x256x256")] Resolution256 = 256, } @@ -155,7 +138,7 @@ public enum LocalVolumetricFogResolution /// Global Light Loop Settings. /// [Serializable] - public struct GlobalLightLoopSettings + public partial struct GlobalLightLoopSettings { internal static readonly GlobalLightLoopSettings @default = default; /// Default GlobalDecalSettings @@ -202,9 +185,6 @@ public struct GlobalLightLoopSettings #endif /// Last valid mip for cookie atlas. public int cookieAtlasLastValidMip; - // We keep this property for the migration code (we need to know how many cookies we could have before). - [SerializeField, Obsolete("There is no more texture array for cookies, use cookie atlases properties instead.")] - internal int cookieTexArraySize; /// Planar reflections atlas resolution. [FormerlySerializedAs("planarReflectionTextureSize")] @@ -240,22 +220,6 @@ public struct GlobalLightLoopSettings /// Maximum number of lights per ray tracing light cluster cell. public int maxLightsPerClusterCell; - /// Maximum size of one Local Volumetric Fog texture. - [Obsolete("Use maxLocalVolumetricFogSize instead", false)] - public DensityVolumeResolution maxDensityVolumeSize - { - get => (DensityVolumeResolution) maxLocalVolumetricFogSize; - set => maxLocalVolumetricFogSize = (LocalVolumetricFogResolution) value; - } - - /// Maximum number of Local Volumetric Fog at the same time on screen. - [Obsolete("Use maxLocalVolumetricFogsOnScreen instead", false)] - public int maxDensityVolumesOnScreen - { - get => maxLocalVolumetricFogsOnScreen; - set => maxLocalVolumetricFogsOnScreen = value; - } - /// Maximum size of one Local Volumetric Fog texture. public LocalVolumetricFogResolution maxLocalVolumetricFogSize; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index a00c67a121b..49736474100 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -204,32 +204,31 @@ public enum TileClusterCategoryDebug : int /// Area lights. Area = 2, /// Area and punctual lights. - [Description("Area and Punctual")] + [InspectorName("Area and Punctual")] AreaAndPunctual = 3, /// Environment lights. - [Description("Reflection Probes")] + [InspectorName("Reflection Probes")] Environment = 4, /// Environment and punctual lights. - [Description("Reflection Probes and Punctual")] + [InspectorName("Reflection Probes and Punctual")] EnvironmentAndPunctual = 5, /// Environment and area lights. - [Description("Reflection Probes and Area")] + [InspectorName("Reflection Probes and Area")] EnvironmentAndArea = 6, /// All lights. - [Description("Reflection Probes, Area and Punctual")] + [InspectorName("Reflection Probes, Area and Punctual")] EnvironmentAndAreaAndPunctual = 7, /// Probe Volumes. - [Description("Probe Volumes")] + [InspectorName("Probe Volumes")] ProbeVolumes = 8, /// Decals. Decal = 16, /// Local Volumetric Fog. + LocalVolumetricFogs = 32, + /// Local Volumetric Fog. [Obsolete("Use LocalVolumetricFogs", false)] - [Description("Local Volumetric Fogs")] - DensityVolumes = 32, - - [Description("Local Volumetric Fogs")] - LocalVolumetricFogs = 32 + [InspectorName("Local Volumetric Fogs")] + DensityVolumes = 32 }; [GenerateHLSL(needAccessors = false, generateCBuffer = true)] @@ -2572,8 +2571,14 @@ void PrepareGPUProbeData(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu } // Return true if BakedShadowMask are enabled - bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cullResults, - HDProbeCullingResults hdProbeCullingResults, LocalVolumetricFogList densityVolumes, DebugDisplaySettings debugDisplaySettings, AOVRequestData aovRequest) + bool PrepareLightsForGPU( + CommandBuffer cmd, + HDCamera hdCamera, + CullingResults cullResults, + HDProbeCullingResults hdProbeCullingResults, + LocalVolumetricFogList localVolumetricFogList, + DebugDisplaySettings debugDisplaySettings, + AOVRequestData aovRequest) { var debugLightFilter = debugDisplaySettings.GetDebugLightFilterMode(); var hasDebugLightFilter = debugLightFilter != DebugLightFilterMode.None; @@ -2656,7 +2661,7 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu } // Inject Local Volumetric Fog into the clustered data structure for efficient look up. - m_LocalVolumetricFogCount = densityVolumes.bounds != null ? densityVolumes.bounds.Count : 0; + m_LocalVolumetricFogCount = localVolumetricFogList.bounds != null ? localVolumetricFogList.bounds.Count : 0; for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex) { @@ -2672,7 +2677,7 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu { // Local Volumetric Fog are not lights and therefore should not affect light classification. LightFeatureFlags featureFlags = 0; - CreateBoxVolumeDataAndBound(densityVolumes.bounds[i], LightCategory.LocalVolumetricFog, featureFlags, worldToViewCR, 0.0f, out LightVolumeData volumeData, out SFiniteLightBound bound); + CreateBoxVolumeDataAndBound(localVolumetricFogList.bounds[i], LightCategory.LocalVolumetricFog, featureFlags, worldToViewCR, 0.0f, out LightVolumeData volumeData, out SFiniteLightBound bound); m_lightList.lightsPerView[viewIndex].lightVolumes.Add(volumeData); m_lightList.lightsPerView[viewIndex].bounds.Add(bound); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.Migration.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.Migration.cs index dd4077593ae..173b1ea851b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.Migration.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.Migration.cs @@ -4,10 +4,6 @@ namespace UnityEngine.Rendering.HighDefinition { public partial struct LocalVolumetricFogArtistParameters { - /// Obsolete, do not use. - [Obsolete("Never worked correctly due to having engine working in percent. Will be removed soon.")] - public bool advancedFade => true; - internal void MigrateToFixUniformBlendDistanceToBeMetric() { //Note: At this revision, advanceMode boolean is obsolete and unusable anymore diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs index 075054b04a3..d378dd5a1d8 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFog.cs @@ -256,125 +256,4 @@ private void OnValidate() parameters.Constrain(); } } - - /// Deprecated DensityVolume - [Obsolete("LocalVolumetricFog has been deprecated (UnityUpgradable) -> Local Volumetric Fog", false)] - public class DensityVolume : LocalVolumetricFog - { - } - - /// Deprecated DensityVolume - [Obsolete("DensityVolumeArtistParameters has been deprecated (UnityUpgradable) -> LocalVolumetricFogArtistParameters", false)] - public struct DensityVolumeArtistParameters - { - LocalVolumetricFogArtistParameters m_Parameters; - - /// Single scattering albedo: [0, 1]. Alpha is ignored. - public Color albedo - { - get => m_Parameters.albedo; - set => m_Parameters.albedo = value; - } - - /// Mean free path, in meters: [1, inf]. - public float meanFreePath - { - get => m_Parameters.meanFreePath; - set => m_Parameters.meanFreePath = value; - } - - /// Anisotropy of the phase function: [-1, 1]. Positive values result in forward scattering, and negative values - in backward scattering. - public float anisotropy - { - get => m_Parameters.anisotropy; - set => m_Parameters.anisotropy = value; - } - - /// Texture containing density values. - public Texture volumeMask - { - get => m_Parameters.volumeMask; - set => m_Parameters.volumeMask = value; - } - - /// Scrolling speed of the density texture. - public Vector3 textureScrollingSpeed - { - get => m_Parameters.textureScrollingSpeed; - set => m_Parameters.textureScrollingSpeed = value; - } - - /// Tiling rate of the density texture. - public Vector3 textureTiling - { - get => m_Parameters.textureTiling; - set => m_Parameters.textureTiling = value; - } - - /// Edge fade factor along the positive X, Y and Z axes. - public Vector3 positiveFade - { - get => m_Parameters.positiveFade; - set => m_Parameters.positiveFade = value; - } - - /// Edge fade factor along the negative X, Y and Z axes. - public Vector3 negativeFade - { - get => m_Parameters.negativeFade; - set => m_Parameters.negativeFade = value; - } - - /// Dimensions of the volume. - public Vector3 size - { - get => m_Parameters.size; - set => m_Parameters.size = value; - } - - /// Inverts the fade gradient. - public bool invertFade - { - get => m_Parameters.invertFade; - set => m_Parameters.invertFade = value; - } - - /// Distance at which density fading starts. - public float distanceFadeStart - { - get => m_Parameters.distanceFadeStart; - set => m_Parameters.distanceFadeStart = value; - } - - /// Distance at which density fading ends. - public float distanceFadeEnd - { - get => m_Parameters.distanceFadeEnd; - set => m_Parameters.distanceFadeEnd = value; - } - - /// Allows translation of the tiling density texture. - [SerializeField] - public Vector3 textureOffset - { - get => m_Parameters.textureOffset; - set => m_Parameters.textureOffset = value; - } - - /// When Blend Distance is above 0, controls which kind of falloff is applied to the transition area. - public DensityVolumeFalloffMode falloffMode - { - get => (DensityVolumeFalloffMode) m_Parameters.falloffMode; - set => m_Parameters.falloffMode = (LocalVolumetricFogFalloffMode) value; - } - - /// Constructor. - /// Single scattering albedo. - /// Mean free path. - /// Anisotropy. - public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _anisotropy) - { - m_Parameters = new LocalVolumetricFogArtistParameters(color, _meanFreePath, _anisotropy); - } - } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs index e4637655a42..b68d5a6aa43 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs @@ -5,7 +5,7 @@ namespace UnityEngine.Rendering.HighDefinition { class LocalVolumetricFogManager { - public static readonly GraphicsFormat densityVolumeAtlasFormat = GraphicsFormat.R8G8B8A8_UNorm; + public static readonly GraphicsFormat localVolumetricFogAtlasFormat = GraphicsFormat.R8G8B8A8_UNorm; static LocalVolumetricFogManager m_Manager; public static LocalVolumetricFogManager manager @@ -32,13 +32,13 @@ public Texture3DAtlas volumeAtlas HDRenderPipeline.k_MaxCacheSize, (int)settings.maxLocalVolumetricFogSize, settings.maxLocalVolumetricFogsOnScreen, - densityVolumeAtlasFormat, + localVolumetricFogAtlasFormat, true ); elementCount = Mathf.Clamp(elementCount, 1, settings.maxLocalVolumetricFogsOnScreen); - m_VolumeAtlas = new Texture3DAtlas(densityVolumeAtlasFormat, (int)settings.maxLocalVolumetricFogSize, elementCount); + m_VolumeAtlas = new Texture3DAtlas(localVolumetricFogAtlasFormat, (int)settings.maxLocalVolumetricFogSize, elementCount); // When HDRP is initialized and this atlas created, some Local Volumetric Fog may have been initialized before so we add them here. foreach (var volume in m_Volumes) @@ -66,7 +66,7 @@ public void RegisterVolume(LocalVolumetricFog volume) // In case the Local Volumetric Fog format is not support (which is impossible because all HDRP target supports R8G8B8A8_UNorm) // we avoid doing operations on the atlas. // This happens in the CI on linux when an editor using OpenGL is building a player for Vulkan. - if (!SystemInfo.IsFormatSupported(densityVolumeAtlasFormat, FormatUsage.LoadStore)) + if (!SystemInfo.IsFormatSupported(localVolumetricFogAtlasFormat, FormatUsage.LoadStore)) return; if (volume.parameters.volumeMask != null) @@ -92,7 +92,7 @@ public void DeRegisterVolume(LocalVolumetricFog volume) // In case the Local Volumetric Fog format is not support (which is impossible because all HDRP target supports R8G8B8A8_UNorm) // we avoid doing operations on the atlas. // This happens in the CI on linux when an editor using OpenGL is building a player for Vulkan. - if (!SystemInfo.IsFormatSupported(densityVolumeAtlasFormat, FormatUsage.LoadStore)) + if (!SystemInfo.IsFormatSupported(localVolumetricFogAtlasFormat, FormatUsage.LoadStore)) return; if (volume.parameters.volumeMask != null) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs index 924375b9199..fdc95e53049 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs @@ -80,17 +80,6 @@ unsafe struct ShaderVariablesVolumetric public uint _Pad1_SVV; } - /// - [GenerateHLSL] - [Obsolete("DensityVolumeFalloffMode has been deprecated (UnityUpgradable) -> LocalVolumetricFogFalloffMode", false)] - public enum DensityVolumeFalloffMode - { - /// - Linear, - /// - Exponential, - } - /// [GenerateHLSL] public enum LocalVolumetricFogFalloffMode @@ -691,10 +680,10 @@ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, HDCame LocalVolumetricFogList PrepareVisibleLocalVolumetricFogList(HDCamera hdCamera, CommandBuffer cmd) { - LocalVolumetricFogList densityVolumes = new LocalVolumetricFogList(); + LocalVolumetricFogList localVolumetricFog = new LocalVolumetricFogList(); if (!Fog.IsVolumetricFogEnabled(hdCamera)) - return densityVolumes; + return localVolumetricFog; using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.PrepareVisibleLocalVolumetricFogList))) { @@ -739,10 +728,10 @@ LocalVolumetricFogList PrepareVisibleLocalVolumetricFogList(HDCamera hdCamera, C m_VisibleVolumeDataBuffer.SetData(m_VisibleVolumeData); // Fill the struct with pointers in order to share the data with the light loop. - densityVolumes.bounds = m_VisibleVolumeBounds; - densityVolumes.density = m_VisibleVolumeData; + localVolumetricFog.bounds = m_VisibleVolumeBounds; + localVolumetricFog.density = m_VisibleVolumeData; - return densityVolumes; + return localVolumetricFog; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs index 20e9b870d78..13d3d455291 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs @@ -517,9 +517,9 @@ void RenderLocalVolumetricFogAtlasDebugOverlay(RenderGraph renderGraph, TextureH passData.colorBuffer = builder.UseColorBuffer(colorBuffer, 0); passData.depthBuffer = builder.UseDepthBuffer(depthBuffer, DepthAccess.ReadWrite); passData.debugLocalVolumetricFogMaterial = m_DebugLocalVolumetricFogMaterial; - passData.slice = (float)m_CurrentDebugDisplaySettings.data.lightingDebugSettings.densityVolumeAtlasSlice; + passData.slice = (float)m_CurrentDebugDisplaySettings.data.lightingDebugSettings.localVolumetricFogAtlasSlice; passData.atlas = LocalVolumetricFogManager.manager.volumeAtlas; - passData.useSelection = m_CurrentDebugDisplaySettings.data.lightingDebugSettings.densityVolumeUseSelection; + passData.useSelection = m_CurrentDebugDisplaySettings.data.lightingDebugSettings.localVolumetricFogUseSelection; builder.SetRenderFunc( (RenderLocalVolumetricFogAtlasDebugOverlayPassData data, RenderGraphContext ctx) => @@ -536,9 +536,9 @@ void RenderLocalVolumetricFogAtlasDebugOverlay(RenderGraph renderGraph, TextureH { var obj = UnityEditor.Selection.activeGameObject; - if (obj != null && obj.TryGetComponent(out var densityVolume)) + if (obj != null && obj.TryGetComponent(out var localVolumetricFog)) { - var texture = densityVolume.parameters.volumeMask; + var texture = localVolumetricFog.parameters.volumeMask; if (texture != null) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index d82ba28e0c6..93dba4a251d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -1976,7 +1976,7 @@ AOVRequestData aovRequest material.Bind(cmd); // Frustum cull Local Volumetric Fog on the CPU. Can be performed as soon as the camera is set up. - LocalVolumetricFogList densityVolumes = PrepareVisibleLocalVolumetricFogList(hdCamera, cmd); + LocalVolumetricFogList localVolumetricFog = PrepareVisibleLocalVolumetricFogList(hdCamera, cmd); // do AdaptiveProbeVolume stuff BindAPVRuntimeResources(cmd, hdCamera); @@ -1987,7 +1987,7 @@ AOVRequestData aovRequest // Currently to know if you need shadow mask you need to go through all visible lights (of CullResult), check the LightBakingOutput struct and look at lightmapBakeType/mixedLightingMode. If one light have shadow mask bake mode, then you need shadow mask features (i.e extra Gbuffer). // It mean that when we build a standalone player, if we detect a light with bake shadow mask, we generate all shader variant (with and without shadow mask) and at runtime, when a bake shadow mask light is visible, we dynamically allocate an extra GBuffer and switch the shader. // So the first thing to do is to go through all the light: PrepareLightsForGPU - bool enableBakeShadowMask = PrepareLightsForGPU(cmd, hdCamera, cullingResults, hdProbeCullingResults, densityVolumes, m_CurrentDebugDisplaySettings, aovRequest); + bool enableBakeShadowMask = PrepareLightsForGPU(cmd, hdCamera, cullingResults, hdProbeCullingResults, localVolumetricFog, m_CurrentDebugDisplaySettings, aovRequest); UpdateGlobalConstantBuffers(hdCamera, cmd); From c88233a9e066aade95cda132a13b60bf50ce0e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Thu, 11 Mar 2021 14:56:05 +0100 Subject: [PATCH 09/27] Format --- .../Runtime/Utilities/CoreUtils.cs | 3 --- .../Runtime/Debug/LightingDebug.cs | 2 +- .../Runtime/Deprecated.cs | 4 ++-- .../Runtime/Lighting/LightLoop/LightLoop.cs.hlsl | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs index 691318ec0be..8c446925204 100644 --- a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs +++ b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; -using System.Reflection; -using UnityEditor; using UnityEngine.Experimental.Rendering; namespace UnityEngine.Rendering diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs index 294cf78325b..11a5bfd3670 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs @@ -349,7 +349,7 @@ public bool IsDebugDisplayEnabled() public bool showAreaLight = true; /// True if reflection probes lights should be displayed in the scene. public bool showReflectionProbe = true; - + /// Display the Local Volumetric Fog atlas. public bool displayLocalVolumetricFogAtlas = false; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs index e897e87b5a2..553cac894ef 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -160,8 +160,8 @@ public Vector3 textureOffset /// When Blend Distance is above 0, controls which kind of falloff is applied to the transition area. public DensityVolumeFalloffMode falloffMode { - get => (DensityVolumeFalloffMode) m_Parameters.falloffMode; - set => m_Parameters.falloffMode = (LocalVolumetricFogFalloffMode) value; + get => (DensityVolumeFalloffMode)m_Parameters.falloffMode; + set => m_Parameters.falloffMode = (LocalVolumetricFogFalloffMode)value; } /// Constructor. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl index 125effb22b1..123382ceff5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl @@ -19,7 +19,6 @@ #define LIGHTCATEGORY_AREA (1) #define LIGHTCATEGORY_ENV (2) #define LIGHTCATEGORY_DECAL (3) -#define LIGHTCATEGORY_DENSITY_VOLUME (4) #define LIGHTCATEGORY_LOCAL_VOLUMETRIC_FOG (4) #define LIGHTCATEGORY_COUNT (5) From ddb60ec386abf4a3b15e1f8f20cb569a14eec73a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Thu, 11 Mar 2021 15:19:46 +0100 Subject: [PATCH 10/27] update whats-new --- .../Documentation~/whats-new-12.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md index 4dc3a2a0f8f..457ecec4809 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md @@ -15,7 +15,9 @@ Group of Materials / GameObject can be setup to use Force Emissive forward with ## Improvements -### Local Volumetric Fog Improvements +### Density Volume (Local Volumetric Fog) Improvements + +Density Volumes are now known as **Local Volumetric Fog**. This will help users know that is not a Volume (from the Volumes Framework ) and that is related to fog. Local Volumetric Fog 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. @@ -69,7 +71,7 @@ From HDRP 12.0, various top level menus are now different. This is to make the t * **C# Custom Pass** is now at **Assets > Create > Rendering > HDRP C# Custom Pass** * **C# Post Process Volume** is now at **Assets > Create > Rendering > HDRP C# Post Process Volume** * **GameObject** - * **Density Volume** is now at **GameObject > Volume > Local Volumetric Fog** + * **Density Volume** is now at **GameObject > Local Volumetric Fog** * **Decal Projector** is now at **GameObject > Decal Projector** * **Sky and Fog Volume** is now at **GameObject > Volume > Sky and Fog Global Volume** From 89d5bad66cb630569d045f0ca957f89b3b22dcfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Thu, 11 Mar 2021 15:34:16 +0100 Subject: [PATCH 11/27] Upgrading guide update --- .../Documentation~/Upgrading-from-2021.1-to-2021.2.md | 4 ++++ .../Runtime/Deprecated.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md index 30d0dc20c13..89cc41a9e33 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md @@ -5,3 +5,7 @@ From 2021.2, if material ambient occlusion needs to be applied to probe volume GI and the material is deferred, the material needs to define `HAS_PAYLOAD_WITH_UNINIT_GI` constant and a function `float GetUninitializedGIPayload(SurfaceData surfaceData)` that returns the AO factor that is desired to be applied. No action is needed for forward only materials or if no material AO needs to be applied to probe volume GI. HDRP 2021.2 includes the "ForwardEmissiveForDeferred" shader pass and the associated SHADERPASS_FORWARD_EMISSIVE_FOR_DEFERRED define for Materials that have a GBuffer pass. You can see the new pass in Lit.shader. When you use the Deferred Lit shader mode, Unity uses "ForwardEmissiveForDeferred" to render the emissive contribution of a Material in a separate forward pass. Otherwise, Unity ignores "ForwardEmissiveForDeferred". + +## Density Volumes + +As **Density Volume** has been renamed to **Local Volumetric Fog**, you won't need to worry about the game objects using the old component, as the serialization is taking into account the GUID and not the component name. Whereas, if you are referencing **Density Volume** class through your scripts, you will notice a warning (**DensityVolume has been deprecated (UnityUpgradable) -> Local Volumetric Fog**) so change your code and target the new component. This might stop compiling your project in future versions. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs index 553cac894ef..ef319a3f55f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -43,7 +43,7 @@ public int maxDensityVolumesOnScreen } /// Deprecated DensityVolume - [Obsolete("LocalVolumetricFog has been deprecated (UnityUpgradable) -> Local Volumetric Fog", false)] + [Obsolete("DensityVolume has been deprecated (UnityUpgradable) -> Local Volumetric Fog", false)] public class DensityVolume : LocalVolumetricFog { } From 2129ff10e2045bd13da664c0b580779bdb6d3d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Thu, 11 Mar 2021 15:59:18 +0100 Subject: [PATCH 12/27] Removing s from LocalVolumetricFogs --- .../Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs | 2 +- .../Editor/RenderPipeline/HDRenderPipelineUI.cs | 10 +++++----- .../Settings/SerializedGlobalLightLoopSettings.cs | 4 ++-- .../Runtime/Debug/LightingDebug.cs | 2 -- .../Runtime/Deprecated.cs | 6 +++--- .../Lighting/LightLoop/GlobalLightLoopSettings.cs | 4 ++-- .../Runtime/Lighting/LightLoop/LightLoop.cs | 4 ++-- .../VolumetricLighting/LocalVolumetricFogManager.cs | 4 ++-- .../VolumetricLighting/VolumeVoxelization.compute | 2 +- .../Lighting/VolumetricLighting/VolumetricLighting.cs | 4 ++-- .../VolumetricLighting/VolumetricLighting.cs.hlsl | 2 +- 11 files changed, 21 insertions(+), 23 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index b45a1d2e2f8..5e2fa6a826d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -181,7 +181,7 @@ 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; public static readonly GUIContent probeVolumeSHBands = EditorGUIUtility.TrTextContent("SH Bands", "Determines up to what SH bands the Probe Volume will use. Chosing L2 will lead to better quality, but also higher memory and runtime cost."); public static readonly GUIContent maxLocalVolumetricFogSizeStyle = EditorGUIUtility.TrTextContent("Max Local Fog Size", "Specifies the maximum size for the individual 3D Local Volumetric Fog texture that HDRP uses for Local Volumetric Fog. This settings will affect your memory consumption."); - public static readonly GUIContent maxLocalVolumetricFogsOnScreenStyle = EditorGUIUtility.TrTextContent("Max Local Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); + public static readonly GUIContent maxLocalVolumetricFogOnScreenStyle = EditorGUIUtility.TrTextContent("Max Local Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); public const string probeVolumeNotEnabled = "Warning: Probe Volumes are not enabled.\nIt is an highly experimental feature and 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 > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs index 36cdb332196..5e532496a86 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.cs @@ -250,16 +250,16 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor lightSettings.maxLocalVolumetricFogSize.intValue = (int)(LocalVolumetricFogResolution)EditorGUILayout.EnumPopup(Styles.maxLocalVolumetricFogSizeStyle, (LocalVolumetricFogResolution)lightSettings.maxLocalVolumetricFogSize.intValue); - EditorGUILayout.PropertyField(lightSettings.maxLocalVolumetricFogsOnScreen, Styles.maxLocalVolumetricFogsOnScreenStyle); - lightSettings.maxLocalVolumetricFogsOnScreen.intValue = Mathf.Clamp(lightSettings.maxLocalVolumetricFogsOnScreen.intValue, 1, HDRenderPipeline.k_MaxVisibleLocalVolumetricFogCount); + EditorGUILayout.PropertyField(lightSettings.maxLocalVolumetricFogOnScreen, Styles.maxLocalVolumetricFogOnScreenStyle); + lightSettings.maxLocalVolumetricFogOnScreen.intValue = Mathf.Clamp(lightSettings.maxLocalVolumetricFogOnScreen.intValue, 1, HDRenderPipeline.k_MaxVisibleLocalVolumetricFogCount); - if (lightSettings.maxLocalVolumetricFogSize.hasMultipleDifferentValues || lightSettings.maxLocalVolumetricFogsOnScreen.hasMultipleDifferentValues) + if (lightSettings.maxLocalVolumetricFogSize.hasMultipleDifferentValues || lightSettings.maxLocalVolumetricFogOnScreen.hasMultipleDifferentValues) EditorGUILayout.HelpBox(Styles.multipleDifferenteValueMessage, MessageType.Info); else { long currentCache = Texture3DAtlas.GetApproxCacheSizeInByte( lightSettings.maxLocalVolumetricFogSize.intValue, - lightSettings.maxLocalVolumetricFogsOnScreen.intValue, + lightSettings.maxLocalVolumetricFogOnScreen.intValue, LocalVolumetricFogManager.localVolumetricFogAtlasFormat, true ); @@ -269,7 +269,7 @@ static void Drawer_Volumetric(SerializedHDRenderPipelineAsset serialized, Editor int count = Texture3DAtlas.GetMaxElementCountForWeightInByte( HDRenderPipeline.k_MaxCacheSize, lightSettings.maxLocalVolumetricFogSize.intValue, - lightSettings.maxLocalVolumetricFogsOnScreen.intValue, + lightSettings.maxLocalVolumetricFogOnScreen.intValue, LocalVolumetricFogManager.localVolumetricFogAtlasFormat, true ); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs index b589742e5a1..cc57746f18d 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedGlobalLightLoopSettings.cs @@ -30,7 +30,7 @@ class SerializedGlobalLightLoopSettings public SerializedProperty maxPlanarReflectionOnScreen; public SerializedProperty maxLightsPerClusterCell; public SerializedProperty maxLocalVolumetricFogSize; - public SerializedProperty maxLocalVolumetricFogsOnScreen; + public SerializedProperty maxLocalVolumetricFogOnScreen; public SerializedGlobalLightLoopSettings(SerializedProperty root) { @@ -64,7 +64,7 @@ public SerializedGlobalLightLoopSettings(SerializedProperty root) maxLightsPerClusterCell = root.Find((GlobalLightLoopSettings s) => s.maxLightsPerClusterCell); maxLocalVolumetricFogSize = root.Find((GlobalLightLoopSettings s) => s.maxLocalVolumetricFogSize); - maxLocalVolumetricFogsOnScreen = root.Find((GlobalLightLoopSettings s) => s.maxLocalVolumetricFogsOnScreen); + maxLocalVolumetricFogOnScreen = root.Find((GlobalLightLoopSettings s) => s.maxLocalVolumetricFogOnScreen); } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs index 11a5bfd3670..b388e3311cc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs @@ -352,10 +352,8 @@ public bool IsDebugDisplayEnabled() /// Display the Local Volumetric Fog atlas. public bool displayLocalVolumetricFogAtlas = false; - /// Local Volumetric Fog atlas slice. public uint localVolumetricFogAtlasSlice = 0; - /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. public bool localVolumetricFogUseSelection = false; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs index ef319a3f55f..34c45e49d58 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -34,11 +34,11 @@ public DensityVolumeResolution maxDensityVolumeSize } /// Maximum number of Local Volumetric Fog at the same time on screen. - [Obsolete("Use maxLocalVolumetricFogsOnScreen instead", false)] + [Obsolete("Use maxLocalVolumetricFogOnScreen instead", false)] public int maxDensityVolumesOnScreen { - get => maxLocalVolumetricFogsOnScreen; - set => maxLocalVolumetricFogsOnScreen = value; + get => maxLocalVolumetricFogOnScreen; + set => maxLocalVolumetricFogOnScreen = value; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs index 8b26488ee2f..d96352783bc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs @@ -170,7 +170,7 @@ public partial struct GlobalLightLoopSettings maxPlanarReflectionOnScreen = 16, maxLightsPerClusterCell = 8, maxLocalVolumetricFogSize = LocalVolumetricFogResolution.Resolution32, - maxLocalVolumetricFogsOnScreen = 64, // 8MB texture atlas allocated by default + maxLocalVolumetricFogOnScreen = 64, // 8MB texture atlas allocated by default }; /// Cookie atlas resolution. @@ -225,6 +225,6 @@ public partial struct GlobalLightLoopSettings /// Maximum number of Local Volumetric Fog at the same time on screen. [Range(1, 512)] - public int maxLocalVolumetricFogsOnScreen; + public int maxLocalVolumetricFogOnScreen; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 49736474100..56d6b90ccd1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -224,9 +224,9 @@ public enum TileClusterCategoryDebug : int /// Decals. Decal = 16, /// Local Volumetric Fog. - LocalVolumetricFogs = 32, + LocalVolumetricFog = 32, /// Local Volumetric Fog. - [Obsolete("Use LocalVolumetricFogs", false)] + [Obsolete("Use LocalVolumetricFog", false)] [InspectorName("Local Volumetric Fogs")] DensityVolumes = 32 }; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs index b68d5a6aa43..722eae87731 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/LocalVolumetricFogManager.cs @@ -31,12 +31,12 @@ public Texture3DAtlas volumeAtlas int elementCount = Texture3DAtlas.GetMaxElementCountForWeightInByte( HDRenderPipeline.k_MaxCacheSize, (int)settings.maxLocalVolumetricFogSize, - settings.maxLocalVolumetricFogsOnScreen, + settings.maxLocalVolumetricFogOnScreen, localVolumetricFogAtlasFormat, true ); - elementCount = Mathf.Clamp(elementCount, 1, settings.maxLocalVolumetricFogsOnScreen); + elementCount = Mathf.Clamp(elementCount, 1, settings.maxLocalVolumetricFogOnScreen); m_VolumeAtlas = new Texture3DAtlas(localVolumetricFogAtlasFormat, (int)settings.maxLocalVolumetricFogSize, elementCount); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute index c1779508258..576f2184b0a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumeVoxelization.compute @@ -151,7 +151,7 @@ void FillVolumetricDensityBuffer(PositionInputs posInput, uint tileIndex, Jitter #else // USE_BIG_TILE_LIGHTLIST - volumeCount = _NumVisibleLocalVolumetricFogs; + volumeCount = _NumVisibleLocalVolumetricFog; volumeStart = 0; #endif // USE_BIG_TILE_LIGHTLIST diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs index fdc95e53049..05e18a4dbaf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs @@ -53,7 +53,7 @@ unsafe struct ShaderVariablesVolumetric public fixed float _VBufferCoordToViewDirWS[ShaderConfig.k_XRMaxViewsForCBuffer * 16]; public float _VBufferUnitDepthTexelSpacing; - public uint _NumVisibleLocalVolumetricFogs; + public uint _NumVisibleLocalVolumetricFog; public float _CornetteShanksConstant; public uint _VBufferHistoryIsValid; @@ -777,7 +777,7 @@ unsafe void UpdateShaderVariableslVolumetrics(ref ShaderVariablesVolumetric cb, for (int j = 0; j < 16; ++j) cb._VBufferCoordToViewDirWS[i * 16 + j] = m_PixelCoordToViewDirWS[i][j]; cb._VBufferUnitDepthTexelSpacing = HDUtils.ComputZPlaneTexelSpacing(1.0f, vFoV, resolution.y); - cb._NumVisibleLocalVolumetricFogs = (uint)m_VisibleVolumeBounds.Count; + cb._NumVisibleLocalVolumetricFog = (uint)m_VisibleVolumeBounds.Count; cb._CornetteShanksConstant = CornetteShanksPhasePartConstant(fog.anisotropy.value); cb._VBufferHistoryIsValid = hdCamera.volumetricHistoryIsValid ? 1u : 0u; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl index 7bc7ebae6cc..810bd5502ac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs.hlsl @@ -34,7 +34,7 @@ struct LocalVolumetricFogEngineData CBUFFER_START(ShaderVariablesVolumetric) float4x4 _VBufferCoordToViewDirWS[2]; float _VBufferUnitDepthTexelSpacing; - uint _NumVisibleLocalVolumetricFogs; + uint _NumVisibleLocalVolumetricFog; float _CornetteShanksConstant; uint _VBufferHistoryIsValid; float4 _VBufferSampleOffset; From 9936af270549f7a4c64aed560ca4f8e15d3f0d70 Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Thu, 11 Mar 2021 15:33:52 +0000 Subject: [PATCH 13/27] Reworded what's new entry --- .../Documentation~/whats-new-12.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md index 457ecec4809..46063f5f745 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md @@ -17,7 +17,7 @@ Group of Materials / GameObject can be setup to use Force Emissive forward with ### Density Volume (Local Volumetric Fog) Improvements -Density Volumes are now known as **Local Volumetric Fog**. This will help users know that is not a Volume (from the Volumes Framework ) and that is related to fog. +Density Volumes are now known as **Local Volumetric Fog**. This is a more accurate, descriptive name that removes confusion with [Volumes](Volumes.md) and makes the relation to fog clearer. Local Volumetric Fog 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. From ec157888dc248becad69218b4c339c42b209af04 Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Thu, 11 Mar 2021 15:38:34 +0000 Subject: [PATCH 14/27] Reworded the upgrading guide content --- .../Documentation~/Upgrading-from-2021.1-to-2021.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md index 361d64da214..c9c0d0d390e 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md @@ -8,7 +8,7 @@ HDRP 2021.2 includes the "ForwardEmissiveForDeferred" shader pass and the associ ## Density Volumes -As **Density Volume** has been renamed to **Local Volumetric Fog**, you won't need to worry about the game objects using the old component, as the serialization is taking into account the GUID and not the component name. Whereas, if you are referencing **Density Volume** class through your scripts, you will notice a warning (**DensityVolume has been deprecated (UnityUpgradable) -> Local Volumetric Fog**) so change your code and target the new component. This might stop compiling your project in future versions. +Density Volumes are now known as **Local Volumetric Fog**. If a Scene uses Density Volumes, HDRP automatically migrates the GameObjects to use the new component name, with all the same properties set for the Density Volume. However, if you reference a **Density Volume** through a C# script, a warning appears (**DensityVolume has been deprecated (UnityUpgradable) -> Local Volumetric Fog**) in the Console window. To resolve this, change your code to target the new component. This warning may stop your Project from compiling in future versions of HDRP. ## ClearFlag From 771ca39cf1f366d6431e5c5a2bac3fb5e7caaffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 12 Mar 2021 08:56:39 +0100 Subject: [PATCH 15/27] Format --- .../Documentation~/Upgrading-from-2021.1-to-2021.2.md | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md index c9c0d0d390e..a31c9df9fe6 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2021.1-to-2021.2.md @@ -13,4 +13,3 @@ Density Volumes are now known as **Local Volumetric Fog**. If a Scene uses Densi ## ClearFlag ClearFlag.Depth does not implicitely clear stencil anymore. ClearFlag.Stencil added. - From 359d3e1ca6dffbfad68a0291dd92e8bdac53bf60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 12 Mar 2021 11:33:23 +0100 Subject: [PATCH 16/27] API Updater fixes --- .../Runtime/Deprecated.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs index 34c45e49d58..4f6f380447e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -6,7 +6,7 @@ namespace UnityEngine.Rendering.HighDefinition /// Possible values for one element of the Local Volumetric Fog atlas. /// [Serializable] - [Obsolete("DensityVolumeResolution has been deprecated (UnityUpgradable) -> LocalVolumetricFogResolution", false)] + [Obsolete("DensityVolumeResolution has been deprecated. Please use LocalVolumetricFogResolution (UnityUpgradable)", false)] public enum DensityVolumeResolution { /// 3D volume of 32x32x32 voxels. @@ -26,7 +26,7 @@ public partial struct GlobalLightLoopSettings internal int cookieTexArraySize; /// Maximum size of one Local Volumetric Fog texture. - [Obsolete("Use maxLocalVolumetricFogSize instead", false)] + [Obsolete("maxDensityVolumeSize property has been deprecated. Please use maxLocalVolumetricFogSize (UnityUpgradable)", false)] public DensityVolumeResolution maxDensityVolumeSize { get => (DensityVolumeResolution)maxLocalVolumetricFogSize; @@ -34,7 +34,7 @@ public DensityVolumeResolution maxDensityVolumeSize } /// Maximum number of Local Volumetric Fog at the same time on screen. - [Obsolete("Use maxLocalVolumetricFogOnScreen instead", false)] + [Obsolete("maxDensityVolumesOnScreen property has been deprecated. Please use maxLocalVolumetricFogOnScreen (UnityUpgradable)", false)] public int maxDensityVolumesOnScreen { get => maxLocalVolumetricFogOnScreen; @@ -43,14 +43,14 @@ public int maxDensityVolumesOnScreen } /// Deprecated DensityVolume - [Obsolete("DensityVolume has been deprecated (UnityUpgradable) -> Local Volumetric Fog", false)] + [Obsolete("DensityVolume has been deprecated. Please use LocalVolumetricFog (UnityUpgradable)", false)] public class DensityVolume : LocalVolumetricFog { } /// [GenerateHLSL] - [Obsolete("DensityVolumeFalloffMode has been deprecated (UnityUpgradable) -> LocalVolumetricFogFalloffMode", false)] + [Obsolete("DensityVolumeFalloffMode property has been deprecated. Please use LocalVolumetricFogFalloffMode (UnityUpgradable)", false)] public enum DensityVolumeFalloffMode { /// @@ -60,7 +60,7 @@ public enum DensityVolumeFalloffMode } /// Deprecated DensityVolumeArtistParameters - [Obsolete("DensityVolumeArtistParameters has been deprecated (UnityUpgradable) -> LocalVolumetricFogArtistParameters", false)] + [Obsolete("DensityVolumeArtistParameters has been deprecated. Please use LocalVolumetricFogArtistParameters (UnityUpgradable)", false)] public struct DensityVolumeArtistParameters { LocalVolumetricFogArtistParameters m_Parameters; @@ -188,7 +188,7 @@ public partial class LightingDebugSettings public float debugLensAttenuation = 0.65f; /// Display the Local Volumetric Fog atlas. - [Obsolete("Use displayLocalVolumetricFogAtlas instead", false)] + [Obsolete("displayDensityVolumeAtlas property has been deprecated. Please use displayLocalVolumetricFogAtlas (UnityUpgradable)", false)] public bool displayDensityVolumeAtlas { get => displayLocalVolumetricFogAtlas; @@ -196,7 +196,7 @@ public bool displayDensityVolumeAtlas } /// Local Volumetric Fog atlas slice. - [Obsolete("Use localVolumetricFogAtlasSlice instead", false)] + [Obsolete("densityVolumeAtlasSlice property has been deprecated. Please use localVolumetricFogAtlasSlice (UnityUpgradable)", false)] public uint densityVolumeAtlasSlice { get => localVolumetricFogAtlasSlice; @@ -204,7 +204,7 @@ public uint densityVolumeAtlasSlice } /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. - [Obsolete("Use localVolumetricFogUseSelection instead", false)] + [Obsolete("densityVolumeUseSelection property has been deprecated. Please use localVolumetricFogUseSelection (UnityUpgradable)", false)] public bool densityVolumeUseSelection { get => localVolumetricFogUseSelection; From d1759d51c1c6accf7f12eac272d9b760de8ac5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 12 Mar 2021 15:33:47 +0100 Subject: [PATCH 17/27] Remove classes that are from 12 version --- .../Runtime/Debugging/DebugUI.Fields.cs | 2 +- .../Runtime/Deprecated.cs | 55 +------------------ .../LightLoop/GlobalLightLoopSettings.cs | 2 +- 3 files changed, 4 insertions(+), 55 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index d2bab41c5f5..ed377adc953 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -295,7 +295,7 @@ public Type autoEnum .FirstOrDefault() is InspectorNameAttribute attribute ? attribute.displayName : enumValue.ToString(); if (memInfo[0].GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() is ObsoleteAttribute) - name += "(Obsolete)"; + name += " (Obsolete)"; enumNames[i] = EditorGUIUtility.TrTextContent(ObjectNames.NicifyVariableName(name)); enumValues[i] = (int)enumValue; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs index 4f6f380447e..0a57cb02ee8 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -2,65 +2,21 @@ namespace UnityEngine.Rendering.HighDefinition { - /// - /// Possible values for one element of the Local Volumetric Fog atlas. - /// - [Serializable] - [Obsolete("DensityVolumeResolution has been deprecated. Please use LocalVolumetricFogResolution (UnityUpgradable)", false)] - public enum DensityVolumeResolution - { - /// 3D volume of 32x32x32 voxels. - Resolution32 = 32, - /// 3D volume of 64x64x64 voxels. - Resolution64 = 64, - /// 3D volume of 128x128x128 voxels. - Resolution128 = 128, - /// 3D volume of 256x256x256 voxels. - Resolution256 = 256, - } - public partial struct GlobalLightLoopSettings { // We keep this property for the migration code (we need to know how many cookies we could have before). [SerializeField, Obsolete("There is no more texture array for cookies, use cookie atlases properties instead.", false)] internal int cookieTexArraySize; - - /// Maximum size of one Local Volumetric Fog texture. - [Obsolete("maxDensityVolumeSize property has been deprecated. Please use maxLocalVolumetricFogSize (UnityUpgradable)", false)] - public DensityVolumeResolution maxDensityVolumeSize - { - get => (DensityVolumeResolution)maxLocalVolumetricFogSize; - set => maxLocalVolumetricFogSize = (LocalVolumetricFogResolution)value; - } - - /// Maximum number of Local Volumetric Fog at the same time on screen. - [Obsolete("maxDensityVolumesOnScreen property has been deprecated. Please use maxLocalVolumetricFogOnScreen (UnityUpgradable)", false)] - public int maxDensityVolumesOnScreen - { - get => maxLocalVolumetricFogOnScreen; - set => maxLocalVolumetricFogOnScreen = value; - } } /// Deprecated DensityVolume - [Obsolete("DensityVolume has been deprecated. Please use LocalVolumetricFog (UnityUpgradable)", false)] + [Obsolete("DensityVolume has been deprecated (UnityUpgradable) -> LocalVolumetricFog", false)] public class DensityVolume : LocalVolumetricFog { } - /// - [GenerateHLSL] - [Obsolete("DensityVolumeFalloffMode property has been deprecated. Please use LocalVolumetricFogFalloffMode (UnityUpgradable)", false)] - public enum DensityVolumeFalloffMode - { - /// - Linear, - /// - Exponential, - } - /// Deprecated DensityVolumeArtistParameters - [Obsolete("DensityVolumeArtistParameters has been deprecated. Please use LocalVolumetricFogArtistParameters (UnityUpgradable)", false)] + [Obsolete("DensityVolumeArtistParameters has been deprecated (UnityUpgradable) -> LocalVolumetricFogArtistParameters", false)] public struct DensityVolumeArtistParameters { LocalVolumetricFogArtistParameters m_Parameters; @@ -157,13 +113,6 @@ public Vector3 textureOffset set => m_Parameters.textureOffset = value; } - /// When Blend Distance is above 0, controls which kind of falloff is applied to the transition area. - public DensityVolumeFalloffMode falloffMode - { - get => (DensityVolumeFalloffMode)m_Parameters.falloffMode; - set => m_Parameters.falloffMode = (LocalVolumetricFogFalloffMode)value; - } - /// Constructor. /// Single scattering albedo. /// Mean free path. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs index d96352783bc..69c5c4873c5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs @@ -224,7 +224,7 @@ public partial struct GlobalLightLoopSettings public LocalVolumetricFogResolution maxLocalVolumetricFogSize; /// Maximum number of Local Volumetric Fog at the same time on screen. - [Range(1, 512)] + [Range(1, HDRenderPipeline.k_MaxVisibleLocalVolumetricFogCount)] public int maxLocalVolumetricFogOnScreen; } } From 92195087f8a5e37c12a6612f332da6d5d165748e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 12 Mar 2021 16:25:21 +0100 Subject: [PATCH 18/27] Last deprecation fixes --- .../Editor/CoreEditorUtils.cs | 6 +- .../Runtime/Debug/LightingDebug.cs | 6 +- .../Runtime/Deprecated.cs | 140 ------------------ .../LightLoop/GlobalLightLoopSettings.cs | 5 +- 4 files changed, 10 insertions(+), 147 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs b/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs index 2f950000f3e..aec00eb1ec3 100644 --- a/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs +++ b/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs @@ -1,15 +1,13 @@ using System; -using System.IO; using System.Collections.Generic; -using System.ComponentModel; +using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; +using UnityEditor.AnimatedValues; using UnityEngine; using UnityEngine.Rendering; -using UnityEditor.AnimatedValues; -using Component = UnityEngine.Component; namespace UnityEditor.Rendering { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs index b388e3311cc..65828b0507d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/LightingDebug.cs @@ -1,5 +1,4 @@ using System; -using UnityEngine.Serialization; namespace UnityEngine.Rendering.HighDefinition { @@ -226,7 +225,7 @@ internal enum ProbeVolumeAtlasSliceMode /// Lighting Debug Settings. /// [Serializable] - public partial class LightingDebugSettings + public class LightingDebugSettings { /// /// Returns true if any lighting debug mode is enabled. @@ -314,6 +313,9 @@ public bool IsDebugDisplayEnabled() public ExposureDebugMode exposureDebugMode = ExposureDebugMode.None; /// Exposure compensation to apply on current scene exposure. public float debugExposure = 0.0f; + /// Obsolete, please use the lens attenuation mode in HDRP Default Settings. + [Obsolete("Please use the lens attenuation mode in HDRP Default Settings", true)] + public float debugLensAttenuation = 0.65f; /// Whether to show tonemap curve in the histogram debug view or not. public bool showTonemapCurveAlongHistogramView = true; /// Whether to center the histogram debug view around the middle-grey point or not. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs index 0a57cb02ee8..22e6e61de66 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Deprecated.cs @@ -2,13 +2,6 @@ namespace UnityEngine.Rendering.HighDefinition { - public partial struct GlobalLightLoopSettings - { - // We keep this property for the migration code (we need to know how many cookies we could have before). - [SerializeField, Obsolete("There is no more texture array for cookies, use cookie atlases properties instead.", false)] - internal int cookieTexArraySize; - } - /// Deprecated DensityVolume [Obsolete("DensityVolume has been deprecated (UnityUpgradable) -> LocalVolumetricFog", false)] public class DensityVolume : LocalVolumetricFog @@ -19,108 +12,6 @@ public class DensityVolume : LocalVolumetricFog [Obsolete("DensityVolumeArtistParameters has been deprecated (UnityUpgradable) -> LocalVolumetricFogArtistParameters", false)] public struct DensityVolumeArtistParameters { - LocalVolumetricFogArtistParameters m_Parameters; - - /// Single scattering albedo: [0, 1]. Alpha is ignored. - public Color albedo - { - get => m_Parameters.albedo; - set => m_Parameters.albedo = value; - } - - /// Mean free path, in meters: [1, inf]. - public float meanFreePath - { - get => m_Parameters.meanFreePath; - set => m_Parameters.meanFreePath = value; - } - - /// Anisotropy of the phase function: [-1, 1]. Positive values result in forward scattering, and negative values - in backward scattering. - public float anisotropy - { - get => m_Parameters.anisotropy; - set => m_Parameters.anisotropy = value; - } - - /// Texture containing density values. - public Texture volumeMask - { - get => m_Parameters.volumeMask; - set => m_Parameters.volumeMask = value; - } - - /// Scrolling speed of the density texture. - public Vector3 textureScrollingSpeed - { - get => m_Parameters.textureScrollingSpeed; - set => m_Parameters.textureScrollingSpeed = value; - } - - /// Tiling rate of the density texture. - public Vector3 textureTiling - { - get => m_Parameters.textureTiling; - set => m_Parameters.textureTiling = value; - } - - /// Edge fade factor along the positive X, Y and Z axes. - public Vector3 positiveFade - { - get => m_Parameters.positiveFade; - set => m_Parameters.positiveFade = value; - } - - /// Edge fade factor along the negative X, Y and Z axes. - public Vector3 negativeFade - { - get => m_Parameters.negativeFade; - set => m_Parameters.negativeFade = value; - } - - /// Dimensions of the volume. - public Vector3 size - { - get => m_Parameters.size; - set => m_Parameters.size = value; - } - - /// Inverts the fade gradient. - public bool invertFade - { - get => m_Parameters.invertFade; - set => m_Parameters.invertFade = value; - } - - /// Distance at which density fading starts. - public float distanceFadeStart - { - get => m_Parameters.distanceFadeStart; - set => m_Parameters.distanceFadeStart = value; - } - - /// Distance at which density fading ends. - public float distanceFadeEnd - { - get => m_Parameters.distanceFadeEnd; - set => m_Parameters.distanceFadeEnd = value; - } - - /// Allows translation of the tiling density texture. - [SerializeField] - public Vector3 textureOffset - { - get => m_Parameters.textureOffset; - set => m_Parameters.textureOffset = value; - } - - /// Constructor. - /// Single scattering albedo. - /// Mean free path. - /// Anisotropy. - public DensityVolumeArtistParameters(Color color, float _meanFreePath, float _anisotropy) - { - m_Parameters = new LocalVolumetricFogArtistParameters(color, _meanFreePath, _anisotropy); - } } public partial struct LocalVolumetricFogArtistParameters @@ -129,35 +20,4 @@ public partial struct LocalVolumetricFogArtistParameters [Obsolete("Never worked correctly due to having engine working in percent. Will be removed soon.")] public bool advancedFade => true; } - - public partial class LightingDebugSettings - { - /// Obsolete, please use the lens attenuation mode in HDRP Default Settings. - [Obsolete("Please use the lens attenuation mode in HDRP Default Settings", true)] - public float debugLensAttenuation = 0.65f; - - /// Display the Local Volumetric Fog atlas. - [Obsolete("displayDensityVolumeAtlas property has been deprecated. Please use displayLocalVolumetricFogAtlas (UnityUpgradable)", false)] - public bool displayDensityVolumeAtlas - { - get => displayLocalVolumetricFogAtlas; - set => displayLocalVolumetricFogAtlas = value; - } - - /// Local Volumetric Fog atlas slice. - [Obsolete("densityVolumeAtlasSlice property has been deprecated. Please use localVolumetricFogAtlasSlice (UnityUpgradable)", false)] - public uint densityVolumeAtlasSlice - { - get => localVolumetricFogAtlasSlice; - set => localVolumetricFogAtlasSlice = value; - } - - /// True if Local Volumetric Fog Atlas debug mode should be displayed for the currently selected Local Volumetric Fog. - [Obsolete("densityVolumeUseSelection property has been deprecated. Please use localVolumetricFogUseSelection (UnityUpgradable)", false)] - public bool densityVolumeUseSelection - { - get => localVolumetricFogUseSelection; - set => localVolumetricFogUseSelection = value; - } - } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs index 69c5c4873c5..93434873c16 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/GlobalLightLoopSettings.cs @@ -138,7 +138,7 @@ public enum LocalVolumetricFogResolution /// Global Light Loop Settings. /// [Serializable] - public partial struct GlobalLightLoopSettings + public struct GlobalLightLoopSettings { internal static readonly GlobalLightLoopSettings @default = default; /// Default GlobalDecalSettings @@ -185,6 +185,9 @@ public partial struct GlobalLightLoopSettings #endif /// Last valid mip for cookie atlas. public int cookieAtlasLastValidMip; + // We keep this property for the migration code (we need to know how many cookies we could have before). + [SerializeField, Obsolete("There is no more texture array for cookies, use cookie atlases properties instead.", false)] + internal int cookieTexArraySize; /// Planar reflections atlas resolution. [FormerlySerializedAs("planarReflectionTextureSize")] From 582efc2aba230bf98ff7a4e1118538be9db4ebc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 12 Mar 2021 16:28:35 +0100 Subject: [PATCH 19/27] Update Changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 1f68886e7eb..83db348db39 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -143,6 +143,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Decreased the minimal Fog Distance value in the Density Volume to 0.05. - Virtual Texturing Resolver now performs RTHandle resize logic in HDRP instead of in core Unity - Cached the base types of Volume Manager to improve memory and cpu usage. +- Changed Density Volume for Local Volumetric Fog ## [11.0.0] - 2020-10-21 From cc350791aa38eb926cf5c7fff0d58b39ee251ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Fri, 12 Mar 2021 16:32:34 +0100 Subject: [PATCH 20/27] s remove --- .../Runtime/Lighting/LightLoop/LightLoop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 56d6b90ccd1..bf933ed2426 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -227,7 +227,7 @@ public enum TileClusterCategoryDebug : int LocalVolumetricFog = 32, /// Local Volumetric Fog. [Obsolete("Use LocalVolumetricFog", false)] - [InspectorName("Local Volumetric Fogs")] + [InspectorName("Local Volumetric Fog")] DensityVolumes = 32 }; From 066bb5014b9a8c581c4024a7d718a90737b2ea24 Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Tue, 16 Mar 2021 14:52:04 +0000 Subject: [PATCH 21/27] Reworded parts where find and replace changed context --- .../Documentation~/Local-Volumetric-Fog.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md b/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md index 9a05680e0fb..a6c4bdfb2bb 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md @@ -4,8 +4,8 @@ You may want to have fog effects in your Scene that global fog can not produce b HDRP voxelizes Local Volumetric Fog to enhance performance. This results in two limitations: -- Local Volumetric Fog do not support volumetric shadowing. If you place a Local Volumetric Fog between a Light and a surface, the Volume does not decrease the intensity of light that reaches the surface. -- Local Volumetric Fog are voxelized at a very coarse rate, with typically only 64 or 128 slices along the camera's focal axis. This can cause noticeable aliasing at the boundary of the Volume. You can hide the aliasing by using Local Volumetric Fog in conjunction with some global fog, if possible. You can also use a Density Mask and a non-zero Blend Distance to decrease the hardness of the edge. +- Local Volumetric Fog does not support volumetric shadowing. If you place a Local Volumetric Fog between a Light and a surface, the Volume does not decrease the intensity of light that reaches the surface. +- Local Volumetric Fog is voxelized at a very coarse rate, with typically only 64 or 128 slices along the camera's focal axis. This can cause noticeable aliasing at the boundary of the Volume. You can hide the aliasing by using Local Volumetric Fog in conjunction with some global fog, if possible. You can also use a Density Mask and a non-zero Blend Distance to decrease the hardness of the edge. To create a Local Volumetric Fog, right click in the Hierarchy and select __Volume > Local Volumetric Fog__. Alternatively, you can use the menu bar at the top of the screen and navigate to __GameObject > Volume > Local Volumetric Fog__. @@ -25,8 +25,8 @@ To create a Local Volumetric Fog, right click in the Hierarchy and select __Volu | **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 Local Volumetric Fog starts to fade out. This is useful when optimizing a scene with many Local Volumetric Fog and making the more distant ones disappear| -| **Distance Fade End** | Distance from the camera at which the Local Volumetric Fog has completely fade out. This is useful when optimizing a scene with many Local Volumetric Fog and making the more distant ones disappear| +| **Distance Fade Start** | Distance from the camera at which the Local Volumetric Fog starts to fade out. This is useful when optimizing a scene with a lot of Local Volumetric Fog and making the more distant ones disappear| +| **Distance Fade End** | Distance from the camera at which the Local Volumetric Fog has completely fade out. This is useful when optimizing a scene with a lot of Local Volumetric Fog and making the more distant ones disappear| | **Density Mask Texture** | Specifies a 3D texture mapped to the interior of the Volume. The Local Volumetric Fog 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 Local Volumetric Fog scrolls the texture. If you set every axis to 0, the Local Volumetric Fog 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. | @@ -39,7 +39,7 @@ There are two settings related to Local Volumetric Fog in the HDRP Asset setting The **Max Local Volumetric Fog 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 Local Volumetric Fog system, see the info box below this setting in the HDRP Asset. -The **Max Local Volumetric Fog On Screen** controls how many Local Volumetric Fog can appear on-screen at once. This setting also has an impact on memory. +The **Max Local Volumetric Fog On Screen** controls how many Local Volumetric Fog components can appear on-screen at once. This setting also has an impact on memory. ## Creating a Density Mask Texture From 21c06a3d25aba1ddd373abe5598a30157ca4e6d0 Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Tue, 16 Mar 2021 14:53:17 +0000 Subject: [PATCH 22/27] Renamed density volume screenshot --- .../Images/{DensityVolume1.png => LocalVolumetricFog1.png} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename com.unity.render-pipelines.high-definition/Documentation~/Images/{DensityVolume1.png => LocalVolumetricFog1.png} (100%) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/LocalVolumetricFog1.png similarity index 100% rename from com.unity.render-pipelines.high-definition/Documentation~/Images/DensityVolume1.png rename to com.unity.render-pipelines.high-definition/Documentation~/Images/LocalVolumetricFog1.png From e0c6281b2ef655aae03fe924217ecd219e4a56a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Tue, 16 Mar 2021 15:54:27 +0100 Subject: [PATCH 23/27] Change of the menu path --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 3 +-- .../Documentation~/whats-new-12.md | 3 +-- .../Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs | 2 +- .../Editor/Material/Decal/DecalMenuItems.cs | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 83db348db39..18fed15a400 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -99,8 +99,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard - Removed the material pass probe volumes evaluation mode. -- Changed GameObject/Rendering/Density Volume to GameObject/Local Volumetric Fog -- Changed GameObject/Rendering/Decal Projector to GameObject/Decal Projector +- Changed GameObject/Rendering/Density Volume to GameObject/Rendering/Local Volumetric Fog - Changed GameObject/Volume/Sky and Fog Volume to GameObject/Volume/Sky and Fog Global Volume - Move the Decal Gizmo Color initialization to preferences - Unifying the history validation pass so that it is only done once for the whole frame and not per effect. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md index 46063f5f745..a07be8e4f9a 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-12.md @@ -71,8 +71,7 @@ From HDRP 12.0, various top level menus are now different. This is to make the t * **C# Custom Pass** is now at **Assets > Create > Rendering > HDRP C# Custom Pass** * **C# Post Process Volume** is now at **Assets > Create > Rendering > HDRP C# Post Process Volume** * **GameObject** - * **Density Volume** is now at **GameObject > Local Volumetric Fog** - * **Decal Projector** is now at **GameObject > Decal Projector** + * **Density Volume** is now at **GameObject > Rendering > Local Volumetric Fog** * **Sky and Fog Volume** is now at **GameObject > Volume > Sky and Fog Global Volume** ## Issues resolved diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs index afedbb414e7..53eeedd31bd 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/VolumetricLighting/VolumetricMenuItem.cs @@ -6,7 +6,7 @@ namespace UnityEditor.Rendering.HighDefinition { class VolumetricMenuItems { - [MenuItem("GameObject/Local Volumetric Fog", priority = CoreUtils.Priorities.gameObjectMenuPriority + 2)] + [MenuItem("GameObject/Rendering/Local Volumetric Fog", priority = CoreUtils.Priorities.gameObjectMenuPriority + 2)] static void CreateLocalVolumetricFogGameObject(MenuCommand menuCommand) { var parent = menuCommand.context as GameObject; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalMenuItems.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalMenuItems.cs index 84dd1ab8db1..35810baeed7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalMenuItems.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalMenuItems.cs @@ -6,7 +6,7 @@ namespace UnityEditor.Rendering.HighDefinition { class DecalMenuItems { - [MenuItem("GameObject/Decal Projector", priority = CoreUtils.Priorities.gameObjectMenuPriority + 1)] + [MenuItem("GameObject/Rendering/Decal Projector", priority = CoreUtils.Priorities.gameObjectMenuPriority)] static void CreateDecal(MenuCommand menuCommand) { var parent = menuCommand.context as GameObject; From 356a8fc03412e486be5b68c50df735995f1dd9cf Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Tue, 16 Mar 2021 14:56:32 +0000 Subject: [PATCH 24/27] Final rewording pass --- .../Documentation~/Local-Volumetric-Fog.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md b/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md index a6c4bdfb2bb..a57367d62b7 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Local-Volumetric-Fog.md @@ -1,13 +1,13 @@ ## Local Volumetric Fog -You may want to have fog effects in your Scene that global fog can not produce by itself. In these cases you can use local fog. To add localized fog, use a Local Volumetric Fog. A Local Volumetric Fog is a an additive Volume of fog represented as an oriented bounding box. By default, fog is constant (homogeneous), but you can alter it by assigning a Density Mask 3D texture to the __Texture__ field under the __Density Mask Texture__ section. Currently, HDRP supports 3D textures at a resolution of 32x32x32. +You may want to have fog effects in your Scene that global fog can not produce by itself. In these cases you can use local fog. To add localized fog, use a Local Volumetric Fog component. Local Volumetric Fog is a an additive Volume of fog represented as an oriented bounding box. By default, fog is constant (homogeneous), but you can alter it by assigning a Density Mask 3D texture to the __Texture__ field under the __Density Mask Texture__ section. Currently, HDRP supports 3D textures at a resolution of 32x32x32. HDRP voxelizes Local Volumetric Fog to enhance performance. This results in two limitations: -- Local Volumetric Fog does not support volumetric shadowing. If you place a Local Volumetric Fog between a Light and a surface, the Volume does not decrease the intensity of light that reaches the surface. +- Local Volumetric Fog does not support volumetric shadowing. If you place Local Volumetric Fog between a Light and a surface, the Volume does not decrease the intensity of light that reaches the surface. - Local Volumetric Fog is voxelized at a very coarse rate, with typically only 64 or 128 slices along the camera's focal axis. This can cause noticeable aliasing at the boundary of the Volume. You can hide the aliasing by using Local Volumetric Fog in conjunction with some global fog, if possible. You can also use a Density Mask and a non-zero Blend Distance to decrease the hardness of the edge. -To create a Local Volumetric Fog, right click in the Hierarchy and select __Volume > Local Volumetric Fog__. Alternatively, you can use the menu bar at the top of the screen and navigate to __GameObject > Volume > Local Volumetric Fog__. +To create Local Volumetric Fog, right click in the Hierarchy and select __Volume > Local Volumetric Fog__. Alternatively, you can use the menu bar at the top of the screen and navigate to __GameObject > Volume > Local Volumetric Fog__. # Properties @@ -26,8 +26,8 @@ To create a Local Volumetric Fog, right click in the Hierarchy and select __Volu | **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 Local Volumetric Fog starts to fade out. This is useful when optimizing a scene with a lot of Local Volumetric Fog and making the more distant ones disappear| -| **Distance Fade End** | Distance from the camera at which the Local Volumetric Fog has completely fade out. This is useful when optimizing a scene with a lot of Local Volumetric Fog and making the more distant ones disappear| -| **Density Mask Texture** | Specifies a 3D texture mapped to the interior of the Volume. The Local Volumetric Fog 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. | +| **Distance Fade End** | Distance from the camera at which the Local Volumetric Fog has completely faded out. This is useful when optimizing a scene with a lot of Local Volumetric Fog and making the more distant ones disappear| +| **Density Mask Texture** | Specifies a 3D texture mapped to the interior of the Volume. Local Volumetric Fog 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 Local Volumetric Fog scrolls the texture. If you set every axis to 0, the Local Volumetric Fog 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. | From 96eff70cd505cc77e14cb06b8646e157f125865f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Wed, 17 Mar 2021 12:03:22 +0100 Subject: [PATCH 25/27] Fix Runtime compilation --- .../Runtime/Debugging/DebugUI.Fields.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index ed377adc953..f2a566b829b 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -297,7 +297,7 @@ public Type autoEnum if (memInfo[0].GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() is ObsoleteAttribute) name += " (Obsolete)"; - enumNames[i] = EditorGUIUtility.TrTextContent(ObjectNames.NicifyVariableName(name)); + enumNames[i] = new GUIContent(ObjectNames.NicifyVariableName(name)); enumValues[i] = (int)enumValue; } From d4cacec54617a72247daa45532365d5c66d73d35 Mon Sep 17 00:00:00 2001 From: alex-vazquez <76204843+alex-vazquez@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:05:50 +0100 Subject: [PATCH 26/27] Revert changelog merge --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 67011e89a99..99463868a3e 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -159,8 +159,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Virtual Texturing Resolver now performs RTHandle resize logic in HDRP instead of in core Unity - Cached the base types of Volume Manager to improve memory and cpu usage. - Changed Density Volume for Local Volumetric Fog -- Reduced the maximal number of bounces for both RTGI and RTR (case 1318876). -- Added tooltips to warn when some features may be disabled depending on MSAA/raytracing usage. ## [11.0.0] - 2020-10-21 From 8f0dd94813dd886c7fe9c4c1cb9ed6b5c13e012a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20V=C3=A1zquez?= Date: Wed, 17 Mar 2021 14:46:11 +0100 Subject: [PATCH 27/27] Fix object names on runtime --- .../Runtime/Debugging/DebugUI.Fields.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index f2a566b829b..703d854e8c8 100644 --- a/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Linq; -using System.Reflection; -using UnityEditor; using UnityEngine.Assertions; namespace UnityEngine.Rendering @@ -297,7 +293,7 @@ public Type autoEnum if (memInfo[0].GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() is ObsoleteAttribute) name += " (Obsolete)"; - enumNames[i] = new GUIContent(ObjectNames.NicifyVariableName(name)); + enumNames[i] = new GUIContent(name); enumValues[i] = (int)enumValue; }