Esempio n. 1
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();
        }
Esempio n. 2
0
        public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, int atlasSizeShaderID, Material clearMaterial, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "", int momentAtlasShaderID = 0)
        {
            this.width                = width;
            this.height               = height;
            m_FilterMode              = filterMode;
            m_DepthBufferBits         = depthBufferBits;
            m_Format                  = format;
            m_Name                    = name;
            m_AtlasShaderID           = atlasShaderID;
            m_MomentAtlasShaderID     = momentAtlasShaderID;
            m_AtlasSizeShaderID       = atlasSizeShaderID;
            m_ClearMaterial           = clearMaterial;
            m_BlurAlgorithm           = blurAlgorithm;
            m_RenderPipelineResources = renderPipelineResources;

            AllocateRenderTexture();
        }
Esempio n. 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;
            }
Esempio n. 4
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;
     m_IsACacheForShadows         = false;
 }
Esempio n. 5
0
        public virtual void InitAtlas(HDShadowAtlasInitParameters initParams)
        {
            this.width             = initParams.width;
            this.height            = initParams.height;
            m_FilterMode           = initParams.filterMode;
            m_DepthBufferBits      = initParams.depthBufferBits;
            m_Format               = initParams.format;
            m_Name                 = initParams.name;
            m_GlobalConstantBuffer = initParams.cb;

            // 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              = initParams.atlasShaderID;
            m_ClearMaterial              = initParams.clearMaterial;
            m_BlurAlgorithm              = initParams.blurAlgorithm;
            m_RenderPipelineResources    = initParams.renderPipelineResources;
            m_IsACacheForShadows         = false;
        }
Esempio n. 6
0
        public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, 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;

            m_SortedRequestsCache      = new HDShadowResolutionRequest[Mathf.CeilToInt(maxShadowRequests * 1.5f)];
            m_CachedResolutionRequests = new HDShadowResolutionRequest[maxShadowRequests];
            for (int i = 0; i < maxShadowRequests; ++i)
            {
                m_CachedResolutionRequests[i] = new HDShadowResolutionRequest();
            }

            AllocateRenderTexture();
        }
Esempio n. 7
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);
 }
 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)];
 }
Esempio n. 9
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;
        }
Esempio n. 10
0
 public BlurAlgorithmDescription(BlurAlgorithm blurAlgorithm, string description)
 {
     BlurAlgorithm = blurAlgorithm;
     Description   = description;
 }