public void Init(RenderPipelineResources rpResources, HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { // Keep track of the resources m_DiffuseDenoiser = rpRTResources.diffuseDenoiserCS; m_OwenScrambleRGBA = rpResources.textures.owenScrambledRGBATex; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_RenderPipeline = renderPipeline; // Grab all the kernels we'll eventually need m_BilateralFilterSingleKernel = m_DiffuseDenoiser.FindKernel("BilateralFilterSingle"); m_BilateralFilterColorKernel = m_DiffuseDenoiser.FindKernel("BilateralFilterColor"); m_GatherSingleKernel = m_DiffuseDenoiser.FindKernel("GatherSingle"); m_GatherColorKernel = m_DiffuseDenoiser.FindKernel("GatherColor"); }
public void Init(HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { m_SharedRTManager = sharedRTManager; m_RenderPipeline = renderPipeline; m_ShadowDenoiser = rpRTResources.diffuseShadowDenoiserCS; m_ShadowFilterMapping = rpRTResources.shadowFilterMapping; m_BilateralFilterHSingleDirectionalKernel = m_ShadowDenoiser.FindKernel("BilateralFilterHSingleDirectional"); m_BilateralFilterVSingleDirectionalKernel = m_ShadowDenoiser.FindKernel("BilateralFilterVSingleDirectional"); m_BilateralFilterHColorDirectionalKernel = m_ShadowDenoiser.FindKernel("BilateralFilterHColorDirectional"); m_BilateralFilterVColorDirectionalKernel = m_ShadowDenoiser.FindKernel("BilateralFilterVColorDirectional"); m_BilateralFilterHSingleSphereKernel = m_ShadowDenoiser.FindKernel("BilateralFilterHSingleSphere"); m_BilateralFilterVSingleSphereKernel = m_ShadowDenoiser.FindKernel("BilateralFilterVSingleSphere"); }
public void Init(RenderPipelineResources rpResources, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { // Keep track of the resources m_SSGIDenoiserCS = rpResources.shaders.ssGIDenoiserCS; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_RenderPipeline = renderPipeline; // Fetch the kernels we are going to require m_SpatialFilterHalfKernel = m_SSGIDenoiserCS.FindKernel("SpatialFilterHalf"); m_SpatialFilterKernel = m_SSGIDenoiserCS.FindKernel("SpatialFilter"); // Fetch the kernels we are going to require m_TemporalFilterHalfKernel = m_SSGIDenoiserCS.FindKernel("TemporalFilterHalf"); m_TemporalFilterKernel = m_SSGIDenoiserCS.FindKernel("TemporalFilter"); m_CopyHistory = m_SSGIDenoiserCS.FindKernel("CopyHistory"); }
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(RenderPipelineSettings settings, RenderPipelineResources rpResources, HDRenderPipelineRayTracingResources rayTracingResources, BlueNoise blueNoise, HDRenderPipeline renderPipeline, SharedRTManager sharedRTManager, DebugDisplaySettings currentDebugDisplaySettings) { // Keep track of the resources m_Resources = rpResources; m_RTResources = rayTracingResources; // Keep track of the settings m_Settings = settings; // Keep track of the render pipeline m_RenderPipeline = renderPipeline; // 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 denoisers m_TemporalFilter.Init(rayTracingResources, m_SharedRTManager); m_SimpleDenoiser.Init(rayTracingResources, m_SharedRTManager); m_DiffuseDenoiser.Init(rpResources, rayTracingResources, m_SharedRTManager); // Init the ray count manager m_RayCountManager.Init(rayTracingResources, currentDebugDisplaySettings); #if UNITY_EDITOR // We need to invalidate the acceleration structures in case the hierarchy changed EditorApplication.hierarchyChanged += OnHierarchyChanged; #endif }
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)); m_LightDataGPUArray = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(LightData))); m_EnvLightDataGPUArray = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(EnvLightData))); }
public void Init(HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { // Keep track of the resources m_TemporalFilterCS = rpRTResources.temporalFilterCS; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_RenderPipeline = renderPipeline; // Grab all the kernels we'll eventually need m_ValidateHistoryKernel = m_TemporalFilterCS.FindKernel("ValidateHistory"); m_TemporalAccumulationSingleKernel = m_TemporalFilterCS.FindKernel("TemporalAccumulationSingle"); m_TemporalAccumulationColorKernel = m_TemporalFilterCS.FindKernel("TemporalAccumulationColor"); m_CopyHistorySingleKernel = m_TemporalFilterCS.FindKernel("CopyHistorySingle"); m_CopyHistoryColorKernel = m_TemporalFilterCS.FindKernel("CopyHistoryColor"); m_TemporalAccumulationSingleArrayKernel = m_TemporalFilterCS.FindKernel("TemporalAccumulationSingleArray"); m_TemporalAccumulationColorArrayKernel = m_TemporalFilterCS.FindKernel("TemporalAccumulationColorArray"); m_CopyHistorySingleArrayKernel = m_TemporalFilterCS.FindKernel("CopyHistorySingleArray"); m_CopyHistoryColorArrayKernel = m_TemporalFilterCS.FindKernel("CopyHistoryColorArray"); m_CopyHistorySingleArrayNoValidityKernel = m_TemporalFilterCS.FindKernel("CopyHistorySingleArrayNoValidity"); }
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_DebugRaytracingTexture = RTHandles.Alloc(Vector2.one, filterMode: FilterMode.Point, colorFormat: 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(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; m_AOIntermediateBuffer0 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "AOIntermediateBuffer0"); m_AOIntermediateBuffer1 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "AOIntermediateBuffer1"); }
internal bool Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult, SharedRTManager rtManager, CustomPass.RenderTargets targets) { bool executed = false; // We never execute volume if the layer is not within the culling layers of the camera if ((hdCamera.volumeLayerMask & (1 << gameObject.layer)) == 0) { return(false); } Shader.SetGlobalFloat(HDShaderIDs._CustomPassInjectionPoint, (float)injectionPoint); foreach (var pass in customPasses) { if (pass != null && pass.WillBeExecuted(hdCamera)) { pass.ExecuteInternal(renderContext, cmd, hdCamera, cullingResult, rtManager, targets, this); executed = true; } } return(executed); }
public void InitRaytracing(HDRaytracingManager raytracingManager, SharedRTManager sharedRTManager) { m_RayTracingManager = raytracingManager; m_RaytracingAmbientOcclusion.Init(m_Resources, m_RTResources, m_Settings, m_RayTracingManager, sharedRTManager); }
internal void ExecuteInternal(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult, SharedRTManager rtManager, RenderTargets targets, CustomPassVolume owner) { this.owner = owner; this.currentRTManager = rtManager; this.currentRenderTarget = targets; this.currentHDCamera = hdCamera; if (!isSetup) { Setup(renderContext, cmd); isSetup = true; } SetCustomPassTarget(cmd, targets); isExecuting = true; Execute(renderContext, cmd, hdCamera, cullingResult); isExecuting = false; // Set back the camera color buffer is we were using a custom buffer as target if (targetDepthBuffer != TargetBuffer.Camera) { CoreUtils.SetRenderTarget(cmd, targets.cameraColorBuffer); } }
public void Init(HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { m_SimpleDenoiserCS = rpRTResources.simpleDenoiserCS; m_SharedRTManager = sharedRTManager; m_RenderPipeline = renderPipeline; }
internal bool Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult, SharedRTManager rtManager, CustomPass.RenderTargets targets) { bool executed = false; if (!IsVisible(hdCamera)) { return(false); } Shader.SetGlobalFloat(HDShaderIDs._CustomPassInjectionPoint, (float)injectionPoint); if (injectionPoint == CustomPassInjectionPoint.AfterPostProcess) { Shader.SetGlobalTexture(HDShaderIDs._AfterPostProcessColorBuffer, targets.cameraColorBuffer); } foreach (var pass in customPasses) { if (pass != null && pass.WillBeExecuted(hdCamera)) { pass.ExecuteInternal(renderContext, cmd, hdCamera, cullingResult, rtManager, targets, this); executed = true; } } return(executed); }
public void Init(RenderPipelineResources rpResources, HDRenderPipelineRayTracingResources rpRTResources, SharedRTManager sharedRTManager, HDRenderPipeline renderPipeline) { // Keep track of the resources m_SimpleDenoiserCS = rpRTResources.diffuseDenoiserCS; m_OwenScrambleRGBA = rpResources.textures.owenScrambledRGBATex; // Keep track of the shared rt manager m_SharedRTManager = sharedRTManager; m_RenderPipeline = renderPipeline; }
internal bool Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult, SharedRTManager rtManager, CustomPass.RenderTargets targets) { bool executed = false; Shader.SetGlobalFloat(HDShaderIDs._CustomPassInjectionPoint, (float)injectionPoint); foreach (var pass in customPasses) { if (pass != null && pass.enabled) { using (new ProfilingSample(cmd, pass.name)) { pass.ExecuteInternal(renderContext, cmd, hdCamera, cullingResult, rtManager, targets, this); executed = true; } } } return(executed); }