using System; using System.ComponentModel; using UnityEngine.Serialization; using UnityEngine.Experimental.Rendering; namespace UnityEngine.Rendering.HighDefinition { // RenderRenderPipelineSettings represent settings that are immutable at runtime. // There is a dedicated RenderRenderPipelineSettings for each platform /// /// Possible values for the cubemap texture size used for reflection probes. /// [Serializable] public enum CubeReflectionResolution { /// Turns off Probes if selected CubeReflectionResolution0 = 0, /// Size 128 CubeReflectionResolution128 = 128, /// Size 256 CubeReflectionResolution256 = 256, /// Size 512 CubeReflectionResolution512 = 512, /// Size 1024 CubeReflectionResolution1024 = 1024, /// Size 2048 CubeReflectionResolution2048 = 2048, /// Size 4096 CubeReflectionResolution4096 = 4096 } /// /// Available graphic formats for the cube and planar reflection probes. /// [System.Serializable] public enum ReflectionAndPlanarProbeFormat { /// Faster sampling and rendering but at the cost of precision. R11G11B10 = GraphicsFormat.B10G11R11_UFloatPack32, /// Better precision, but uses twice as much memory compared to R11G11B10. R16G16B16A16 = GraphicsFormat.R16G16B16A16_SFloat, } /// /// Available values for the reflection probe texture cache size. /// [Serializable] public enum ReflectionProbeTextureCacheResolution { /// Resolution 512x512 Resolution512x512 = 512, /// Resolution 1024x512 Resolution1024x512 = 1024 << 16 | 512, /// Resolution 1024x1024 Resolution1024x1024 = 1024, /// Resolution 2048x1024 Resolution2048x1024 = 2048 << 16 | 1024, /// Resolution 2048x2048 Resolution2048x2048 = 2048, /// Resolution 4096x2048 Resolution4096x2048 = 4096 << 16 | 2048, /// Resolution 4096x4096 Resolution4096x4096 = 4096, /// Resolution 8192x4096 Resolution8192x4096 = 8192 << 16 | 4096, /// Resolution 8192x8192 Resolution8192x8192 = 8192, /// Resolution 16384x8192 Resolution16384x8192 = 16384 << 16 | 8192, /// Resolution 16384 Resolution16384x16384 = 16384, } /// /// Possible values for the texture 2D size used for planar reflection probes. /// [Serializable] public enum PlanarReflectionAtlasResolution { /// Turns off Probes if selected Resolution0 = 0, /// Size 64 Resolution64 = 64, /// Size 128 Resolution128 = 128, /// Size 256 Resolution256 = 256, /// Size 512 Resolution512 = 512, /// Size 1024 Resolution1024 = 1024, /// Size 2048 Resolution2048 = 2048, /// Size 4096 Resolution4096 = 4096, /// Size 8192 Resolution8192 = 8192, /// Size 16384 Resolution16384 = 16384 } /// /// Possible values for the texture 2D size used for cookies. /// [Serializable] public enum CookieAtlasResolution { /// Size 64 CookieResolution64 = 64, /// Size 128 CookieResolution128 = 128, /// Size 256 CookieResolution256 = 256, /// Size 512 CookieResolution512 = 512, /// Size 1024 CookieResolution1024 = 1024, /// Size 2048 CookieResolution2048 = 2048, /// Size 4096 CookieResolution4096 = 4096, /// Size 8192 CookieResolution8192 = 8192, /// Size 16384 CookieResolution16384 = 16384 } /// /// Possible values for the cubemap texture size used for cookies. /// [Serializable] public enum CubeCookieResolution { /// Size 64 CubeCookieResolution64 = 64, /// Size 128 CubeCookieResolution128 = 128, /// Size 256 CubeCookieResolution256 = 256, /// Size 512 CubeCookieResolution512 = 512, /// Size 1024 CubeCookieResolution1024 = 1024, /// Size 2048 CubeCookieResolution2048 = 2048, /// Size 4096 CubeCookieResolution4096 = 4096 } /// /// Possible values for one element of the Local Volumetric Fog atlas. /// [Serializable] [Obsolete("The texture resolution limit in volumetric fogs have been removed. This enum is unused. #from(2023.1)")] public enum LocalVolumetricFogResolution { /// 3D volume of 32x32x32 voxels. [InspectorName("32x32x32")] Resolution32 = 32, /// 3D volume of 64x64x64 voxels. [InspectorName("64x64x64")] Resolution64 = 64, /// 3D volume of 128x128x128 voxels. [InspectorName("128x128x128")] Resolution128 = 128, /// 3D volume of 256x256x256 voxels. [InspectorName("256x256x256")] Resolution256 = 256, } /// /// Global Light Loop Settings. /// [Serializable] public struct GlobalLightLoopSettings { internal static readonly GlobalLightLoopSettings @default = default; /// Default GlobalDecalSettings internal static GlobalLightLoopSettings NewDefault() => new GlobalLightLoopSettings() { cookieAtlasSize = CookieAtlasResolution.CookieResolution2048, cookieFormat = CookieAtlasGraphicsFormat.R11G11B10, cookieAtlasLastValidMip = 0, // We must keep this value for migration purpose (when we create a new HDRP asset it is migrated to the last version) #pragma warning disable 618 // Type or member is obsolete cookieTexArraySize = 1, #pragma warning restore 618 reflectionProbeFormat = ReflectionAndPlanarProbeFormat.R11G11B10, reflectionProbeTexCacheSize = ReflectionProbeTextureCacheResolution.Resolution4096x4096, reflectionProbeTexLastValidCubeMip = 3, reflectionProbeTexLastValidPlanarMip = 0, reflectionProbeDecreaseResToFit = true, skyReflectionSize = SkyResolution.SkyResolution256, skyLightingOverrideLayerMask = 0, maxDirectionalLightsOnScreen = 16, maxPunctualLightsOnScreen = 512, maxAreaLightsOnScreen = 64, maxCubeReflectionOnScreen = HDRenderPipeline.k_MaxCubeReflectionsOnScreen / 4, maxPlanarReflectionOnScreen = HDRenderPipeline.k_MaxPlanarReflectionsOnScreen / 2, maxDecalsOnScreen = 512, maxLightsPerClusterCell = 8, maxLocalVolumetricFogOnScreen = 256, }; internal static Vector2Int GetReflectionProbeTextureCacheDim(ReflectionProbeTextureCacheResolution resolution) { if(resolution <= ReflectionProbeTextureCacheResolution.Resolution16384x16384) return new Vector2Int((int)resolution, (int)resolution); return new Vector2Int(((int)resolution >> 16), (int)resolution & 0xFFFF); } /// Cookie atlas resolution. [FormerlySerializedAs("cookieSize")] public CookieAtlasResolution cookieAtlasSize; /// Cookie atlas graphics format. public CookieAtlasGraphicsFormat cookieFormat; #if UNITY_2020_1_OR_NEWER #else /// Cookie atlas resolution for point lights. public CubeCookieResolution pointCookieSize; #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. #from(2021.2)")] internal int cookieTexArraySize; // We keep this property for the migration code /// Obsolete: Use planar reflection atlas. [FormerlySerializedAs("planarReflectionTextureSize")] [SerializeField, Obsolete("There is no more planar reflection atlas, use reflection probe atlases instead. #from(2022.2)")] public PlanarReflectionAtlasResolution planarReflectionAtlasSize; // We keep this property for the migration code [SerializeField, Obsolete("There is no more texture array for cube reflection probes, use reflection probe atlases properties instead. #from(2022.2)")] internal int reflectionProbeCacheSize; // We keep this property for the migration code [SerializeField, Obsolete("There is no more cube reflection probe size, use cube reflection probe size tiers instead. #from(2022.2)")] internal CubeReflectionResolution reflectionCubemapSize; // We keep this property for the migration code [SerializeField, Obsolete("There is no more max env light on screen, use max planar and cube reflection probes on screen instead. #from(2022.2)")] internal int maxEnvLightsOnScreen; /// Enable reflection probe cache compression. public bool reflectionCacheCompressed; /// Reflection probes format. public ReflectionAndPlanarProbeFormat reflectionProbeFormat; /// Reflection probes texture cache size. public ReflectionProbeTextureCacheResolution reflectionProbeTexCacheSize; /// Last valid mip for cube reflection probes in the reflection probe's texture cache. public int reflectionProbeTexLastValidCubeMip; /// Last valid mip for planar reflection probes in the reflection probe's texture cache. public int reflectionProbeTexLastValidPlanarMip; /// Downsize the reflection probe resolution if the probe doesn't fit in the reflection probe's texture cache. public bool reflectionProbeDecreaseResToFit; /// Resolution of the sky reflection cubemap. public SkyResolution skyReflectionSize; /// LayerMask used for sky lighting override. public LayerMask skyLightingOverrideLayerMask; /// Enable fabric specific convolution for probes and sky lighting. public bool supportFabricConvolution; /// Maximum number of directional lights at the same time on screen. public int maxDirectionalLightsOnScreen; /// Maximum number of punctual lights at the same time on screen. public int maxPunctualLightsOnScreen; /// Maximum number of area lights at the same time on screen. public int maxAreaLightsOnScreen; /// Maximum number of environment lights at the same time on screen. public int maxCubeReflectionOnScreen; /// Maximum number of planar lights at the same time on screen. public int maxPlanarReflectionOnScreen; /// Maximum number of decals at the same time on screen. public int maxDecalsOnScreen; /// Maximum number of lights per ray tracing light cluster cell. public int maxLightsPerClusterCell; /// Maximum size of one Local Volumetric Fog texture. [Obsolete("The texture resolution limit in volumetric fogs have been removed. This field is unused. #from(2023.1)")] public LocalVolumetricFogResolution maxLocalVolumetricFogSize; /// Maximum number of Local Volumetric Fog at the same time on screen. [Range(1, HDRenderPipeline.k_MaxVisibleLocalVolumetricFogCount)] public int maxLocalVolumetricFogOnScreen; } }