// These need to be Runtime Only because those values are held by the HDRenderPipeline asset so if user change them through the editor debug menu they might change the value in the asset without noticing it.
DebugMenuManager.instance.AddDebugItem<bool>("HDRP","Enable Big Tile",()=>m_Asset.lightLoopSettings.enableBigTilePrepass,(value)=>m_Asset.lightLoopSettings.enableBigTilePrepass=(bool)value,DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP","Enable Material Classification",()=>m_Asset.lightLoopSettings.enableComputeMaterialVariants,(value)=>m_Asset.lightLoopSettings.enableComputeMaterialVariants=(bool)value,DebugItemFlag.RuntimeOnly);
// Rendering distortion here have off course lot of artifact.
// But resolving at each objects that write in distortion is not possible (need to sort transparent, render those that do not distort, then resolve, then etc...)
// Instead we chose to apply distortion at the end after we cumulate distortion vector and desired blurriness.
// It must also have a "DepthForwardOnly" and no "DepthOnly" pass as forward material (either deferred or forward only rendering) have always a depth pass.
// In case of forward only rendering we have a depth prepass. In case of deferred renderer, it is optional
// Forward opaque material always have a prepass (whether or not we use deferred, whether or not there is option like alpha test only) so we pass the right depth state here.
// NOTE: All those properties are public because of how HDRenderPipelineInspector retrieves those properties via serialization/reflection
// Doing it this way allows to change parameters name and still retrieve correct serialized values
// To be able to turn on/off FrameSettings properties at runtime for debugging purpose without affecting the original one
// we create a runtime copy (m_effectiveFrameSettings that is used, and any parametrization is done on serialized frameSettings)
publicFrameSettingsdefaultFrameSettings=newFrameSettings();// This are the defaultFrameSettings for all the camera and apply to sceneView, public to be visible in the inspector
// Not serialized, not visible, the settings effectively used
publicboolenableTileAndCluster;// For debug / test
publicboolenableComputeLightEvaluation;
publicboolenableComputeLightVariants;
publicboolenableComputeMaterialVariants;
// Deferred opaque always use FPTL, forward opaque can use FPTL or cluster, transparent always use cluster
// When MSAA is enabled, we only support cluster (Fptl is too slow with MSAA), and we don't support MSAA for deferred path (mean it is ok to keep fptl)
publicboolenableFptlForForwardOpaque;
// clustered light list specific buffers and data begin
constboolk_UseDepthBuffer=true;// only has an impact when EnableClustered is true (requires a depth-prepass)
constboolk_UseAsyncCompute=true;// should not use on mobile
constintk_Log2NumClusters=6;// accepted range is from 0 to 6. NumClusters is 1<<g_iLog2NumClusters
constfloatk_ClustLogBase=1.02f;// each slice 2% bigger than the previous
staticComputeBuffers_GlobalLightListAtomic=null;
// clustered light list specific buffers and data end
boolm_isForwardRenderingOnly;
boolm_isFptlEnabled;
boolm_isFptlEnabledForForwardOpaque;
FrameSettingsm_FrameSettings=null;
RenderPipelineResourcesm_Resources=null;
// Following is an array of material of size eight for all combination of keyword: OUTPUT_SPLIT_LIGHTING - LIGHTLOOP_TILE_PASS - SHADOWS_SHADOWMASK - USE_FPTL_LIGHTLIST/USE_CLUSTERED_LIGHTLIST - DEBUG_DISPLAY
// Deferred opaque always use FPTL, forward opaque can use FPTL or cluster, transparent always use cluster
// When MSAA is enabled, we only support cluster (Fptl is too slow with MSAA), and we don't support MSAA for deferred path (mean it is ok to keep fptl)
// Each camera must have its own per frame settings
[Serializable]
publicclassLightingSettings
{
// Setup by users
publicboolenableShadow=true;
publicboolenableSSR=true;// Depends on DepthPyramid
publicboolenableSSAO=true;
publicboolenableSSSAndTransmission=true;
// Setup by system
publicfloatdiffuseGlobalDimmer=1.0f;
publicfloatspecularGlobalDimmer=1.0f;
}
[Serializable]
publicclassRenderSettings
{
// Setup by users
publicboolenableForwardRenderingOnly=false;// TODO: Currently there is no way to strip the extra forward shaders generated by the shaders compiler, so we can switch dynamically.
publicboolenableRoughRefraction=true;// Depends on DepthPyramid - If not enable, just do a copy of the scene color (?) - how to disable rough refraction ?
DebugMenuManager.instance.AddDebugItem<bool>(menuName,"Enable SSS and Transmission",()=>frameSettings.lightingSettings.enableSSSAndTransmission,(value)=>frameSettings.lightingSettings.enableSSSAndTransmission=(bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName,"Enable Big Tile",()=>frameSettings.lightLoopSettings.enableBigTilePrepass,(value)=>frameSettings.lightLoopSettings.enableBigTilePrepass=(bool)value);
DebugMenuManager.instance.AddDebugItem<bool>(menuName,"Enable Material Classification",()=>frameSettings.lightLoopSettings.enableComputeMaterialVariants,(value)=>frameSettings.lightLoopSettings.enableComputeMaterialVariants=(bool)value);
// GlobalFrameSettings define settings that can't be change during runtime. It is equivalent to the GraphicsSettings of Unity (Tiers + shader variant removal).
// This allow to allocate resource or not for a given feature.
// FrameSettings control within a frame what is enable or not(enableShadow, enableStereo, enableDistortion...).
// HDRenderPipelineAsset reference the current GlobalFrameSettings use, there is one per supported platform(Currently this feature is not implemented and only one GlobalFrameSettings is available).
// A Camera with HDAdditionalData have one FrameSettings that configure how it will render.For example a camera use for reflection will disable distortion and postprocess.
// Additionaly on a Camera there is another Framesettings call EffectiveFrameSettings that is created on the fly based on FrameSettings and allow modificaiton for debugging purpose at runtime without being serialized on disk.
// The EffectiveFrameSettings is register in the debug windows at the creation of the camera.
// A Camera with HDAdditionalData have a RenderPath that define if it use a "Default" FrameSettings, a preset of FrameSettings or a custom one.
// HDRenderPipelineAsset contain a "Default" FrameSettings that can be reference by any camera with RenderPath.Defaut or when the camera don't have HDAdditionalData like the camera of the Editor.
// It also contain a DefaultEffectiveFrameSettings
// GlobalFrameSettings represent settings that are immutable at runtime.
// There is a dedicated RenderRenderPipelineSettings for each platform
publicbooluseForwardRenderingOnly;// TODO: Currently there is no way to strip the extra forward shaders generated by the shaders compiler, so we can switch dynamically.
publicbooluseDepthPrepassWithDeferredRendering;
publicboolrenderAlphaTestOnlyInDeferredPrepass;
// We have to fall back to forward-only rendering when scene view is using wireframe rendering mode --
// as rendering everything in wireframe + deferred do not play well together