//----------------------------------------------------------------------------- // Configuration //----------------------------------------------------------------------------- namespace UnityEngine.Rendering.HighDefinition { /// /// 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 { /// 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, /// 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, #else XrMaxViews = 1, #endif // Warning: Probe Volumes is a highly experimental feature. It is disabled by default for this reason. // It's functionality is subject to breaking changes and whole sale removal. // It is not recommended for use outside of for providing feedback. It should not be used in production. // To enable, set: // EnableProbeVolumes = 1 // and inside of the editor run: // 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 /// Whether probe volumes are enabled. EnableProbeVolumes = 0, /// 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 { // 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; /// Whether probe volumes are enabled. public static int s_EnableProbeVolumes = (int)ShaderOptions.EnableProbeVolumes; /// 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; } }