private static void GenerateSRPTestSuites() { // ---------- HDRP ---------- string[] scenesGUIDs = AssetDatabase.FindAssets("t:Scene", new string[] { hdrp_TestsFolder }); //Debug.Log("Found "+scenesGUIDs.Length+" scene(s) in "+hdrp_TestsFolder); // Find the different RP assets sub folders string[] subFolders = AssetDatabase.GetSubFolders(hdrp_PipelinesFolder); //Debug.Log("Found "+subFolders.Length+" HDRP assets folders in "+hdrp_PipelinesFolder+" ."); foreach (string subFolder in subFolders) { string subFolderName = Path.GetFileName(subFolder); string[] hdrp_PipelineAssetsGUIDs = AssetDatabase.FindAssets("t:RenderPipelineAsset", new string[] { subFolder }); if (hdrp_PipelineAssetsGUIDs.Length == 0) { continue; } var hdrp_PipelineAssets = new UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipelineAsset[hdrp_PipelineAssetsGUIDs.Length]; for (int i = 0; i < hdrp_PipelineAssets.Length; ++i) { hdrp_PipelineAssets[i] = AssetDatabase.LoadAssetAtPath <UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipelineAsset>(AssetDatabase.GUIDToAssetPath(hdrp_PipelineAssetsGUIDs[i])); //Debug.Log("Found RP asset: "+hdrp_PipelineAssets[i]); } GenerateTestSuiteFromScenes(hdrp_SuitesFolder, "HDRP_" + subFolderName, scenesGUIDs, hdrp_PipelineAssets); } }
public void Build(HDRenderPipelineAsset hdAsset, IBLFilterGGX iblFilterGGX) { m_BakingSkyRenderingContext = new SkyRenderingContext(iblFilterGGX, (int)hdAsset.renderPipelineSettings.lightLoopSettings.skyReflectionSize, false); m_SkyRenderingContext = new SkyRenderingContext(iblFilterGGX, (int)hdAsset.renderPipelineSettings.lightLoopSettings.skyReflectionSize, true); m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.skyboxCubemap); m_BlitCubemapMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.blitCubemap); m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.opaqueAtmosphericScattering); m_LightingOverrideVolumeStack = VolumeManager.instance.CreateStack(); m_LightingOverrideLayerMask = hdAsset.renderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask; }
public void Build(HDRenderPipelineAsset asset) { if (preset == VolumetricLightingPreset.Off) { return; } m_VolumeVoxelizationCS = asset.renderPipelineResources.volumeVoxelizationCS; m_VolumetricLightingCS = asset.renderPipelineResources.volumetricLightingCS; CreateBuffers(); }
public void Build(HDRenderPipelineAsset hdAsset, IBLFilterGGX iblFilterGGX) { m_iblFilterGgx = iblFilterGGX; // 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 = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.skyboxCubemap); m_BlitCubemapMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.blitCubemap); m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.opaqueAtmosphericScattering); m_CurrentUpdateTime = 0.0f; }
public GBufferManager(HDRenderPipelineAsset asset, RenderPipelineMaterial deferredMaterial) : base(deferredMaterial.GetMaterialGBufferCount(asset)) { Debug.Assert(m_BufferCount <= 8); for (int i = 0; i < m_BufferCount; ++i) { m_RTIDsArray[i] = new RenderTargetIdentifier[i + 1]; } m_DeferredMaterial = deferredMaterial; m_asset = asset; }
private void SettingsUI(HDRenderPipelineAsset renderContext) { EditorGUILayout.LabelField(styles.settingsLabel); EditorGUI.indentLevel++; SssSettingsUI(renderContext); ShadowSettingsUI(renderContext); TextureSettingsUI(renderContext); RendereringSettingsUI(renderContext); TileSettingsUI(renderContext); EditorGUI.indentLevel--; }
public MipGenerator(HDRenderPipelineAsset asset) { m_TempColorTargets = new RTHandle[tmpTargetCount]; m_TempDownsamplePyramid = new RTHandle[tmpTargetCount]; m_DepthPyramidCS = asset.renderPipelineResources.shaders.depthPyramidCS; m_DepthDownsampleKernel = m_DepthPyramidCS.FindKernel("KDepthDownsample8DualUav"); m_SrcOffset = new int[4]; m_DstOffset = new int[4]; m_ColorPyramidPS = asset.renderPipelineResources.shaders.colorPyramidPS; m_ColorPyramidPSMat = CoreUtils.CreateEngineMaterial(m_ColorPyramidPS); m_PropertyBlock = new MaterialPropertyBlock(); }
public void Build(HDRenderPipelineAsset hdAsset) { // Disney SSS (compute + combine) string kernelName = hdAsset.renderPipelineSettings.increaseSssSampleCount ? "SubsurfaceScatteringHQ" : "SubsurfaceScatteringMQ"; m_SubsurfaceScatteringCS = hdAsset.renderPipelineResources.subsurfaceScatteringCS; m_SubsurfaceScatteringKernel = m_SubsurfaceScatteringCS.FindKernel(kernelName); m_CombineLightingPass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.combineLighting); m_CombineLightingPass.SetInt(HDShaderIDs._StencilMask, (int)HDRenderPipeline.StencilBitMask.LightingMask); m_CopyStencilForSplitLighting = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.copyStencilBuffer); m_CopyStencilForSplitLighting.SetInt(HDShaderIDs._StencilRef, (int)StencilLightingUsage.SplitLighting); m_CopyStencilForSplitLighting.SetInt(HDShaderIDs._StencilMask, (int)HDRenderPipeline.StencilBitMask.LightingMask); }
public override void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out RenderTextureFormat[] RTFormat, out bool[] sRGBFlag, out GBufferUsage[] gBufferUsage, out bool[] enableWrite) { int gBufferCount; bool supportShadowMask; bool supportLightLayers; GetGBufferOptions(asset, out gBufferCount, out supportShadowMask, out supportLightLayers); RTFormat = new RenderTextureFormat[gBufferCount]; sRGBFlag = new bool[gBufferCount]; gBufferUsage = new GBufferUsage[gBufferCount]; enableWrite = new bool[gBufferCount]; RTFormat[0] = RenderTextureFormat.ARGB32; // Albedo sRGB / SSSBuffer sRGBFlag[0] = true; gBufferUsage[0] = GBufferUsage.SubsurfaceScattering; enableWrite[0] = false; RTFormat[1] = RenderTextureFormat.ARGB32; // Normal Buffer sRGBFlag[1] = false; gBufferUsage[1] = GBufferUsage.Normal; enableWrite[1] = true; // normal buffer is used as RWTexture to composite decals in forward RTFormat[2] = RenderTextureFormat.ARGB32; // Data sRGBFlag[2] = false; gBufferUsage[2] = GBufferUsage.None; enableWrite[2] = false; RTFormat[3] = Builtin.GetLightingBufferFormat(); sRGBFlag[3] = Builtin.GetLightingBufferSRGBFlag(); gBufferUsage[3] = GBufferUsage.None; enableWrite[3] = false; int index = 4; if (supportLightLayers) { RTFormat[index] = RenderTextureFormat.ARGB32; sRGBFlag[index] = false; gBufferUsage[index] = GBufferUsage.LightLayers; index++; } // All buffer above are fixed. However shadow mask buffer can be setup or not depends on light in view. // Thus it need to be the last one, so all indexes stay the same if (supportShadowMask) { RTFormat[index] = Builtin.GetShadowMaskBufferFormat(); sRGBFlag[index] = Builtin.GetShadowMaskBufferSRGBFlag(); gBufferUsage[index] = GBufferUsage.ShadowMask; index++; } }
public void Build(HDRenderPipelineAsset asset) { m_supportVolumetric = asset.renderPipelineSettings.supportVolumetric; if (!m_supportVolumetric) { return; } m_VolumeVoxelizationCS = asset.renderPipelineResources.volumeVoxelizationCS; m_VolumetricLightingCS = asset.renderPipelineResources.volumetricLightingCS; CreateBuffers(); }
public void Build(HDRenderPipelineAsset asset) { if (preset == VolumetricLightingPreset.Off) { return; } m_VolumetricLightingCS = asset.renderPipelineResources.volumetricLightingCS; m_VBuffers = new List <VBuffer>(); m_VisibleVolumes = new List <OrientedBBox>(); m_VisibleVolumeProperties = new List <VolumeProperties>(); s_VisibleVolumesBuffer = new ComputeBuffer(k_MaxVisibleVolumeCount, System.Runtime.InteropServices.Marshal.SizeOf(typeof(OrientedBBox))); s_VisibleVolumePropertiesBuffer = new ComputeBuffer(k_MaxVisibleVolumeCount, System.Runtime.InteropServices.Marshal.SizeOf(typeof(VolumeProperties))); }
public override void Build(HDRenderPipelineAsset hdAsset) { var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; // Create Materials m_preIntegratedFGDMaterial_Ward = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.preIntegratedFGD_WardPS); if (m_preIntegratedFGDMaterial_Ward == null) { throw new Exception("Failed to create material for Ward BRDF pre-integration!"); } m_preIntegratedFGDMaterial_CookTorrance = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.preIntegratedFGD_CookTorrancePS); if (m_preIntegratedFGDMaterial_CookTorrance == null) { throw new Exception("Failed to create material for Cook-Torrance BRDF pre-integration!"); } // Create render textures where we will render the FGD tables m_preIntegratedFGD_Ward = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGB2101010, RenderTextureReadWrite.Linear); m_preIntegratedFGD_Ward.hideFlags = HideFlags.HideAndDontSave; m_preIntegratedFGD_Ward.filterMode = FilterMode.Bilinear; m_preIntegratedFGD_Ward.wrapMode = TextureWrapMode.Clamp; m_preIntegratedFGD_Ward.hideFlags = HideFlags.DontSave; m_preIntegratedFGD_Ward.name = CoreUtils.GetRenderTargetAutoName(128, 128, 1, RenderTextureFormat.ARGB2101010, "PreIntegratedFGD_Ward"); m_preIntegratedFGD_Ward.Create(); m_preIntegratedFGD_CookTorrance = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGB2101010, RenderTextureReadWrite.Linear); m_preIntegratedFGD_CookTorrance.hideFlags = HideFlags.HideAndDontSave; m_preIntegratedFGD_CookTorrance.filterMode = FilterMode.Bilinear; m_preIntegratedFGD_CookTorrance.wrapMode = TextureWrapMode.Clamp; m_preIntegratedFGD_CookTorrance.hideFlags = HideFlags.DontSave; m_preIntegratedFGD_CookTorrance.name = CoreUtils.GetRenderTargetAutoName(128, 128, 1, RenderTextureFormat.ARGB2101010, "PreIntegratedFGD_CookTorrance"); m_preIntegratedFGD_CookTorrance.Create(); // LTC data m_LtcData = new Texture2DArray(LTCAreaLight.k_LtcLUTResolution, LTCAreaLight.k_LtcLUTResolution, 3, TextureFormat.RGBAHalf, false /*mipmap*/, true /* linear */) { hideFlags = HideFlags.HideAndDontSave, wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear, name = CoreUtils.GetTextureAutoName(LTCAreaLight.k_LtcLUTResolution, LTCAreaLight.k_LtcLUTResolution, TextureFormat.RGBAHalf, depth: 2, dim: TextureDimension.Tex2DArray, name: "LTC_LUT") }; // Caution: This need to match order define in AxFLTCAreaLight LTCAreaLight.LoadLUT(m_LtcData, 0, TextureFormat.RGBAHalf, LTCAreaLight.s_LtcMatrixData_GGX); m_LtcData.Apply(); }
public override void GetMaterialGBufferDescription(HDRenderPipelineAsset asset, out GraphicsFormat[] RTFormat, out GBufferUsage[] gBufferUsage, out bool[] enableWrite) { int gBufferCount; bool supportShadowMask; bool supportLightLayers; GetGBufferOptions(asset, out gBufferCount, out supportShadowMask, out supportLightLayers); RTFormat = new GraphicsFormat[gBufferCount]; gBufferUsage = new GBufferUsage[gBufferCount]; enableWrite = new bool[gBufferCount]; RTFormat[0] = GraphicsFormat.R8G8B8A8_SRGB; // Albedo sRGB / SSSBuffer gBufferUsage[0] = GBufferUsage.SubsurfaceScattering; enableWrite[0] = false; RTFormat[1] = GraphicsFormat.R8G8B8A8_UNorm; // Normal Buffer gBufferUsage[1] = GBufferUsage.Normal; enableWrite[1] = true; // normal buffer is used as RWTexture to composite decals in forward RTFormat[2] = GraphicsFormat.R8G8B8A8_UNorm; // Data gBufferUsage[2] = GBufferUsage.None; enableWrite[2] = false; RTFormat[3] = Builtin.GetLightingBufferFormat(); gBufferUsage[3] = GBufferUsage.None; // If we are in raytracing mode and we want to have indirect diffuse active, we need to make sure that the gbuffer3 is writable #if ENABLE_RAYTRACING enableWrite[3] = true; #else enableWrite[3] = false; #endif int index = 4; if (supportLightLayers) { RTFormat[index] = GraphicsFormat.R8G8B8A8_UNorm; gBufferUsage[index] = GBufferUsage.LightLayers; index++; } // All buffer above are fixed. However shadow mask buffer can be setup or not depends on light in view. // Thus it need to be the last one, so all indexes stay the same if (supportShadowMask) { RTFormat[index] = Builtin.GetShadowMaskBufferFormat(); gBufferUsage[index] = GBufferUsage.ShadowMask; index++; } }
public void Build(HDRenderPipelineAsset asset) { if (preset == VolumetricLightingPreset.Off) { return; } m_VolumeVoxelizationCS = asset.renderPipelineResources.volumeVoxelizationCS; m_VolumetricLightingCS = asset.renderPipelineResources.volumetricLightingCS; m_VBuffers = new List <VBuffer>(); m_VisibleVolumeBounds = new List <OrientedBBox>(); m_VisibleVolumeData = new List <DensityVolumeData>(); s_VisibleVolumeBoundsBuffer = new ComputeBuffer(k_MaxVisibleVolumeCount, System.Runtime.InteropServices.Marshal.SizeOf(typeof(OrientedBBox))); s_VisibleVolumeDataBuffer = new ComputeBuffer(k_MaxVisibleVolumeCount, System.Runtime.InteropServices.Marshal.SizeOf(typeof(DensityVolumeData))); }
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 MipGenerator(HDRenderPipelineAsset asset) { m_DepthPyramidCS = asset.renderPipelineResources.shaders.depthPyramidCS; m_ColorPyramidCS = asset.renderPipelineResources.shaders.colorPyramidCS; m_DepthDownsampleKernel = m_DepthPyramidCS.FindKernel("KDepthDownsample8DualUav"); m_ColorDownsampleKernel = m_ColorPyramidCS.FindKernel("KColorDownsample"); m_ColorDownsampleKernelCopyMip0 = m_ColorPyramidCS.FindKernel("KColorDownsampleCopyMip0"); m_ColorGaussianKernel = m_ColorPyramidCS.FindKernel("KColorGaussian"); m_SrcOffset = new int[4]; m_DstOffset = new int[4]; m_ColorPyramidPS = asset.renderPipelineResources.shaders.colorPyramidPS; m_ColorPyramidPSMat = CoreUtils.CreateEngineMaterial(m_ColorPyramidPS); m_PropertyBlock = new MaterialPropertyBlock(); }
public void Build(HDRenderPipelineAsset hdAsset, IBLFilterBSDF[] iblFilterBSDFArray) { m_SkyRenderingContext = new SkyRenderingContext(iblFilterBSDFArray, (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize, true); #if UNITY_EDITOR m_PreviewSkyRenderingContext = new SkyRenderingContext(iblFilterBSDFArray, (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize, true); #endif m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.skyboxCubemapPS); m_BlitCubemapMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.blitCubemapPS); m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.opaqueAtmosphericScatteringPS); m_LightingOverrideVolumeStack = VolumeManager.instance.CreateStack(); m_LightingOverrideLayerMask = hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask; m_StaticLightingSkyRenderingContext = new SkyRenderingContext(iblFilterBSDFArray, (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize, false); }
private void ShadowSettingsUI(HDRenderPipelineAsset renderContext) { EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.shadowSettings); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_ShadowAtlasWidth, styles.shadowsAtlasWidth); EditorGUILayout.PropertyField(m_ShadowAtlasHeight, styles.shadowsAtlasHeight); if (EditorGUI.EndChangeCheck()) { HackSetDirty(renderContext); // Repaint } EditorGUI.indentLevel--; }
public void Build(HDRenderPipelineAsset asset) { m_supportVolumetrics = asset.renderPipelineSettings.supportVolumetrics; if (!m_supportVolumetrics) { return; } preset = asset.renderPipelineSettings.increaseResolutionOfVolumetrics ? VolumetricLightingPreset.High : VolumetricLightingPreset.Medium; m_VolumeVoxelizationCS = asset.renderPipelineResources.volumeVoxelizationCS; m_VolumetricLightingCS = asset.renderPipelineResources.volumetricLightingCS; CreateBuffers(); }
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"); }
private void TextureSettingsUI(HDRenderPipelineAsset renderContext) { EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.textureSettings); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_SpotCookieSize, styles.spotCookieSize); EditorGUILayout.PropertyField(m_PointCookieSize, styles.pointCookieSize); EditorGUILayout.PropertyField(m_ReflectionCubemapSize, styles.reflectionCubemapSize); if (EditorGUI.EndChangeCheck()) { HackSetDirty(renderContext); // Repaint } EditorGUI.indentLevel--; }
private void TileSettingsUI(HDRenderPipelineAsset renderContext) { EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.tileLightLoopSettings); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_enableTileAndCluster, styles.enableTileAndCluster); if (m_enableTileAndCluster.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_enableBigTilePrepass, styles.enableBigTilePrepass); EditorGUILayout.PropertyField(m_enableClustered, styles.enableClustered); // Tag: SUPPORT_COMPUTE_CLUSTER_OPAQUE - Uncomment this if you want to do cluster opaque with compute shader (by default we support only fptl on opaque) // if (m_enableClustered.boolValue) if (m_enableClustered.boolValue && !m_enableComputeLightEvaluation.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_enableFptlForOpaqueWhenClustered, styles.enableFptlForOpaqueWhenClustered); EditorGUI.indentLevel--; } EditorGUILayout.PropertyField(m_enableComputeLightEvaluation, styles.enableComputeLightEvaluation); if (m_enableComputeLightEvaluation.boolValue) { // Tag: SUPPORT_COMPUTE_CLUSTER_OPAQUE - Uncomment this if you want to do cluster opaque with compute shader (by default we support only fptl on opaque) m_enableFptlForOpaqueWhenClustered.boolValue = true; // Force fptl to be always true if compute evaluation is enable EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_enableComputeLightVariants, styles.enableComputeLightVariants); EditorGUILayout.PropertyField(m_enableComputeMaterialVariants, styles.enableComputeMaterialVariants); EditorGUI.indentLevel--; } } if (EditorGUI.EndChangeCheck()) { HackSetDirty(renderContext); // Repaint } EditorGUI.indentLevel--; }
public void Build(HDRenderPipelineAsset hdAsset) { // Disney SSS (compute + combine) m_SubsurfaceScatteringCS = hdAsset.renderPipelineResources.subsurfaceScatteringCS; m_SubsurfaceScatteringKernel = m_SubsurfaceScatteringCS.FindKernel("SubsurfaceScattering"); m_CombineLightingPass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.combineLighting); // Jimenez SSS Model (shader) m_SssVerticalFilterPass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.subsurfaceScattering); m_SssVerticalFilterPass.DisableKeyword("SSS_FILTER_HORIZONTAL_AND_COMBINE"); m_SssVerticalFilterPass.SetFloat(HDShaderIDs._DstBlend, (float)BlendMode.Zero); m_SssHorizontalFilterAndCombinePass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.subsurfaceScattering); m_SssHorizontalFilterAndCombinePass.EnableKeyword("SSS_FILTER_HORIZONTAL_AND_COMBINE"); m_SssHorizontalFilterAndCombinePass.SetFloat(HDShaderIDs._DstBlend, (float)BlendMode.One); m_CopyStencilForSplitLighting = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.copyStencilBuffer); m_CopyStencilForSplitLighting.SetInt(HDShaderIDs._StencilRef, (int)StencilLightingUsage.SplitLighting); }
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 Build(HDRenderPipelineAsset hdAsset) { // Disney SSS (compute + combine) string kernelName = hdAsset.currentPlatformRenderPipelineSettings.increaseSssSampleCount ? "SubsurfaceScatteringHQ" : "SubsurfaceScatteringMQ"; string kernelNameMSAA = hdAsset.currentPlatformRenderPipelineSettings.increaseSssSampleCount ? "SubsurfaceScatteringHQ_MSAA" : "SubsurfaceScatteringMQ_MSAA"; m_SubsurfaceScatteringCS = hdAsset.renderPipelineResources.shaders.subsurfaceScatteringCS; m_SubsurfaceScatteringKernel = m_SubsurfaceScatteringCS.FindKernel(kernelName); m_SubsurfaceScatteringKernelMSAA = m_SubsurfaceScatteringCS.FindKernel(kernelNameMSAA); m_CombineLightingPass = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.combineLightingPS); m_CombineLightingPass.SetInt(HDShaderIDs._StencilMask, (int)HDRenderPipeline.StencilBitMask.LightingMask); m_CopyStencilForSplitLighting = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.copyStencilBufferPS); m_CopyStencilForSplitLighting.SetInt(HDShaderIDs._StencilRef, (int)StencilLightingUsage.SplitLighting); m_CopyStencilForSplitLighting.SetInt(HDShaderIDs._StencilMask, (int)HDRenderPipeline.StencilBitMask.LightingMask); this.hdAsset = hdAsset; defaultDiffusionProfile = hdAsset.renderPipelineResources.assets.defaultDiffusionProfile; }
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 PlanarReflectionProbeCache(HDRenderPipelineAsset hdAsset, IBLFilterGGX iblFilter, int cacheSize, int probeSize, TextureFormat probeFormat, bool isMipmaped) { m_ConvertTextureMaterial = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.blitCubeTextureFacePS); m_ConvertTextureMPB = new MaterialPropertyBlock(); // BC6H requires CPP feature not yet available probeFormat = TextureFormat.RGBAHalf; Debug.Assert(probeFormat == TextureFormat.BC6H || probeFormat == TextureFormat.RGBAHalf, "Reflection Probe Cache format for HDRP can only be BC6H or FP16."); m_ProbeSize = probeSize; m_CacheSize = cacheSize; m_TextureCache = new TextureCache2D("PlanarReflectionProbe"); m_TextureCache.AllocTextureArray(cacheSize, probeSize, probeSize, probeFormat, isMipmaped); m_IBLFilterGGX = iblFilter; m_PerformBC6HCompression = probeFormat == TextureFormat.BC6H; InitializeProbeBakingStates(); }
/// <summary>Register FrameSettingsHistory for DebugMenu</summary> public static IDebugData RegisterDebug(Camera camera, HDAdditionalCameraData additionalCameraData) { HDRenderPipelineAsset hdrpAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; Assertions.Assert.IsNotNull(hdrpAsset); // complete frame settings history is required for displaying debug menu. // AggregateFrameSettings will finish the registration if it is not yet registered FrameSettings registering = new FrameSettings(); AggregateFrameSettings(ref registering, camera, additionalCameraData, hdrpAsset); GenerateFrameSettingsPanel(camera.name, frameSettingsHistory[camera]); #if UNITY_EDITOR if (sceneViewCamera == null && camera.cameraType == CameraType.SceneView) { sceneViewCamera = camera; } #endif return(frameSettingsHistory[camera]); }
private void RendereringSettingsUI(HDRenderPipelineAsset renderContext) { EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.renderingSettingsLabel); EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_RenderingUseDepthPrepass, styles.useDepthPrepass); EditorGUILayout.PropertyField(m_RenderingUseForwardOnly, styles.useForwardRenderingOnly); if (EditorGUI.EndChangeCheck()) { if (m_RenderingUseForwardOnly.boolValue && !m_RenderingUseDepthPrepass.boolValue) { // Force depth prepass for forward-only rendering (for FPTL, etc). m_RenderingUseDepthPrepass.boolValue = true; HackSetDirty(renderContext); // Repaint } } EditorGUI.indentLevel--; }
public LTCAreaLightCookieManager(HDRenderPipelineAsset hdAsset, int maxCacheSize) { // Keep track of the render pipeline asset m_RenderPipelineAsset = hdAsset; // Create the texture cookie cache that we shall be using for the area lights GlobalLightLoopSettings gLightLoopSettings = hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings; m_AreaCookieTexArray = new TextureCache2D("AreaCookie"); int cookieSize = gLightLoopSettings.cookieTexArraySize; int cookieResolution = (int)gLightLoopSettings.cookieSize; if (TextureCache2D.GetApproxCacheSizeInByte(cookieSize, cookieResolution, 1) > maxCacheSize) { cookieSize = TextureCache2D.GetMaxCacheSizeForWeightInByte(maxCacheSize, cookieResolution, 1); } m_AreaCookieTexArray.AllocTextureArray(cookieSize, cookieResolution, cookieResolution, TextureFormat.RGBA32, true); // Also make sure to create the engine material that is used for the filtering m_MaterialFilterAreaLights = CoreUtils.CreateEngineMaterial(hdAsset.renderPipelineResources.shaders.filterAreaLightCookiesPS); }