public override void Build(RenderPipelineResources renderPipelineResources) { m_InitPreFGD = Utilities.CreateEngineMaterial("Hidden/HDRenderPipeline/PreIntegratedFGD"); // For DisneyDiffuse integration values goes from (0.5 to 1.53125). GGX need 0 to 1. Use float format. m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.RGB111110Float, RenderTextureReadWrite.Linear); m_PreIntegratedFGD.filterMode = FilterMode.Bilinear; m_PreIntegratedFGD.wrapMode = TextureWrapMode.Clamp; m_PreIntegratedFGD.hideFlags = HideFlags.DontSave; m_PreIntegratedFGD.Create(); m_LtcData = new Texture2DArray(k_LtcLUTResolution, k_LtcLUTResolution, 3, TextureFormat.RGBAHalf, false /*mipmap*/, true /* linear */) { hideFlags = HideFlags.HideAndDontSave, wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear }; LoadLUT(m_LtcData, 0, TextureFormat.RGBAHalf, s_LtcGGXMatrixData); LoadLUT(m_LtcData, 1, TextureFormat.RGBAHalf, s_LtcDisneyDiffuseMatrixData); // TODO: switch to RGBA64 when it becomes available. LoadLUT(m_LtcData, 2, TextureFormat.RGBAHalf, s_LtcGGXMagnitudeData, s_LtcGGXFresnelData, s_LtcDisneyDiffuseMagnitudeData); m_LtcData.Apply(); m_isInit = false; }
public void Init(RenderPipelineSettings settings, RenderPipelineResources resources, BlueNoise blueNoise, LightLoop lightloop, SharedRTManager sharedRTManager, DebugDisplaySettings currentDebugDisplaySettings) { // Keep track of the resources m_Resources = resources; // Keep track of the settings m_Settings = settings; // Keep track of the lightloop m_LightLoop = lightloop; // Keep track of the shared RT manager m_SharedRTManager = sharedRTManager; // Keep track of the blue noise manager m_BlueNoise = blueNoise; // Create the list of environments m_Environments = new List <HDRaytracingEnvironment>(); // Grab all the ray-tracing graphs that have been created before (in case the order of initialization has not been respected, which happens when we open unity the first time) HDRaytracingEnvironment[] environmentArray = Object.FindObjectsOfType <HDRaytracingEnvironment>(); for (int envIdx = 0; envIdx < environmentArray.Length; ++envIdx) { RegisterEnvironment(environmentArray[envIdx]); } // Init the ray count manager m_RayCountManager.Init(resources, currentDebugDisplaySettings); #if UNITY_EDITOR // We need to invalidate the acceleration structures in case the hierarchy changed EditorApplication.hierarchyChanged += OnHierarchyChanged; #endif }
public HDShadowManager(RenderPipelineResources renderPipelineResources, DepthBits directionalShadowDepthBits, HDShadowInitParameters.HDShadowAtlasInitParams punctualLightAtlasInfo, HDShadowInitParameters.HDShadowAtlasInitParams areaLightAtlasInfo, int maxShadowRequests, Shader clearShader) { Material clearMaterial = CoreUtils.CreateEngineMaterial(clearShader); // Prevent the list from resizing their internal container when we add shadow requests m_ShadowDatas.Capacity = maxShadowRequests; m_ShadowResolutionRequests.Capacity = maxShadowRequests; m_ShadowRequests = new HDShadowRequest[maxShadowRequests]; // The cascade atlas will be allocated only if there is a directional light m_Atlas = new HDShadowAtlas(renderPipelineResources, punctualLightAtlasInfo.shadowAtlasResolution, punctualLightAtlasInfo.shadowAtlasResolution, HDShaderIDs._ShadowAtlasSize, clearMaterial, false, depthBufferBits: punctualLightAtlasInfo.shadowAtlasDepthBits, name: "Shadow Map Atlas"); // Cascade atlas render texture will only be allocated if there is a shadow casting directional light bool useMomentShadows = GetDirectionalShadowAlgorithm() == DirectionalShadowAlgorithm.IMS; m_CascadeAtlas = new HDShadowAtlas(renderPipelineResources, 1, 1, HDShaderIDs._CascadeShadowAtlasSize, clearMaterial, useMomentShadows, depthBufferBits: directionalShadowDepthBits, name: "Cascade Shadow Map Atlas"); m_AreaLightShadowAtlas = new HDShadowAtlas(renderPipelineResources, areaLightAtlasInfo.shadowAtlasResolution, areaLightAtlasInfo.shadowAtlasResolution, HDShaderIDs._AreaShadowAtlasSize, clearMaterial, false, BlurredEVSM: true, depthBufferBits: areaLightAtlasInfo.shadowAtlasDepthBits, name: "Area Light Shadow Map Atlas"); #if USE_PACKED_SHADOWDATA m_PackedShadowBuffer = new ComputeBuffer(maxShadowRequests + 1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(PackedShadowData))); m_packedShadowDataList = new List <PackedShadowData>(maxShadowRequests + 1); #else m_ShadowDataBuffer = new ComputeBuffer(maxShadowRequests, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDShadowData))); m_DirectionalShadowDataBuffer = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDDirectionalShadowData))); #endif m_MaxShadowRequests = maxShadowRequests; }
public void Init(HDRenderPipelineAsset asset, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, LightLoop lightLoop, GBufferManager gbufferManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; // The lightloop that holds all the lights of the scene m_LightLoop = lightLoop; // GBuffer manager that holds all the data for shading the samples m_GbufferManager = gbufferManager; // Allocate the intermediate buffers m_AnalyticProbBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16_SFloat), enableRandomWrite: true, useDynamicScale: true, xrInstancing: true, useMipMap: false, name: "AnalyticProbBuffer"); m_DenoiseBuffer0 = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, useDynamicScale: true, xrInstancing: true, useMipMap: false, name: "DenoiseBuffer0"); m_DenoiseBuffer1 = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, useDynamicScale: true, xrInstancing: true, useMipMap: false, name: "DenoiseBuffer1"); m_RaytracingDirectionBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, useDynamicScale: true, xrInstancing: true, useMipMap: false, name: "RaytracingDirectionBuffer"); m_RaytracingDistanceBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R32_SFloat), enableRandomWrite: true, useDynamicScale: true, xrInstancing: true, useMipMap: false, name: "RaytracingDistanceBuffer"); // Allocate the final result texture m_AreaShadowTextureArray = RTHandles.Alloc(Vector2.one, slices: 4, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16_SFloat), enableRandomWrite: true, useDynamicScale: true, xrInstancing: true, useMipMap: false, name: "AreaShadowArrayBuffer"); }
public void Init(RenderPipelineSettings settings, RenderPipelineResources resources, BlueNoise blueNoise, LightLoop lightloop, SharedRTManager sharedRTManager) { // Keep track of the resources m_Resources = resources; // Keep track of the settings m_Settings = settings; // Keep track of the lightloop m_LightLoop = lightloop; // Keep track of the shared RT manager m_SharedRTManager = sharedRTManager; // Keep track of the blue noise manager m_BlueNoise = blueNoise; // Create the list of environments m_Environments = new List <HDRaytracingEnvironment>(); // Grab all the ray-tracing graphs that have been created before (in case the order of initialization has not been respected, which happens when we open unity the first time) HDRaytracingEnvironment[] environmentArray = Object.FindObjectsOfType <HDRaytracingEnvironment>(); for (int envIdx = 0; envIdx < environmentArray.Length; ++envIdx) { RegisterEnvironment(environmentArray[envIdx]); } // keep track of all the graphs that are to be supported m_Filters = new List <HDRayTracingFilter>(); // Create the sub-scenes structure m_SubScenes = new Dictionary <int, HDRayTracingSubScene>(); // The list of masks that are currently requested m_LayerMasks = new List <int>(); // Let's start by building the "default" sub-scene (used by the scene camera) HDRayTracingSubScene defaultSubScene = new HDRayTracingSubScene(); defaultSubScene.mask = m_Settings.editorRaytracingFilterLayerMask.value; defaultSubScene.persistent = true; BuildSubSceneStructure(ref defaultSubScene); m_SubScenes.Add(m_Settings.editorRaytracingFilterLayerMask.value, defaultSubScene); m_LayerMasks.Add(m_Settings.editorRaytracingFilterLayerMask.value); // Grab all the ray-tracing graphs that have been created before HDRayTracingFilter[] filterArray = Object.FindObjectsOfType <HDRayTracingFilter>(); for (int filterIdx = 0; filterIdx < filterArray.Length; ++filterIdx) { RegisterFilter(filterArray[filterIdx]); } m_RayCountManager.Init(resources); #if UNITY_EDITOR // We need to invalidate the acceleration structures in case the hierarchy changed EditorApplication.hierarchyChanged += OnHierarchyChanged; #endif }
public void Init(RenderPipelineResources renderPipelineResources) { m_Blit = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.blitPS); m_DrawRayCount = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.debugViewRayCountPS); m_RayCountCompute = renderPipelineResources.shaders.countTracedRays; s_DebugFontTex = renderPipelineResources.textures.debugFontTex; // UINT textures must use UINT32, since groupshared uint used to synchronize counts is allocated as a UINT32 m_RayCountTex = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32G32B32A32_UInt, enableRandomWrite: true, useMipMap: false, name: "RayCountTex"); s_TotalRayCountBuffer = new ComputeBuffer(3, sizeof(uint)); }
public void Build(RenderPipelineResources renderPipelinesResources) { // Create unititialized. Lazy initialization is performed later. m_iblFilterGgx = new IBLFilterGGX(renderPipelinesResources); // TODO: We need to have an API to send our sky information to Enlighten. For now use a workaround through skybox/cubemap material... m_StandardSkyboxMaterial = Utilities.CreateEngineMaterial(renderPipelinesResources.skyboxCubemap); m_BlitCubemapMaterial = Utilities.CreateEngineMaterial(renderPipelinesResources.blitCubemap); m_CurrentUpdateTime = 0.0f; }
public AmbientOcclusionSystem(HDRenderPipelineAsset hdAsset) { m_Settings = hdAsset.currentPlatformRenderPipelineSettings; m_Resources = hdAsset.renderPipelineResources; #if ENABLE_RAYTRACING m_RTResources = hdAsset.renderPipelineRayTracingResources; #endif if (!hdAsset.currentPlatformRenderPipelineSettings.supportSSAO) { return; } AllocRT(0.5f); }
public void Initialize(RenderPipelineResources resources, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, LightLoop lightLoop) { // Keep track of the external buffers m_RenderPipelineResources = resources; m_RaytracingManager = raytracingManager; // Keep track of the lightloop m_LightLoop = lightLoop; // Keep track of the shader rt manager m_SharedRTManager = sharedRTManager; // Texture used to output debug information m_DebugLightClusterTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "DebugLightClusterTexture"); }
public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasSizeShaderID, Material clearMaterial, bool supportMomentShadows, 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_AtlasSizeShaderID = atlasSizeShaderID; m_ClearMaterial = clearMaterial; m_SupportMomentShadows = supportMomentShadows; m_RenderPipelineResources = renderPipelineResources; AllocateRenderTexture(); }
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(); }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_IndirectDiffuseTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "IndirectDiffuseBuffer"); }
public void InitData(RenderPipelineResources renderPipelineResources) { m_DebugLightVolumeMaterial = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.debugLightVolumePS); m_DebugLightVolumeCompute = renderPipelineResources.shaders.debugLightVolumeCS; m_DebugLightVolumeGradientKernel = m_DebugLightVolumeCompute.FindKernel("LightVolumeGradient"); m_DebugLightVolumeColorsKernel = m_DebugLightVolumeCompute.FindKernel("LightVolumeColors"); m_ColorGradientTexture = renderPipelineResources.textures.colorGradient; m_Blit = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.blitPS); m_LightCountBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32_SFloat, enableRandomWrite: false, useMipMap: false, xrInstancing: true, name: "LightVolumeCount"); m_ColorAccumulationBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: false, useMipMap: false, xrInstancing: true, name: "LightVolumeColorAccumulation"); m_DebugLightVolumesTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useMipMap: false, xrInstancing: true, name: "LightVolumeDebugLightVolumesTexture"); m_DepthBuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.None, colorFormat: GraphicsFormat.R8_UNorm, filterMode: FilterMode.Point, xrInstancing: true, name: "LightVolumeDepth"); // Fill the render target array m_RTIDs[0] = m_LightCountBuffer; m_RTIDs[1] = m_ColorAccumulationBuffer; }
public void Initialize(RenderPipelineResources resources, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, LightLoop lightLoop) { // Keep track of the external buffers m_RenderPipelineResources = resources; m_RaytracingManager = raytracingManager; // Keep track of the lightloop m_LightLoop = lightLoop; // Keep track of the shader rt manager m_SharedRTManager = sharedRTManager; // Texture used to output debug information m_DebugLightClusterTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "DebugLightClusterTexture"); // Pre allocate the cluster with a dummy size m_LightCluster = new ComputeBuffer(1, sizeof(uint)); }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, GBufferManager gbufferManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_GBufferManager = gbufferManager; m_IndirectDiffuseTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseBuffer"); m_DenoiseBuffer0 = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseDenoiseBuffer"); }
public void Init(RenderPipelineResources rpResources, HDRenderPipelineRayTracingResources rpRTResources, RenderPipelineSettings pipelineSettings, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager) { // Keep track of the pipeline asset m_PipelineSettings = pipelineSettings; m_PipelineResources = rpResources; m_PipelineRayTracingResources = rpRTResources; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; // Intermediate buffer that holds the pre-denoised texture m_IntermediateBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IntermediateAOBuffer"); // Buffer that holds the uncompressed normal buffer m_ViewSpaceNormalBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "ViewSpaceNormalBuffer"); }
public void Init(RenderPipelineResources renderPipelineResources, DebugDisplaySettings currentDebugDisplaySettings) { // Keep track of the external resources m_DebugDisplaySettings = currentDebugDisplaySettings; m_PipelineResources = renderPipelineResources; m_RayCountTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R32G32B32A32_UInt), enableRandomWrite: true, useMipMap: false, name: "RayCountTexture"); // We only require 3 buffers (this supports a maximal size of 8192x8192) m_ReducedRayCountBuffer0 = new ComputeBuffer(4 * 256 * 256, sizeof(uint)); m_ReducedRayCountBuffer1 = new ComputeBuffer(4 * 32 * 32, sizeof(uint)); m_ReducedRayCountBuffer2 = new ComputeBuffer(4, sizeof(uint)); // Initialize the cpu ray count (Optional) for (int i = 0; i < 4; ++i) { m_ReducedRayCountValues[i] = 0; } }
public void Initialize(RenderPipelineResources rpResources, HDRenderPipelineRayTracingResources rpRTResources, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { // Keep track of the external buffers m_RenderPipelineResources = rpResources; m_RenderPipelineRayTracingResources = rpRTResources; m_RaytracingManager = raytracingManager; // Keep track of the render pipeline m_RenderPipeline = renderPipeline; // Keep track of the shader rt manager m_SharedRTManager = sharedRTManager; // Texture used to output debug information m_DebugLightClusterTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "DebugLightClusterTexture"); // Pre allocate the cluster with a dummy size m_LightCluster = new ComputeBuffer(1, sizeof(uint)); }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, GBufferManager gbufferManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_GBufferManager = gbufferManager; m_IndirectDiffuseTexture = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseBuffer"); m_DenoiseBuffer0 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseDenoiseBuffer"); }
public void Init(RenderPipelineResources pipelineResources, RenderPipelineSettings pipelineSettings, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager) { // Keep track of the pipeline asset m_PipelineSettings = pipelineSettings; m_PipelineResources = pipelineResources; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; // Intermediate buffer that holds the pre-denoised texture m_IntermediateBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IntermediateAOBuffer"); // Buffer that holds the average distance of the rays m_HitDistanceBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R32_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "HitDistanceBuffer"); // Buffer that holds the uncompressed normal buffer m_ViewSpaceNormalBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "ViewSpaceNormalBuffer"); }
public HDShadowManager(RenderPipelineResources renderPipelineResources, int width, int height, int maxShadowRequests, DepthBits atlasDepthBits, Shader clearShader) { Material clearMaterial = CoreUtils.CreateEngineMaterial(clearShader); // Prevent the list from resizing their internal container when we add shadow requests m_ShadowDatas.Capacity = maxShadowRequests; m_ShadowResolutionRequests.Capacity = maxShadowRequests; m_ShadowRequests = new HDShadowRequest[maxShadowRequests]; // The cascade atlas will be allocated only if there is a directional light m_Atlas = new HDShadowAtlas(renderPipelineResources, width, height, HDShaderIDs._ShadowAtlasSize, clearMaterial, false, depthBufferBits: atlasDepthBits, name: "Shadow Map Atlas"); // Cascade atlas render texture will only be allocated if there is a shadow casting directional light bool useMomentShadows = GetDirectionaShadowAlgorithm() == DirectionalShadowAlgorithm.IMS; m_CascadeAtlas = new HDShadowAtlas(renderPipelineResources, 1, 1, HDShaderIDs._CascadeShadowAtlasSize, clearMaterial, useMomentShadows, depthBufferBits: atlasDepthBits, name: "Cascade Shadow Map Atlas"); m_ShadowDataBuffer = new ComputeBuffer(maxShadowRequests, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDShadowData))); m_DirectionalShadowDataBuffer = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDDirectionalShadowData))); m_MaxShadowRequests = maxShadowRequests; }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, GBufferManager gbufferManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_GbufferManager = gbufferManager; m_LightingTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "LightingBuffer"); m_HitPdfTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "HitPdfBuffer"); m_VarianceBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R8_UNorm), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "VarianceBuffer"); m_MinBoundBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.B10G11R11_UFloatPack32), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "MinBoundBuffer"); m_MaxBoundBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.B10G11R11_UFloatPack32), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "MaxBoundBuffer"); }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, GBufferManager gbufferManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_GbufferManager = gbufferManager; m_LightingTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "LightingBuffer"); m_HitPdfTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "HitPdfBuffer"); m_VarianceBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "VarianceBuffer"); m_MinBoundBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "MinBoundBuffer"); m_MaxBoundBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "MaxBoundBuffer"); }
public HDShadowManager(RenderPipelineResources renderPipelineResources, DepthBits directionalShadowDepthBits, HDShadowInitParameters.HDShadowAtlasInitParams punctualLightAtlasInfo, HDShadowInitParameters.HDShadowAtlasInitParams areaLightAtlasInfo, int maxShadowRequests, Shader clearShader) { Material clearMaterial = CoreUtils.CreateEngineMaterial(clearShader); // Prevent the list from resizing their internal container when we add shadow requests m_ShadowDatas.Capacity = maxShadowRequests; m_ShadowResolutionRequests.Capacity = maxShadowRequests; m_ShadowRequests = new HDShadowRequest[maxShadowRequests]; // The cascade atlas will be allocated only if there is a directional light m_Atlas = new HDShadowAtlas(renderPipelineResources, punctualLightAtlasInfo.shadowAtlasResolution, punctualLightAtlasInfo.shadowAtlasResolution, HDShaderIDs._ShadowmapAtlas, HDShaderIDs._ShadowAtlasSize, clearMaterial, depthBufferBits: punctualLightAtlasInfo.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 HDShadowAtlas(renderPipelineResources, 1, 1, HDShaderIDs._ShadowmapCascadeAtlas, HDShaderIDs._CascadeShadowAtlasSize, clearMaterial, cascadeBlur, depthBufferBits: directionalShadowDepthBits, name: "Cascade Shadow Map Atlas"); m_AreaLightShadowAtlas = new HDShadowAtlas(renderPipelineResources, areaLightAtlasInfo.shadowAtlasResolution, areaLightAtlasInfo.shadowAtlasResolution, HDShaderIDs._AreaLightShadowmapAtlas, HDShaderIDs._AreaShadowAtlasSize, clearMaterial, HDShadowAtlas.BlurAlgorithm.EVSM, depthBufferBits: areaLightAtlasInfo.shadowAtlasDepthBits, name: "Area Light Shadow Map Atlas", momentAtlasShaderID: HDShaderIDs._AreaShadowmapMomentAtlas); m_ShadowDataBuffer = new ComputeBuffer(maxShadowRequests, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDShadowData))); m_DirectionalShadowDataBuffer = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDDirectionalShadowData))); m_MaxShadowRequests = maxShadowRequests; }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_RaytracingFlagTarget = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R8_SNorm, enableRandomWrite: true, useMipMap: false, name: "RaytracingFlagTexture"); m_RaytracingFlagStateBlock = new RenderStateBlock { depthState = new DepthState(false, CompareFunction.LessEqual), mask = RenderStateMask.Depth }; }
public void Init(HDRenderPipelineAsset asset, SkyManager skyManager, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // Keep track of the sky manager m_SkyManager = skyManager; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_RaytracingFlagTarget = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R8_SNorm), enableRandomWrite: true, useMipMap: false, name: "RaytracingFlagTexture"); m_DebugRaytracingTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R16G16B16A16_SFloat), enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "DebugRaytracingBuffer"); m_RaytracingFlagStateBlock = new RenderStateBlock { depthState = new DepthState(false, CompareFunction.LessEqual), mask = RenderStateMask.Depth }; }
public void Init(HDRenderPipelineAsset asset, HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager, LightLoop lightLoop, GBufferManager gbufferManager) { // Keep track of the pipeline asset m_PipelineAsset = asset; m_PipelineResources = asset.renderPipelineResources; // keep track of the ray tracing manager m_RaytracingManager = raytracingManager; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; // The lightloop that holds all the lights of the scene m_LightLoop = lightLoop; // GBuffer manager that holds all the data for shading the samples m_GbufferManager = gbufferManager; // Allocate the intermediate buffers m_SNBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "SNBuffer"); m_UNBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "UNBuffer"); m_UBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "UBuffer"); m_AreaShadowTextureArray = RTHandles.Alloc(Vector2.one, slices: 4, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R16_SFloat, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: "AreaShadowArrayBuffer"); }
public IBLFilterGGX(RenderPipelineResources renderPipelineResources, MipGenerator mipGenerator) { m_RenderPipelineResources = renderPipelineResources; m_MipGenerator = mipGenerator; }
public void InitSharedBuffers(GBufferManager gbufferManager, RenderPipelineSettings settings, RenderPipelineResources resources) { // Set the flags m_MSAASupported = settings.supportMSAA; m_MSAASamples = m_MSAASupported ? settings.msaaSampleCount : MSAASamples.None; m_MotionVectorsSupport = settings.supportMotionVectors; m_ReuseGBufferMemory = settings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly; // Create the depth/stencil buffer m_CameraDepthStencilBuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth32, filterMode: FilterMode.Point, xrInstancing: true, useDynamicScale: true, name: "CameraDepthStencil"); // Create the mip chain buffer m_CameraDepthBufferMipChainInfo = new HDUtils.PackedMipChainInfo(); m_CameraDepthBufferMipChainInfo.Allocate(); m_CameraDepthBufferMipChain = RTHandles.Alloc(ComputeDepthBufferMipChainSize, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R32_SFloat), filterMode: FilterMode.Point, enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, name: "CameraDepthBufferMipChain"); if (settings.lowresTransparentSettings.enabled) { // Create the half res depth buffer used for low resolution transparency m_CameraHalfResDepthBuffer = RTHandles.Alloc(Vector2.one * 0.5f, depthBufferBits: DepthBits.Depth32, filterMode: FilterMode.Point, xrInstancing: true, useDynamicScale: true, name: "LowResDepthBuffer"); } // Technically we won't need this buffer in some cases, but nothing that we can determine at init time. m_CameraStencilBufferCopy = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.None, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R8_UNorm), filterMode: FilterMode.Point, enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, name: "CameraStencilCopy"); // DXGI_FORMAT_R8_UINT is not supported by Unity if (m_MotionVectorsSupport) { m_MotionVectorsRT = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetMotionVectorFormat(), xrInstancing: true, useDynamicScale: true, name: "MotionVectors"); if (m_MSAASupported) { m_MotionVectorsMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetMotionVectorFormat(), enableMSAA: true, bindTextureMS: true, xrInstancing: true, useDynamicScale: true, name: "MotionVectorsMSAA"); } } // Allocate the additional textures only if MSAA is supported if (m_MSAASupported) { // Let's create the MSAA textures m_CameraDepthStencilMSAABuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth24, filterMode: FilterMode.Point, bindTextureMS: true, enableMSAA: true, xrInstancing: true, useDynamicScale: true, name: "CameraDepthStencilMSAA"); m_CameraDepthValuesBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R32G32B32A32_SFloat), xrInstancing: true, useDynamicScale: true, name: "DepthValuesBuffer"); m_DepthAsColorMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R32_SFloat), bindTextureMS: true, enableMSAA: true, xrInstancing: true, useDynamicScale: true, name: "DepthAsColorMSAA"); // We need to allocate this texture as long as msaa is supported because on both mode, one of the cameras can be forward only using the framesettings m_NormalMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R8G8B8A8_UNorm), enableMSAA: true, bindTextureMS: true, xrInstancing: true, useDynamicScale: true, name: "NormalBufferMSAA"); // Create the required resolve materials m_DepthResolveMaterial = CoreUtils.CreateEngineMaterial(resources.shaders.depthValuesPS); m_ColorResolveMaterial = CoreUtils.CreateEngineMaterial(resources.shaders.colorResolvePS); } // If we are in the forward only mode if (!m_ReuseGBufferMemory) { // In case of full forward we must allocate the render target for normal buffer (or reuse one already existing) // TODO: Provide a way to reuse a render target m_NormalRT = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.OverrideRTGraphicsFormat(GraphicsFormat.R8G8B8A8_UNorm), enableRandomWrite: true, xrInstancing: true, useDynamicScale: true, name: "NormalBuffer"); } else { // When not forward only we should are using the normal buffer of the gbuffer // In case of deferred, we must be in sync with NormalBuffer.hlsl and lit.hlsl files and setup the correct buffers m_NormalRT = gbufferManager.GetNormalBuffer(0); // Normal + Roughness } }
public void InitSharedBuffers(GBufferManager gbufferManager, RenderPipelineSettings settings, RenderPipelineResources resources) { // Set the flags m_MSAASupported = settings.supportMSAA; m_MSAASamples = m_MSAASupported ? settings.msaaSampleCount : MSAASamples.None; m_VelocitySupport = settings.supportMotionVectors; m_ReuseGBufferMemory = settings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly; // Create the depth/stencil buffer m_CameraDepthStencilBuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth32, colorFormat: RenderTextureFormat.Depth, filterMode: FilterMode.Point, name: "CameraDepthStencil"); // Create the mip chain buffer m_CameraDepthBufferMipChainInfo = new HDUtils.PackedMipChainInfo(); m_CameraDepthBufferMipChainInfo.Allocate(); m_CameraDepthBufferMipChain = RTHandles.Alloc(ComputeDepthBufferMipChainSize, colorFormat: RenderTextureFormat.RFloat, filterMode: FilterMode.Point, sRGB: false, enableRandomWrite: true, name: "CameraDepthBufferMipChain"); // Technically we won't need this buffer in some cases, but nothing that we can determine at init time. m_CameraStencilBufferCopy = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.None, colorFormat: RenderTextureFormat.R8, sRGB: false, filterMode: FilterMode.Point, enableRandomWrite: true, name: "CameraStencilCopy"); // DXGI_FORMAT_R8_UINT is not supported by Unity if (m_VelocitySupport) { m_VelocityRT = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetVelocityBufferFormat(), sRGB: Builtin.GetVelocityBufferSRGBFlag(), name: "Velocity"); if (m_MSAASupported) { m_VelocityMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: Builtin.GetVelocityBufferFormat(), sRGB: Builtin.GetVelocityBufferSRGBFlag(), enableMSAA: true, bindTextureMS: true, name: "VelocityMSAA"); } } // Allocate the additional textures only if MSAA is supported if (m_MSAASupported) { // Let's create the MSAA textures m_CameraDepthStencilMSAABuffer = RTHandles.Alloc(Vector2.one, depthBufferBits: DepthBits.Depth24, colorFormat: RenderTextureFormat.Depth, filterMode: FilterMode.Point, bindTextureMS: true, enableMSAA: true, name: "CameraDepthStencilMSAA"); m_CameraDepthValuesBuffer = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGBFloat, sRGB: false, name: "DepthValuesBuffer"); m_DepthAsColorMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.RFloat, sRGB: false, bindTextureMS: true, enableMSAA: true, name: "DepthAsColorMSAA"); // We need to allocate this texture as long as msaa is supported because on both mode, one of the cameras can be forward only using the framesettings m_NormalMSAART = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGB32, sRGB: false, enableMSAA: true, bindTextureMS: true, name: "NormalBufferMSAA"); // Create the required resolve materials m_DepthResolveMaterial = CoreUtils.CreateEngineMaterial(resources.shaders.depthValuesPS); m_ColorResolveMaterial = CoreUtils.CreateEngineMaterial(resources.shaders.colorResolvePS); } // If we are in the forward only mode if (!m_ReuseGBufferMemory) { // In case of full forward we must allocate the render target for normal buffer (or reuse one already existing) // TODO: Provide a way to reuse a render target m_NormalRT = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: RenderTextureFormat.ARGB32, sRGB: false, enableRandomWrite: true, name: "NormalBuffer"); } else { // When not forward only we should are using the normal buffer of the gbuffer // In case of deferred, we must be in sync with NormalBuffer.hlsl and lit.hlsl files and setup the correct buffers m_NormalRT = gbufferManager.GetNormalBuffer(0); // Normal + Roughness } }