diff --git a/com.unity.render-pipelines.high-definition-config/Runtime/ShaderConfig.cs b/com.unity.render-pipelines.high-definition-config/Runtime/ShaderConfig.cs index 42adf630730..e073ccd2af5 100644 --- a/com.unity.render-pipelines.high-definition-config/Runtime/ShaderConfig.cs +++ b/com.unity.render-pipelines.high-definition-config/Runtime/ShaderConfig.cs @@ -4,40 +4,71 @@ namespace UnityEngine.Rendering.HighDefinition { + /// + /// Options for the mode HDRP uses to evaluate probe volumes. + /// + /// [GenerateHLSL(PackingRules.Exact)] public enum ProbeVolumesEvaluationModes { + /// Disables probe volumes. Disabled = 0, + /// Evaluates probe volumes in the light loop. LightLoop = 1, + /// Evaluates probe volumes in the material pass. MaterialPass = 2, } + /// + /// Options for the method HDRP uses to encode probe volumes. + /// + /// [GenerateHLSL(PackingRules.Exact)] public enum ProbeVolumesEncodingModes { + /// Uses L0 spherical harmonics to encode probe volumes. SphericalHarmonicsL0 = 0, + /// Uses L1 spherical harmonics to encode probe volumes. SphericalHarmonicsL1 = 1, + /// Uses L2 spherical harmonics to encode probe volumes. SphericalHarmonicsL2 = 2 } + /// + /// Options for the mode HDRP uses for probe volume bilateral filtering. + /// + /// [GenerateHLSL(PackingRules.Exact)] public enum ProbeVolumesBilateralFilteringModes { + /// Disables bilateral filtering. Disabled = 0, + /// Bilateral filtering using validity. Validity = 1, + /// Bilateral filtering using octahedral depth. OctahedralDepth = 2 } + /// + /// Project-wide shader configuration options. + /// + /// This enum will generate the proper shader defines. + /// [GenerateHLSL(PackingRules.Exact)] public enum ShaderOptions { - ColoredShadow = 1, // Allow to defined if colored shadow are supported in shaders or not - CameraRelativeRendering = 1, // Rendering sets the origin of the world to the position of the primary (scene view) camera + /// Supports colored shadows in shaders. + ColoredShadow = 1, + /// Uses [camera-relative rendering](../manual/Camera-Relative-Rendering.md) to enhance precision. + CameraRelativeRendering = 1, + /// Uses pre-exposition to enhance color precision. PreExposition = 1, - PrecomputedAtmosphericAttenuation = 0, // Precomputes atmospheric attenuation for the directional light on the CPU, which makes it independent from the fragment's position, which is faster but wrong + /// Precomputes atmospheric attenuation for the directional light on the CPU. This makes it independent from the fragment's position, which increases performance but reduces accuracy. + PrecomputedAtmosphericAttenuation = 0, + /// Maximum number of views for XR. #if ENABLE_VR - XrMaxViews = 2, // Used for single-pass rendering (with fast path in vertex shader code when forced to 2) + XrMaxViews = 2, #else XrMaxViews = 1, #endif @@ -51,32 +82,68 @@ public enum ShaderOptions // Edit->Render Pipeline->Generate Shader Includes // Probe Volumes feature must also be enabled inside of your HDRenderPipelineAsset. // Also uncomment in the HDRP package all ".../Experimental/Probe Volume" menu + + /// The probe volume evaluation mode. + /// ProbeVolumesEvaluationMode = ProbeVolumesEvaluationModes.Disabled, + /// Probe volume supports additive blending. ProbeVolumesAdditiveBlending = 1, + /// The probe volume filtering mode. + /// ProbeVolumesBilateralFilteringMode = ProbeVolumesBilateralFilteringModes.Validity, + /// The probe volume encoding method. + /// /// ProbeVolumesEncodingMode = ProbeVolumesEncodingModes.SphericalHarmonicsL1, + /// Support for area lights. AreaLights = 1, + /// Support for barn doors. BarnDoor = 0 }; // Note: #define can't be use in include file in C# so we chose this way to configure both C# and hlsl // Changing a value in this enum Config here require to regenerate the hlsl include and recompile C# and shaders + /// + /// Project-wide shader configuration options. + /// This class reflects the enum. Use it in C# code to check the current configuration. + /// public class ShaderConfig { - public const int k_XRMaxViewsForCBuffer = 2; // REALLY IMPORTANT! This needs to be the maximum possible XrMaxViews for any supported platform! - // this needs to be constant and not vary like XrMaxViews does as it is used to generate the cbuffer declarations + // REALLY IMPORTANT! This needs to be the maximum possible XrMaxViews for any supported platform! + // this needs to be constant and not vary like XrMaxViews does as it is used to generate the cbuffer declarations + /// Maximum number of XR views for constant buffer allocation. + public const int k_XRMaxViewsForCBuffer = 2; + /// Indicates whether to use [camera-relative rendering](../manual/Camera-Relative-Rendering.md) to enhance precision. + /// public static int s_CameraRelativeRendering = (int)ShaderOptions.CameraRelativeRendering; + /// Indicates whether to use pre-exposition to enhance color prevision. + /// public static int s_PreExposition = (int)ShaderOptions.PreExposition; + /// Specifies the maximum number of views to use for XR rendering. + /// public static int s_XrMaxViews = (int)ShaderOptions.XrMaxViews; + /// Indicates whether to precompute atmosphere attenuation for the directional light on the CPU. + /// public static int s_PrecomputedAtmosphericAttenuation = (int)ShaderOptions.PrecomputedAtmosphericAttenuation; + /// Specifies the probe volume evaluation mode. + /// public static ProbeVolumesEvaluationModes s_ProbeVolumesEvaluationMode = (ProbeVolumesEvaluationModes)ShaderOptions.ProbeVolumesEvaluationMode; + /// Indicates whether probe volumes support additive blending. + /// public static int s_ProbeVolumesAdditiveBlending = (int)ShaderOptions.ProbeVolumesAdditiveBlending; + /// Specifies the probe volume filtering mode. + /// public static ProbeVolumesBilateralFilteringModes s_ProbeVolumesBilateralFilteringMode = (ProbeVolumesBilateralFilteringModes)ShaderOptions.ProbeVolumesBilateralFilteringMode; + /// Specifies the probe volume encoding method. + /// public static ProbeVolumesEncodingModes s_ProbeVolumesEncodingMode = (ProbeVolumesEncodingModes)ShaderOptions.ProbeVolumesEncodingMode; + /// Indicates whether to support area lights. + /// public static int s_AreaLights = (int)ShaderOptions.AreaLights; + /// Indicates whether to support barn doors. + /// public static int s_BarnDoor = (int)ShaderOptions.BarnDoor; } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDIESImporter.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDIESImporter.cs index 2d673302555..95f10493bea 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDIESImporter.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDIESImporter.cs @@ -35,7 +35,6 @@ static HDIESImporter() /// Intensity /// Light used for the prefab /// Texture used for the prefab - /// static public void CreateRenderPipelinePrefabLight(AssetImportContext ctx, string iesFileName, bool useIESMaximumIntensity, string iesMaximumIntensityUnit, float iesMaximumIntensity, Light light, Texture ies) { HDLightTypeAndShape hdLightTypeAndShape = (light.type == LightType.Point) ? HDLightTypeAndShape.Point : HDLightTypeAndShape.ConeSpot; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileMaterialPropertyDrawer.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileMaterialPropertyDrawer.cs index 5c5e27c141c..a753a9fa10e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileMaterialPropertyDrawer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/DiffusionProfileMaterialPropertyDrawer.cs @@ -4,7 +4,7 @@ namespace UnityEditor.Rendering.HighDefinition { - public class DiffusionProfileDrawer : MaterialPropertyDrawer + class DiffusionProfileDrawer : MaterialPropertyDrawer { public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) => 0; @@ -15,4 +15,4 @@ public override void OnGUI (Rect position, MaterialProperty prop, String label, DiffusionProfileMaterialUI.OnGUI(editor, assetProperty, prop, 0, prop.displayName); } } -} \ No newline at end of file +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/ShaderGraphVersion.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/ShaderGraphVersion.cs index 35e55f3d8d6..865f3764deb 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/ShaderGraphVersion.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/ShaderGraphVersion.cs @@ -6,7 +6,7 @@ namespace UnityEditor.Rendering.HighDefinition.ShaderGraph { - public enum ShaderGraphVersion + enum ShaderGraphVersion { Initial = 0, FirstTimeMigration = Initial, diff --git a/com.unity.render-pipelines.high-definition/Runtime/ComponentUtility.cs b/com.unity.render-pipelines.high-definition/Runtime/ComponentUtility.cs index 4700104d224..d424b7e41eb 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/ComponentUtility.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/ComponentUtility.cs @@ -1,5 +1,8 @@ namespace UnityEngine.Rendering.HighDefinition { + /// + /// Utility class for HDRP specific components. + /// public static class ComponentUtility { /// Check if the provided camera is compatible with High-Definition Render Pipeline diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugOverlay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugOverlay.cs index 90ab3ff0c1e..f90fbca82f1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugOverlay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugOverlay.cs @@ -1,14 +1,27 @@ namespace UnityEngine.Rendering.HighDefinition { + /// + /// Utility class for debug overlay coordinates. + /// public class DebugOverlay { + /// Current x coordinate. public int x { get; private set; } + /// Current y coordinate. public int y { get; private set; } + /// Current overlay size. public int overlaySize { get; private set; } int m_InitialPositionX; int m_ScreenWidth; + /// + /// Start rendering overlay. + /// + /// Initial x position. + /// Initial y position. + /// Size of overlays between 0 and 1. + /// Width of the screen. public void StartOverlay(int initialX, int initialY, int overlaySize, int screenWidth) { x = initialX; @@ -19,6 +32,9 @@ public void StartOverlay(int initialX, int initialY, int overlaySize, int screen m_ScreenWidth = screenWidth; } + /// + /// Increment coordinates to the next overlay. + /// public void Next() { x += overlaySize; @@ -30,6 +46,10 @@ public void Next() } } + /// + /// Setup the viewport for the current overlay. + /// + /// Command buffer used to setup viewport. public void SetViewport(CommandBuffer cmd) { cmd.SetViewport(new Rect(x, y, overlaySize, overlaySize)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/IndirectLightingController.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/IndirectLightingController.cs index 6198f8cbf09..4c911145328 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/IndirectLightingController.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/IndirectLightingController.cs @@ -9,8 +9,8 @@ namespace UnityEngine.Rendering.HighDefinition [Serializable, VolumeComponentMenu("Lighting/Indirect Lighting Controller")] public class IndirectLightingController : VolumeComponent { - [UnityEngine.Serialization.FormerlySerializedAs("indirectDiffuseIntensity")] /// Indirect diffuse lighting multiplier, between 0 and 1 + [Serialization.FormerlySerializedAs("indirectDiffuseIntensity")] public MinFloatParameter indirectDiffuseLightingMultiplier = new MinFloatParameter(1.0f, 0.0f); /// Controls which layer will be affected by the indirect diffuse lighting multiplier public LightLayerEnumParameter indirectDiffuseLightingLayers = new LightLayerEnumParameter(LightLayerEnum.Everything); // Default to everything to not have migration issue @@ -20,8 +20,8 @@ public class IndirectLightingController : VolumeComponent /// Controls which layer will be affected by the reflection lighting multiplier public LightLayerEnumParameter reflectionLightingLayers = new LightLayerEnumParameter(LightLayerEnum.Everything); // Default to everything to not have migration issue - [UnityEngine.Serialization.FormerlySerializedAs("indirectSpecularIntensity")] /// Reflection probe and Planar reflection intensity multiplier, between 0 and 1 + [Serialization.FormerlySerializedAs("indirectSpecularIntensity")] public MinFloatParameter reflectionProbeIntensityMultiplier = new MinFloatParameter(1.0f, 0.0f); /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/GlobalLightingQualitySettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/GlobalLightingQualitySettings.cs index 2c9e411e3f5..39699078abe 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/GlobalLightingQualitySettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/GlobalLightingQualitySettings.cs @@ -163,20 +163,20 @@ internal GlobalLightingQualitySettings() public int[] SSRMaxRaySteps = new int[s_QualitySettingCount]; // Screen Space Global Illumination - [System.NonSerialized] /// Screen space global illumination step count for the ray marching. + [NonSerialized] public int[] SSGIRaySteps = new int[s_QualitySettingCount]; - [System.NonSerialized] /// Screen space global illumination's world space maximal radius. + [NonSerialized] public float[] SSGIRadius = new float[s_QualitySettingCount]; - [System.NonSerialized] /// Screen space global illumination flag to define if the effect is computed at full resolution. + [NonSerialized] public bool[] SSGIFullResolution = new bool[s_QualitySettingCount]; - [System.NonSerialized] /// Screen space global illumination signal clamping value. + [NonSerialized] public float[] SSGIClampValue = new float[s_QualitySettingCount]; - [System.NonSerialized] /// Screen space global illumination's filter size. + [NonSerialized] public int[] SSGIFilterRadius = new int[s_QualitySettingCount]; // Ray Traced Ambient Occlusion diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs index db1231e5407..13cb9253aac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs @@ -242,6 +242,10 @@ void IDataProvider.GetShadowMask(ref RenderTexture output, StageRuntimeInterface data.additionalCameraData.clearColorMode = oldClearMode; } + /// + /// The HDRP implementation for the callback that the look dev raises to process any necessary cleanup. + /// + /// Access element of the LookDev's scene void IDataProvider.Cleanup(StageRuntimeInterface SRI) { LookDevDataForHDRP data = (LookDevDataForHDRP)SRI.SRPData; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs index 9ca7f8a5bd7..da808ff7136 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs @@ -435,7 +435,9 @@ internal bool AddDiffusionProfile(DiffusionProfileSettings profile) } #endif - // Implement IVirtualTexturingEnabledRenderPipeline + /// + /// Indicates if virtual texturing is currently enabled for this render pipeline instance. + /// public bool virtualTexturingEnabled { get { return true; } } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs index d622b48218c..dba0c3b8c63 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/RenderPipelineSettings.cs @@ -157,6 +157,9 @@ public struct LightSettings } + /// + /// Represents resolution settings for planar reflections. + /// [Serializable] public class PlanarReflectionAtlasResolutionScalableSetting : ScalableSetting { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/ShaderVariablesPhysicallyBasedSky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/ShaderVariablesPhysicallyBasedSky.cs index 7e8ba755c84..408903c2466 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/ShaderVariablesPhysicallyBasedSky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/ShaderVariablesPhysicallyBasedSky.cs @@ -1,7 +1,7 @@ namespace UnityEngine.Rendering.HighDefinition { [GenerateHLSL] - public enum PbrSkyConfig + enum PbrSkyConfig { // Tiny GroundIrradianceTableSize = 256, // diff --git a/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs b/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs index 03c2a73a5a7..17437fa2f3d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDRenderUtilities.cs @@ -333,12 +333,12 @@ public static void Render( Render(cameraSettings, cameraPositionSettings, target, staticFlags); } - [Obsolete("Use CreateReflectionProbeRenderTarget with explicit format instead", true)] /// /// Create the texture used as target for a realtime reflection probe. /// /// The cubemap size. /// The texture to use as reflection probe target. + [Obsolete("Use CreateReflectionProbeRenderTarget with explicit format instead", true)] public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize) { return new RenderTexture(cubemapSize, cubemapSize, 1, GraphicsFormat.R16G16B16A16_SFloat) @@ -388,7 +388,6 @@ public static RenderTexture CreatePlanarProbeRenderTarget(int planarSize, Graphi /// Create the depth texture used as target for a realtime planar reflection probe. /// /// The size of the texture - /// The planar probe format. It must match the format set in the asset. /// The texture used as planar reflection probe target public static RenderTexture CreatePlanarProbeDepthRenderTarget(int planarSize) {