internal static RenderPipelineSettings NewDefault() => new RenderPipelineSettings()
        {
            supportShadowMask           = true,
            supportSSAO                 = true,
            supportSubsurfaceScattering = true,
            sssSampleBudget             = new IntScalableSetting(new[] { (int)DefaultSssSampleBudgetForQualityLevel.Low,
                                                                         (int)DefaultSssSampleBudgetForQualityLevel.Medium,
                                                                         (int)DefaultSssSampleBudgetForQualityLevel.High }, ScalableSettingSchemaId.With3Levels),
            supportVolumetrics              = true,
            supportDistortion               = true,
            supportTransparentBackface      = true,
            supportTransparentDepthPrepass  = true,
            supportTransparentDepthPostpass = true,
            colorBufferFormat               = ColorBufferFormat.R11G11B10,
            supportCustomPass               = true,
            customBufferFormat              = CustomBufferFormat.R8G8B8A8,
            supportedLitShaderMode          = SupportedLitShaderMode.DeferredOnly,
            supportDecals              = true,
            supportDecalLayers         = false,
            decalLayerName0            = "Decal Layer default",
            decalLayerName1            = "Decal Layer 1",
            decalLayerName2            = "Decal Layer 2",
            decalLayerName3            = "Decal Layer 3",
            decalLayerName4            = "Decal Layer 4",
            decalLayerName5            = "Decal Layer 5",
            decalLayerName6            = "Decal Layer 6",
            decalLayerName7            = "Decal Layer 7",
            msaaSampleCount            = MSAASamples.None,
            supportMotionVectors       = true,
            supportRuntimeDebugDisplay = false,
            supportRuntimeAOVAPI       = false,
            supportDitheringCrossFade  = true,
            supportTerrainHole         = false,

            lightLoopSettings         = GlobalLightLoopSettings.NewDefault(),
            hdShadowInitParams        = HDShadowInitParameters.NewDefault(),
            decalSettings             = GlobalDecalSettings.NewDefault(),
            postProcessSettings       = GlobalPostProcessSettings.NewDefault(),
            dynamicResolutionSettings = GlobalDynamicResolutionSettings.NewDefault(),
            lowresTransparentSettings = GlobalLowResolutionTransparencySettings.NewDefault(),
            xrSettings = GlobalXRSettings.NewDefault(),
            postProcessQualitySettings = GlobalPostProcessingQualitySettings.NewDefault(),
            lightingQualitySettings    = GlobalLightingQualitySettings.NewDefault(),
            lightSettings = LightSettings.NewDefault(),

            supportRayTracing       = false,
            supportedRayTracingMode = SupportedRayTracingMode.Both,
            lodBias             = new FloatScalableSetting(new[] { 1.0f, 1, 1 }, ScalableSettingSchemaId.With3Levels),
            maximumLODLevel     = new IntScalableSetting(new[] { 0, 0, 0 }, ScalableSettingSchemaId.With3Levels),
            lightLayerName0     = "Light Layer default",
            lightLayerName1     = "Light Layer 1",
            lightLayerName2     = "Light Layer 2",
            lightLayerName3     = "Light Layer 3",
            lightLayerName4     = "Light Layer 4",
            lightLayerName5     = "Light Layer 5",
            lightLayerName6     = "Light Layer 6",
            lightLayerName7     = "Light Layer 7",
            supportProbeVolume  = false,
            probeVolumeSettings = GlobalProbeVolumeSettings.@default,
        };
예제 #2
0
        internal static RenderPipelineSettings NewDefault()
        {
            RenderPipelineSettings settings = new RenderPipelineSettings()
            {
                supportShadowMask           = true,
                supportSSAO                 = true,
                supportSubsurfaceScattering = true,
                sssSampleBudget             = new IntScalableSetting(new[] { (int)DefaultSssSampleBudgetForQualityLevel.Low,
                                                                             (int)DefaultSssSampleBudgetForQualityLevel.Medium,
                                                                             (int)DefaultSssSampleBudgetForQualityLevel.High }, ScalableSettingSchemaId.With3Levels),
                supportVolumetrics              = true,
                supportDistortion               = true,
                supportTransparentBackface      = true,
                supportTransparentDepthPrepass  = true,
                supportTransparentDepthPostpass = true,
                colorBufferFormat               = ColorBufferFormat.R11G11B10,
                supportCustomPass               = true,
                customBufferFormat              = CustomBufferFormat.R8G8B8A8,
                supportedLitShaderMode          = SupportedLitShaderMode.DeferredOnly,
                supportDecals             = true,
                supportDecalLayers        = false,
                supportSurfaceGradient    = true,
                decalNormalBufferHP       = false,
                msaaSampleCount           = MSAASamples.None,
                supportMotionVectors      = true,
                supportRuntimeAOVAPI      = false,
                supportDitheringCrossFade = true,
                supportTerrainHole        = false,
                supportWater = false,
                waterSimulationResolution  = WaterSimulationResolution.Medium128,
                planarReflectionResolution = new PlanarReflectionAtlasResolutionScalableSetting(new[] { PlanarReflectionAtlasResolution.Resolution256,
                                                                                                        PlanarReflectionAtlasResolution.Resolution1024,
                                                                                                        PlanarReflectionAtlasResolution.Resolution2048 }, ScalableSettingSchemaId.With3Levels),
                lightLoopSettings         = GlobalLightLoopSettings.NewDefault(),
                hdShadowInitParams        = HDShadowInitParameters.NewDefault(),
                decalSettings             = GlobalDecalSettings.NewDefault(),
                postProcessSettings       = GlobalPostProcessSettings.NewDefault(),
                dynamicResolutionSettings = GlobalDynamicResolutionSettings.NewDefault(),
                lowresTransparentSettings = GlobalLowResolutionTransparencySettings.NewDefault(),
                xrSettings = GlobalXRSettings.NewDefault(),
                postProcessQualitySettings = GlobalPostProcessingQualitySettings.NewDefault(),
                lightingQualitySettings    = GlobalLightingQualitySettings.NewDefault(),
                lightSettings = LightSettings.NewDefault(),

                supportRayTracing       = false,
                supportedRayTracingMode = SupportedRayTracingMode.Both,
                lodBias                     = new FloatScalableSetting(new[] { 1.0f, 1, 1 }, ScalableSettingSchemaId.With3Levels),
                maximumLODLevel             = new IntScalableSetting(new[] { 0, 0, 0 }, ScalableSettingSchemaId.With3Levels),
                supportProbeVolume          = false,
                probeVolumeMemoryBudget     = ProbeVolumeTextureMemoryBudget.MemoryBudgetMedium,
                supportProbeVolumeStreaming = false,
                probeVolumeSHBands          = ProbeVolumeSHBands.SphericalHarmonicsL1,
            };

            return(settings);
        }
예제 #3
0
            internal HDShadowAtlasInitParameters(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID,
                                                 Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams, ConstantBuffer <ShaderVariablesGlobal> cb)
            {
                this.renderPipelineResources = renderPipelineResources;
                this.width             = width;
                this.height            = height;
                this.atlasShaderID     = atlasShaderID;
                this.clearMaterial     = clearMaterial;
                this.maxShadowRequests = maxShadowRequests;
                this.initParams        = initParams;
                this.blurAlgorithm     = BlurAlgorithm.None;
                this.filterMode        = FilterMode.Bilinear;
                this.depthBufferBits   = DepthBits.Depth16;
                this.format            = RenderTextureFormat.Shadowmap;
                this.name = "";

                this.cb = cb;
            }
예제 #4
0
        internal void DefragmentAtlasAndReRender(HDShadowInitParameters initParams)
        {
            m_TempListForPlacement.Clear();

            m_TempListForPlacement.AddRange(m_PlacedShadows.Values);
            m_TempListForPlacement.AddRange(m_RecordsPendingPlacement.Values);
            AddLightListToRecordList(m_RegisteredLightDataPendingPlacement, initParams, ref m_TempListForPlacement);

            for (int i = 0; i < m_AtlasResolutionInSlots * m_AtlasResolutionInSlots; ++i)
            {
                m_AtlasSlots[i] = SlotValue.Free;
            }

            // Clear the other state lists.
            m_PlacedShadows.Clear();
            m_ShadowsPendingRendering.Clear();
            m_ShadowsWithValidData.Clear();
            m_RecordsPendingPlacement.Clear(); // We'll reset what records are pending.

            // Sort in order to obtain a more optimal packing.
            InsertionSort(ref m_TempListForPlacement, 0, m_TempListForPlacement.Count);

            PerformPlacement();

            // This is fairly inefficient, but simple and this function should be called very rarely.
            // We need to add to pending the records that were placed but were not in m_RegisteredLightDataPendingPlacement
            // but they don't have a place yet.
            foreach (var record in m_TempListForPlacement)
            {
                if (!m_PlacedShadows.ContainsKey(record.shadowIndex)) // If we couldn't place it
                {
                    int parentLightIdx = record.shadowIndex - (record.shadowIndex % m_MaxShadowsPerLight);
                    if (!m_RegisteredLightDataPendingPlacement.ContainsKey(parentLightIdx)) // Did not come originally from m_RegisteredLightDataPendingPlacement
                    {
                        if (!m_RecordsPendingPlacement.ContainsKey(record.shadowIndex))
                        {
                            m_RecordsPendingPlacement.Add(record.shadowIndex, record);
                        }
                    }
                }
            }

            m_CanTryPlacement = false;
        }
예제 #5
0
        // This is the external api to say: do the placement if needed.
        // Also, we assign the resolutions here since we didn't know about HDShadowInitParameters during OnEnable of the light.
        internal void AssignOffsetsInAtlas(HDShadowInitParameters initParameters)
        {
            if (m_RegisteredLightDataPendingPlacement.Count > 0 && m_CanTryPlacement)
            {
                m_TempListForPlacement.Clear();

                m_TempListForPlacement.AddRange(m_RecordsPendingPlacement.Values);
                AddLightListToRecordList(m_RegisteredLightDataPendingPlacement, initParameters, ref m_TempListForPlacement);

                if (m_NeedOptimalPacking)
                {
                    InsertionSort(ref m_TempListForPlacement, 0, m_TempListForPlacement.Count);
                    m_NeedOptimalPacking = false;
                }

                PerformPlacement();

                m_CanTryPlacement = false; // It is pointless we try the placement every frame if no modifications to the amount of light registered happened.
            }
        }
예제 #6
0
        private void AddLightListToRecordList(Dictionary <int, HDAdditionalLightData> lightList, HDShadowInitParameters initParams, ref List <CachedShadowRecord> recordList)
        {
            foreach (var currentLightData in lightList.Values)
            {
                int resolution = 0;

                resolution = currentLightData.GetResolutionFromSettings(m_ShadowType, initParams);

                HDLightType lightType       = currentLightData.type;
                int         numberOfShadows = (lightType == HDLightType.Point) ? 6 : 1;

                for (int i = 0; i < numberOfShadows; ++i)
                {
                    CachedShadowRecord record;
                    record.shadowIndex   = currentLightData.lightIdxForCachedShadows + i;
                    record.viewportSize  = resolution;
                    record.offsetInAtlas = new Vector4(-1, -1, -1, -1); // Will be set later.
                    // Only situation in which we allow not to render on placement if it is OnDemand and onDemandShadowRenderOnPlacement is false
                    record.rendersOnPlacement = (currentLightData.shadowUpdateMode == ShadowUpdateMode.OnDemand) ? (currentLightData.forceRenderOnPlacement || currentLightData.onDemandShadowRenderOnPlacement) : true;
                    currentLightData.forceRenderOnPlacement = false; // reset the force flag as we scheduled the rendering forcefully already.
                    recordList.Add(record);
                }
            }
        }
예제 #7
0
        public void InitShadowManager(HDRenderPipelineRuntimeResources renderPipelineResources, HDShadowInitParameters initParams, RenderGraph renderGraph, Shader clearShader)
        {
            // Even when shadows are disabled (maxShadowRequests == 0) we need to allocate compute buffers to avoid having
            // resource not bound errors when dispatching a compute shader.
            m_ShadowDataBuffer            = new ComputeBuffer(Mathf.Max(initParams.maxShadowRequests, 1), System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDShadowData)));
            m_DirectionalShadowDataBuffer = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDDirectionalShadowData)));
            m_MaxShadowRequests           = initParams.maxShadowRequests;
            m_ShadowRequestCount          = 0;

            if (initParams.maxShadowRequests == 0)
            {
                return;
            }

            m_ClearShadowMaterial = CoreUtils.CreateEngineMaterial(clearShader);
            m_BlitShadowMaterial  = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.shadowBlitPS);

            // Prevent the list from resizing their internal container when we add shadow requests
            m_ShadowDatas.Capacity        = Math.Max(initParams.maxShadowRequests, m_ShadowDatas.Capacity);
            m_ShadowResolutionRequests    = new HDShadowResolutionRequest[initParams.maxShadowRequests];
            m_ShadowRequests              = new HDShadowRequest[initParams.maxShadowRequests];
            m_CachedDirectionalShadowData = new HDDirectionalShadowData[1]; // we only support directional light shadow

            m_GlobalShaderVariables = new ConstantBuffer <ShaderVariablesGlobal>();

            for (int i = 0; i < initParams.maxShadowRequests; i++)
            {
                m_ShadowResolutionRequests[i] = new HDShadowResolutionRequest();
            }


            HDShadowAtlas.HDShadowAtlasInitParameters punctualAtlasInitParams = new HDShadowAtlas.HDShadowAtlasInitParameters(renderPipelineResources, renderGraph, useSharedTexture: false, initParams.punctualLightShadowAtlas.shadowAtlasResolution,
                                                                                                                              initParams.punctualLightShadowAtlas.shadowAtlasResolution, HDShaderIDs._ShadowmapAtlas, m_ClearShadowMaterial, initParams.maxShadowRequests, initParams, m_GlobalShaderVariables);
            punctualAtlasInitParams.name = "Shadow Map Atlas";

            // The cascade atlas will be allocated only if there is a directional light
            m_Atlas = new HDDynamicShadowAtlas(punctualAtlasInitParams);
            // Cascade atlas render texture will only be allocated if there is a shadow casting directional light
            HDShadowAtlas.BlurAlgorithm cascadeBlur = GetDirectionalShadowAlgorithm() == DirectionalShadowAlgorithm.IMS ? HDShadowAtlas.BlurAlgorithm.IM : HDShadowAtlas.BlurAlgorithm.None;


            HDShadowAtlas.HDShadowAtlasInitParameters dirAtlasInitParams = punctualAtlasInitParams;
            dirAtlasInitParams.useSharedTexture = false;
            dirAtlasInitParams.width            = 1;
            dirAtlasInitParams.height           = 1;
            dirAtlasInitParams.atlasShaderID    = HDShaderIDs._ShadowmapCascadeAtlas;
            dirAtlasInitParams.blurAlgorithm    = cascadeBlur;
            dirAtlasInitParams.depthBufferBits  = initParams.directionalShadowsDepthBits;
            dirAtlasInitParams.name             = "Cascade Shadow Map Atlas";

            m_CascadeAtlas = new HDDynamicShadowAtlas(dirAtlasInitParams);

            HDShadowAtlas.HDShadowAtlasInitParameters areaAtlasInitParams = punctualAtlasInitParams;
            if (ShaderConfig.s_AreaLights == 1)
            {
                areaAtlasInitParams.useSharedTexture = false;
                areaAtlasInitParams.width            = initParams.areaLightShadowAtlas.shadowAtlasResolution;
                areaAtlasInitParams.height           = initParams.areaLightShadowAtlas.shadowAtlasResolution;
                areaAtlasInitParams.atlasShaderID    = HDShaderIDs._ShadowmapAreaAtlas;
                areaAtlasInitParams.blurAlgorithm    = HDShadowAtlas.BlurAlgorithm.EVSM;
                areaAtlasInitParams.depthBufferBits  = initParams.areaLightShadowAtlas.shadowAtlasDepthBits;
                areaAtlasInitParams.name             = "Area Light Shadow Map Atlas";


                m_AreaLightShadowAtlas = new HDDynamicShadowAtlas(areaAtlasInitParams);
            }

            HDShadowAtlas.HDShadowAtlasInitParameters cachedPunctualAtlasInitParams = punctualAtlasInitParams;
            cachedPunctualAtlasInitParams.useSharedTexture = true;
            cachedPunctualAtlasInitParams.width            = initParams.cachedPunctualLightShadowAtlas;
            cachedPunctualAtlasInitParams.height           = initParams.cachedPunctualLightShadowAtlas;
            cachedPunctualAtlasInitParams.atlasShaderID    = HDShaderIDs._CachedShadowmapAtlas;
            cachedPunctualAtlasInitParams.name             = "Cached Shadow Map Atlas";


            cachedShadowManager.InitPunctualShadowAtlas(cachedPunctualAtlasInitParams);
            if (ShaderConfig.s_AreaLights == 1)
            {
                HDShadowAtlas.HDShadowAtlasInitParameters cachedAreaAtlasInitParams = areaAtlasInitParams;
                cachedAreaAtlasInitParams.useSharedTexture = true;
                cachedAreaAtlasInitParams.width            = initParams.cachedAreaLightShadowAtlas;
                cachedAreaAtlasInitParams.height           = initParams.cachedAreaLightShadowAtlas;
                cachedAreaAtlasInitParams.atlasShaderID    = HDShaderIDs._CachedAreaLightShadowmapAtlas;
                cachedAreaAtlasInitParams.name             = "Cached Area Light Shadow Map Atlas";

                cachedShadowManager.InitAreaLightShadowAtlas(cachedAreaAtlasInitParams);
            }
        }
예제 #8
0
        private void AddLightListToRecordList(Dictionary <int, HDAdditionalLightData> lightList, HDShadowInitParameters initParams, ref List <CachedShadowRecord> recordList)
        {
            foreach (var currentLightData in lightList.Values)
            {
                int resolution = 0;

                resolution = currentLightData.GetResolutionFromSettings(m_ShadowType, initParams);

                HDLightType lightType       = currentLightData.type;
                int         numberOfShadows = (lightType == HDLightType.Point) ? 6 : 1;

                for (int i = 0; i < numberOfShadows; ++i)
                {
                    CachedShadowRecord record;
                    record.shadowIndex   = currentLightData.lightIdxForCachedShadows + i;
                    record.viewportSize  = resolution;
                    record.offsetInAtlas = new Vector4(-1, -1, -1, -1); // Will be set later.

                    recordList.Add(record);
                }
            }
        }
예제 #9
0
        public void InitShadowManager(RenderPipelineResources renderPipelineResources, HDShadowInitParameters initParams, Shader clearShader)
        {
            m_ClearShadowMaterial = CoreUtils.CreateEngineMaterial(clearShader);

            // Prevent the list from resizing their internal container when we add shadow requests
            m_ShadowDatas.Capacity        = Math.Max(initParams.maxShadowRequests, m_ShadowDatas.Capacity);
            m_ShadowResolutionRequests    = new HDShadowResolutionRequest[initParams.maxShadowRequests];
            m_ShadowRequests              = new HDShadowRequest[initParams.maxShadowRequests];
            m_CachedDirectionalShadowData = new HDDirectionalShadowData[1]; // we only support directional light shadow

            for (int i = 0; i < initParams.maxShadowRequests; i++)
            {
                m_ShadowResolutionRequests[i] = new HDShadowResolutionRequest();
            }

            // The cascade atlas will be allocated only if there is a directional light
            m_Atlas = new HDDynamicShadowAtlas(renderPipelineResources, initParams.punctualLightShadowAtlas.shadowAtlasResolution, initParams.punctualLightShadowAtlas.shadowAtlasResolution,
                                               HDShaderIDs._ShadowmapAtlas, m_ClearShadowMaterial, initParams.maxShadowRequests, initParams, depthBufferBits: initParams.punctualLightShadowAtlas.shadowAtlasDepthBits, name: "Shadow Map Atlas");
            // Cascade atlas render texture will only be allocated if there is a shadow casting directional light
            HDShadowAtlas.BlurAlgorithm cascadeBlur = GetDirectionalShadowAlgorithm() == DirectionalShadowAlgorithm.IMS ? HDShadowAtlas.BlurAlgorithm.IM : HDShadowAtlas.BlurAlgorithm.None;
            m_CascadeAtlas = new HDDynamicShadowAtlas(renderPipelineResources, 1, 1, HDShaderIDs._ShadowmapCascadeAtlas, m_ClearShadowMaterial, initParams.maxShadowRequests, initParams, cascadeBlur, depthBufferBits: initParams.directionalShadowsDepthBits, name: "Cascade Shadow Map Atlas");

            if (ShaderConfig.s_AreaLights == 1)
            {
                m_AreaLightShadowAtlas = new HDDynamicShadowAtlas(renderPipelineResources, initParams.areaLightShadowAtlas.shadowAtlasResolution, initParams.areaLightShadowAtlas.shadowAtlasResolution,
                                                                  HDShaderIDs._ShadowmapAreaAtlas, m_ClearShadowMaterial, initParams.maxShadowRequests, initParams, HDShadowAtlas.BlurAlgorithm.EVSM, depthBufferBits: initParams.areaLightShadowAtlas.shadowAtlasDepthBits, name: "Area Light Shadow Map Atlas");
            }

            m_ShadowDataBuffer            = new ComputeBuffer(initParams.maxShadowRequests, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDShadowData)));
            m_DirectionalShadowDataBuffer = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDDirectionalShadowData)));

            m_MaxShadowRequests = initParams.maxShadowRequests;

            cachedShadowManager.InitPunctualShadowAtlas(renderPipelineResources, initParams.cachedPunctualLightShadowAtlas, initParams.cachedPunctualLightShadowAtlas,
                                                        HDShaderIDs._CachedShadowmapAtlas, m_ClearShadowMaterial, initParams.maxShadowRequests, initParams: initParams, depthBufferBits: initParams.punctualLightShadowAtlas.shadowAtlasDepthBits, name: "Cached Shadow Map Atlas");
            if (ShaderConfig.s_AreaLights == 1)
            {
                cachedShadowManager.InitAreaLightShadowAtlas(renderPipelineResources, initParams.cachedAreaLightShadowAtlas, initParams.cachedAreaLightShadowAtlas,
                                                             HDShaderIDs._CachedAreaLightShadowmapAtlas, m_ClearShadowMaterial, initParams.maxShadowRequests, initParams: initParams, HDShadowAtlas.BlurAlgorithm.EVSM, depthBufferBits: initParams.areaLightShadowAtlas.shadowAtlasDepthBits, name: "Cached Area Light Shadow Map Atlas");
            }
        }
예제 #10
0
 public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
 {
     InitAtlas(renderPipelineResources, width, height, atlasShaderID, clearMaterial, maxShadowRequests, initParams, blurAlgorithm, filterMode, depthBufferBits, format, name);
 }
예제 #11
0
 internal void InitPunctualShadowAtlas(HDShadowAtlas.HDShadowAtlasInitParameters atlasInitParams)
 {
     m_InitParams = atlasInitParams.initParams;
     punctualShadowAtlas.InitAtlas(atlasInitParams);
 }
예제 #12
0
 public HDDynamicShadowAtlas(RenderPipelineResources renderPipelineResources, RenderGraph renderGraph, bool useSharedTexture, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
     : base(renderPipelineResources, renderGraph, useSharedTexture, width, height, atlasShaderID, clearMaterial, maxShadowRequests, initParams, blurAlgorithm, filterMode, depthBufferBits, format, name)
 {
     m_SortedRequestsCache = new HDShadowResolutionRequest[Mathf.CeilToInt(maxShadowRequests)];
 }
예제 #13
0
        public override void InitAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
        {
            base.InitAtlas(renderPipelineResources, width, height, atlasShaderID, clearMaterial, maxShadowRequests, initParams, blurAlgorithm, filterMode, depthBufferBits, format, name);

            m_AtlasResolutionInSlots = HDUtils.DivRoundUp(width, m_MinSlotSize);
            m_AtlasSlots             = new List <bool>(m_AtlasResolutionInSlots * m_AtlasResolutionInSlots);
            for (int i = 0; i < m_AtlasResolutionInSlots * m_AtlasResolutionInSlots; ++i)
            {
                m_AtlasSlots.Add(false);
            }

            // Note: If changing the characteristics of the atlas via HDRP asset, the lights OnEnable will not be called again so we are missing them, however we can explicitly
            // put them back up for placement. If this is the first Init of the atlas, the lines below do nothing.
            DefragmentAtlasAndReRender(initParams);
            m_CanTryPlacement    = true;
            m_NeedOptimalPacking = true;
        }
예제 #14
0
        public virtual void InitAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
        {
            this.width                = width;
            this.height               = height;
            m_FilterMode              = filterMode;
            m_DepthBufferBits         = depthBufferBits;
            m_Format                  = format;
            m_Name                    = name;
            m_AtlasShaderID           = atlasShaderID;
            m_ClearMaterial           = clearMaterial;
            m_BlurAlgorithm           = blurAlgorithm;
            m_RenderPipelineResources = renderPipelineResources;

            AllocateRenderTexture();
        }
예제 #15
0
 internal void InitAreaLightShadowAtlas(HDShadowAtlas.HDShadowAtlasInitParameters atlasInitParams)
 {
     m_InitParams = atlasInitParams.initParams;
     areaShadowAtlas.InitAtlas(atlasInitParams);
 }
예제 #16
0
        public virtual void InitAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
        {
            this.width        = width;
            this.height       = height;
            m_FilterMode      = filterMode;
            m_DepthBufferBits = depthBufferBits;
            m_Format          = format;
            m_Name            = name;
            // With render graph, textures are "allocated" every frame so we need to prepare strings beforehand.
            m_MomentName                 = m_Name + "Moment";
            m_MomentCopyName             = m_Name + "MomentCopy";
            m_IntermediateSummedAreaName = m_Name + "IntermediateSummedArea";
            m_SummedAreaName             = m_Name + "SummedAreaFinal";
            m_AtlasShaderID              = atlasShaderID;
            m_ClearMaterial              = clearMaterial;
            m_BlurAlgorithm              = blurAlgorithm;
            m_RenderPipelineResources    = renderPipelineResources;

            AllocateRenderTexture();
        }
예제 #17
0
 internal void InitAreaLightShadowAtlas(RenderPipelineResources renderPipelineResources, RenderGraph renderGraph, bool useSharedTexture, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, HDShadowInitParameters initParams,
                                        HDShadowAtlas.BlurAlgorithm blurAlgorithm = HDShadowAtlas.BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
 {
     m_InitParams = initParams;
     areaShadowAtlas.InitAtlas(renderPipelineResources, renderGraph, useSharedTexture, width, height, atlasShaderID, clearMaterial, maxShadowRequests, initParams, blurAlgorithm, filterMode, depthBufferBits, format, name);
 }