浏览代码

Another no compiling draft

/feature-ReflectionProbeFit
sebastienlagarde 7 年前
当前提交
cf6142d2
共有 11 个文件被更改,包括 154 次插入74 次删除
  1. 27
      ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs
  2. 16
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.Styles.cs
  3. 99
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
  4. 8
      ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
  5. 2
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/Lit/LitUI.cs
  6. 2
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/SubsurfaceScattering/SubsurfaceScatteringSettingsEditor.cs
  7. 27
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  8. 30
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs
  9. 4
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  10. 11
      ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
  11. 2
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/GlobalFrameSettings.cs

27
ScriptableRenderPipeline/HDRenderPipeline/Debug/DebugDisplay.cs


lightingDebugSettings.debugLightingMode = value;
}
public void RegisterDebug(FrameSettings debugSettings)
public void RegisterDebug(FrameSettings debugSettings, FrameSettings defaultFrameSettings)
{
DebugMenuManager.instance.AddDebugItem<float>("Display Stats", "Frame Rate", () => 1.0f / Time.smoothDeltaTime, null, DebugItemFlag.DynamicDisplay);
DebugMenuManager.instance.AddDebugItem<float>("Display Stats", "Frame Time (ms)", () => Time.smoothDeltaTime * 1000.0f, null, DebugItemFlag.DynamicDisplay);

DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, LightLoop.TileClusterDebug>(kTileClusterDebug,() => lightingDebugSettings.tileClusterDebug, (value) => lightingDebugSettings.tileClusterDebug = (LightLoop.TileClusterDebug)value);
DebugMenuManager.instance.AddDebugItem<LightingDebugPanel, LightLoop.TileClusterCategoryDebug>(kTileClusterCategoryDebug,() => lightingDebugSettings.tileClusterDebugByCategory, (value) => lightingDebugSettings.tileClusterDebugByCategory = (LightLoop.TileClusterCategoryDebug)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Display Opaque",() => debugSettings.renderSettings.enableOpaqueObjects, (value) => debugSettings.renderSettings.enableOpaqueObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Display Transparency",() => debugSettings.renderSettings.enableTransparentObjects, (value) => debugSettings.renderSettings.enableTransparentObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Opaque", () => debugSettings.renderSettings.enableOpaqueObjects, (value) => debugSettings.renderSettings.enableOpaqueObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Transparent", () => debugSettings.renderSettings.enableTransparentObjects, (value) => debugSettings.renderSettings.enableTransparentObjects = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Allow Stereo Rendering",() => debugSettings.renderSettings.enableStereo, (value) => debugSettings.renderSettings.enableStereo = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Rendering", "Enable Stereo Rendering",() => debugSettings.renderSettings.enableStereo, (value) => debugSettings.renderSettings.enableStereo = (bool)value);
// Following settings are overwrite of defaultFrameSettings instead of using debugSettings as otherwise we can't have a correct rendering (as debugSettings will always be enabled)
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Forward Only", () => debugSettings.renderSettings.enableForwardRenderingOnly, (value) => debugSettings.renderSettings.enableForwardRenderingOnly = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Deferred Depth Prepass", () => debugSettings.renderSettings.enableDepthPrepassWithDeferredRendering, (value) => debugSettings.renderSettings.enableDepthPrepassWithDeferredRendering = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Deferred Depth Prepass ATest Only", () => debugSettings.renderSettings.enableAlphaTestOnlyInDeferredPrepass, (value) => debugSettings.renderSettings.enableAlphaTestOnlyInDeferredPrepass = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Forward Only", () => defaultFrameSettings.renderSettings.enableForwardRenderingOnly, (value) => debugSettings.renderSettings.enableForwardRenderingOnly = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Deferred Depth Prepass", () => defaultFrameSettings.renderSettings.enableDepthPrepassWithDeferredRendering, (value) => debugSettings.renderSettings.enableDepthPrepassWithDeferredRendering = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Deferred Depth Prepass ATest Only", () => defaultFrameSettings.renderSettings.enableAlphaTestOnlyInDeferredPrepass, (value) => debugSettings.renderSettings.enableAlphaTestOnlyInDeferredPrepass = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Tile/Cluster", () => debugSettings.lightLoopSettings.enableTileAndCluster, (value) => debugSettings.lightLoopSettings.enableTileAndCluster = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Big Tile", () => debugSettings.lightLoopSettings.enableBigTilePrepass, (value) => debugSettings.lightLoopSettings.enableBigTilePrepass = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Compute Lighting", () => debugSettings.lightLoopSettings.enableComputeLightEvaluation, (value) => debugSettings.lightLoopSettings.enableComputeLightEvaluation = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Light Classification", () => debugSettings.lightLoopSettings.enableComputeLightVariants, (value) => debugSettings.lightLoopSettings.enableComputeLightVariants = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Material Classification", () => debugSettings.lightLoopSettings.enableComputeMaterialVariants, (value) => debugSettings.lightLoopSettings.enableComputeMaterialVariants = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Tile/Cluster", () => defaultFrameSettings.lightLoopSettings.enableTileAndCluster, (value) => debugSettings.lightLoopSettings.enableTileAndCluster = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Big Tile", () => defaultFrameSettings.lightLoopSettings.enableBigTilePrepass, (value) => debugSettings.lightLoopSettings.enableBigTilePrepass = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Compute Lighting", () => defaultFrameSettings.lightLoopSettings.enableComputeLightEvaluation, (value) => debugSettings.lightLoopSettings.enableComputeLightEvaluation = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Light Classification", () => defaultFrameSettings.lightLoopSettings.enableComputeLightVariants, (value) => debugSettings.lightLoopSettings.enableComputeLightVariants = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Material Classification", () => defaultFrameSettings.lightLoopSettings.enableComputeMaterialVariants, (value) => debugSettings.lightLoopSettings.enableComputeMaterialVariants = (bool)value, DebugItemFlag.RuntimeOnly);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Async Compute", () => debugSettings.renderSettings.enableAsyncCompute, (value) => debugSettings.renderSettings.enableAsyncCompute = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("HDRP", "Enable Async Compute", () => debugSettings.renderSettings.enableAsyncCompute, (value) => debugSettings.renderSettings.enableAsyncCompute = (bool)value, DebugItemFlag.RuntimeOnly);
}
public void OnValidate()

16
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.Styles.cs


public readonly GUIContent globalFrameSettings = new GUIContent("Global Frame Settings");
// Shadow Settings
public readonly GUIContent supportDBuffer = new GUIContent("Support Decal buffer");
public readonly GUIContent supportMSAA = new GUIContent("Support MSAA");
// Shadow Settings
public readonly GUIContent shadowSettings = new GUIContent("Shadow Settings");
public readonly GUIContent shadowsAtlasWidth = new GUIContent("Atlas Width");
public readonly GUIContent shadowsAtlasHeight = new GUIContent("Atlas Height");
// LightLoop Settings
public readonly GUIContent textureSettings = new GUIContent("LightLoop Settings");
public readonly GUIContent spotCookieSize = new GUIContent("Spot Cookie Size");
public readonly GUIContent pointCookieSize = new GUIContent("Point Cookie Size");
public readonly GUIContent reflectionCubemapSize = new GUIContent("Reflection Cubemap Size");
public readonly GUIContent reflectionCacheCompressed = new GUIContent("Compress Reflection Probe Cache");
public readonly GUIContent defaultFrameSettings = new GUIContent("Default Frame Settings");
// Rendering Settings
public readonly GUIContent renderingSettingsLabel = new GUIContent("Rendering Settings");
public readonly GUIContent useForwardRenderingOnly = new GUIContent("Use Forward Rendering Only");

99
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs


SerializedProperty m_DefaultShader;
// Global Frame Settings
SerializedProperty m_GlobalFrameSettings;
// Global Render settings
SerializedProperty m_supportDBuffer;
SerializedProperty m_supportMSAA;
// Global Shadow settings
SerializedProperty m_ShadowAtlasWidth;
SerializedProperty m_ShadowAtlasHeight;
// Global LightLoop settings
SerializedProperty m_SpotCookieSize;
SerializedProperty m_PointCookieSize;
SerializedProperty m_ReflectionCubemapSize;
SerializedProperty m_ReflectionCacheCompressed;
// FrameSettings
// LightLoop settings
SerializedProperty m_enableTileAndCluster;
SerializedProperty m_enableSplitLightEvaluation;

SerializedProperty m_enableFptlForForwardOpaque;
SerializedProperty m_enableBigTilePrepass;
// Rendering Settings
SerializedProperty m_RenderingUseForwardOnly;
SerializedProperty m_RenderingUseDepthPrepass;

m_DefaultShader = properties.Find("m_DefaultShader");
// Global FrameSettings
m_GlobalFrameSettings = properties.Find(x => x.globalFrameSettings);
// Global Render settings
m_supportDBuffer = properties.Find(x => x.globalFrameSettings.renderSettings.supportDBuffer);
m_supportMSAA = properties.Find(x => x.globalFrameSettings.renderSettings.supportMSAA);
// Global Shadow settings
m_ShadowAtlasWidth = properties.Find(x => x.globalFrameSettings.shadowInitParams.shadowAtlasWidth);
m_ShadowAtlasHeight = properties.Find(x => x.globalFrameSettings.shadowInitParams.shadowAtlasHeight);
// Global LightLoop settings
m_SpotCookieSize = properties.Find(x => x.globalFrameSettings.lightLoopSettings.spotCookieSize);
m_PointCookieSize = properties.Find(x => x.globalFrameSettings.lightLoopSettings.pointCookieSize);
m_ReflectionCubemapSize = properties.Find(x => x.globalFrameSettings.lightLoopSettings.reflectionCubemapSize);
m_ReflectionCacheCompressed = properties.Find(x => x.globalFrameSettings.lightLoopSettings.reflectionCacheCompressed);
// FrameSettings
// LightLoop settings
m_enableTileAndCluster = properties.Find(x => x.defaultFrameSettings.lightLoopSettings.enableTileAndCluster);
m_enableComputeLightEvaluation = properties.Find(x => x.defaultFrameSettings.lightLoopSettings.enableComputeLightEvaluation);

m_enableBigTilePrepass = properties.Find(x => x.defaultFrameSettings.lightLoopSettings.enableBigTilePrepass);
// Rendering Settings
m_enableAsyncCompute = properties.Find(x => x.defaultFrameSettings.renderSettings.enableAsyncCompute);
m_RenderingUseForwardOnly = properties.Find(x => x.defaultFrameSettings.renderSettings.enableForwardRenderingOnly);

method.Invoke(asset, new object[0]);
}
void LightLoopSettingsUI(HDRenderPipelineAsset renderContext)
void GlobalLightLoopSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.textureSettings);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_SpotCookieSize, s_Styles.spotCookieSize);
EditorGUILayout.PropertyField(m_PointCookieSize, s_Styles.pointCookieSize);
EditorGUILayout.PropertyField(m_ReflectionCubemapSize, s_Styles.reflectionCubemapSize);
// Commented out until we have proper realtime BC6H compression
//EditorGUILayout.PropertyField(m_ReflectionCacheCompressed, s_Styles.reflectionCacheCompressed);
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}
void GlobalRenderSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.renderingSettingsLabel);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_supportDBuffer, s_Styles.supportDBuffer);
EditorGUILayout.PropertyField(m_supportMSAA, s_Styles.supportMSAA);
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}
void GlobalShadowSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.shadowSettings);
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_ShadowAtlasWidth, s_Styles.shadowsAtlasWidth);
EditorGUILayout.PropertyField(m_ShadowAtlasHeight, s_Styles.shadowsAtlasHeight);
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(hdAsset); // Repaint
}
EditorGUI.indentLevel--;
}
void LightLoopSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.lightLoopSettings);

}
if (EditorGUI.EndChangeCheck())
{
HackSetDirty(renderContext); // Repaint
HackSetDirty(hdAsset); // Repaint
void RendereringSettingsUI(HDRenderPipelineAsset renderContext)
void RendereringSettingsUI(HDRenderPipelineAsset hdAsset)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(s_Styles.renderingSettingsLabel);

EditorGUI.indentLevel--;
}
void SettingsUI(HDRenderPipelineAsset renderContext)
void SettingsUI(HDRenderPipelineAsset hdAsset)
EditorGUILayout.PropertyField(m_GlobalFrameSettings, s_Styles.globalFrameSettings);
EditorGUILayout.LabelField(s_Styles.globalFrameSettings, EditorStyles.boldLabel);
RendereringSettingsUI(renderContext);
LightLoopSettingsUI(renderContext);
GlobalRenderSettingsUI(hdAsset);
GlobalShadowSettingsUI(hdAsset);
GlobalLightLoopSettingsUI(hdAsset);
EditorGUILayout.PropertyField(m_SubsurfaceScatteringSettings, s_Styles.sssSettings);
EditorGUILayout.LabelField(s_Styles.defaultFrameSettings, EditorStyles.boldLabel);
RendereringSettingsUI(hdAsset);
LightLoopSettingsUI(hdAsset);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(m_SubsurfaceScatteringSettings, s_Styles.sssSettings);
}
protected override void OnEnable()

8
ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs


class DoCreateNewAssetHDRISkySettings : DoCreateNewAsset<HDRISkySettings> {}
class DoCreateNewAssetProceduralSkySettings : DoCreateNewAsset<ProceduralSkySettings> {}
class DoCreateNewAssetSubsurfaceScatteringSettings : DoCreateNewAsset<SubsurfaceScatteringSettings> {}
class DoCreateNewAssetGlobalFrameSettings : DoCreateNewAsset<GlobalFrameSettings> { }
[MenuItem("Assets/Create/Render Pipeline/High Definition/Global Frame Settings", priority = CoreUtils.assetCreateMenuPriority2)]
static void MenuCreateGlobalFrameSettings()
{
var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon");
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DoCreateNewAssetGlobalFrameSettings>(), "New Global Frame Settings.asset", icon, null);
}
[MenuItem("Assets/Create/Render Pipeline/High Definition/Common Settings", priority = CoreUtils.assetCreateMenuPriority2)]
static void MenuCreateCommonSettings()

2
ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/Lit/LitUI.cs


protected void ShaderSSSInputGUI(Material material, int layerIndex)
{
var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
var sssSettings = hdPipeline.GetCurrentSssSettings();
var sssSettings = hdPipeline.sssSettings;
if (sssSettings == null)
{

2
ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/SubsurfaceScattering/SubsurfaceScatteringSettingsEditor.cs


CheckStyles();
// Display a warning if this settings asset is not currently in use
if (m_HDPipeline == null || m_HDPipeline.GetCurrentSssSettings() != m_Target)
if (m_HDPipeline == null || m_HDPipeline.sssSettings != m_Target)
EditorGUILayout.HelpBox("These profiles aren't currently in use, assign this asset to the HD render pipeline asset to use them.", MessageType.Warning);
serializedObject.Update();

27
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


readonly HDRenderPipelineAsset m_Asset;
public SubsurfaceScatteringSettings GetCurrentSssSettings()
SubsurfaceScatteringSettings m_InternalSSSAsset;
public SubsurfaceScatteringSettings sssSettings
return m_Asset.sssSettings;
get
{
// If no SSS asset is set, build / reuse an internal one for simplicity
var asset = m_Asset.sssSettings;
if (asset == null)
{
if (m_InternalSSSAsset == null)
m_InternalSSSAsset = ScriptableObject.CreateInstance<SubsurfaceScatteringSettings>();
asset = m_InternalSSSAsset;
}
return asset;
}
}
readonly RenderPipelineMaterial m_DeferredMaterial;

m_SkyManager.Build(asset, m_IBLFilterGGX);
m_SkyManager.skySettings = skySettingsToUse;
m_DebugDisplaySettings.RegisterDebug(m_debugSettings);
m_DebugDisplaySettings.RegisterDebug(m_debugSettings, m_Asset.defaultFrameSettings);
m_DebugFullScreenTempRT = HDShaderIDs._DebugFullScreenTexture;

// First, get aggregate of frame settings base on global settings, camera frame settings and debug settings
var additionalCameraData = camera.GetComponent<HDAdditionalCameraData>();
// Note: the scene view camera will never have additionalCameraData
m_FrameSettings = FrameSettings.InitializeFrameSettings( camera, m_Asset.globalFrameSettings,
m_FrameSettings = FrameSettings.InitializeFrameSettings( camera, m_Asset.GetGlobalFrameSettings(),
(additionalCameraData && additionalCameraData.renderingPath != HDAdditionalCameraData.RenderingPath.Default) ? additionalCameraData.frameSettings : m_Asset.defaultFrameSettings,
(camera.cameraType != CameraType.Preview && camera.cameraType != CameraType.Preview) ? m_debugSettings : null);

renderContext.SetupCameraProperties(camera);
PushGlobalParams(hdCamera, cmd, m_Asset.sssSettings);
PushGlobalParams(hdCamera, cmd, sssSettings);
// TODO: Find a correct place to bind these material textures
// We have to bind the material specific global parameters in this mode

RenderForwardError(m_CullResults, camera, renderContext, cmd, ForwardPass.Opaque);
// SSS pass here handle both SSS material from deferred and forward
m_SSSBufferManager.SubsurfaceScatteringPass(hdCamera, cmd, m_Asset.sssSettings, m_FrameSettings,
m_SSSBufferManager.SubsurfaceScatteringPass(hdCamera, cmd, sssSettings, m_FrameSettings,
m_CameraColorBufferRT, m_CameraSssDiffuseLightingBufferRT, m_CameraDepthStencilBufferRT, GetDepthTexture());
RenderSky(hdCamera, cmd);

30
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs


public FrameSettings defaultFrameSettings = new FrameSettings(); // This are the defaultFrameSettings for all the camera and apply to sceneView
[SerializeField]
GlobalFrameSettings m_globalFrameSettings;
public GlobalFrameSettings globalFrameSettings
{
// TODO: This function must return the current globalFrameSettings for the given platform
// If nothing is define we return a default value
get
{
if (m_globalFrameSettings == null)
{
if (m_defaultGlobalFrameSettings == null)
m_defaultGlobalFrameSettings = ScriptableObject.CreateInstance<GlobalFrameSettings>(); // TODO: where to destroy this ?
m_globalFrameSettings = m_defaultGlobalFrameSettings;
}
// Store the various GlobalFrameSettings for each platform (for now only one)
public GlobalFrameSettings globalFrameSettings = new GlobalFrameSettings();
return m_globalFrameSettings;
}
set { m_globalFrameSettings = value; }
// Return the current use GlobalFrameSettings (i.e for the current platform
public GlobalFrameSettings GetGlobalFrameSettings()
{
return globalFrameSettings;
GlobalFrameSettings m_defaultGlobalFrameSettings;
SubsurfaceScatteringSettings m_sssSettings;
public SubsurfaceScatteringSettings sssSettings;
// Default Material / Shader
[SerializeField]

4
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


s_EnvLightDatas = new ComputeBuffer(k_MaxEnvLightsOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(EnvLightData)));
s_shadowDatas = new ComputeBuffer(k_MaxCascadeCount + k_MaxShadowOnScreen, System.Runtime.InteropServices.Marshal.SizeOf(typeof(ShadowData)));
GlobalLightLoopSettings gLightLoopSettings = hdAsset.globalFrameSettings.lightLoopSettings;
GlobalLightLoopSettings gLightLoopSettings = hdAsset.GetGlobalFrameSettings().lightLoopSettings;
m_CookieTexArray = new TextureCache2D();
m_CookieTexArray.AllocTextureArray(gLightLoopSettings.cookieTexArraySize, gLightLoopSettings.spotCookieSize, gLightLoopSettings.spotCookieSize, TextureFormat.RGBA32, true);
m_CubeCookieTexArray = new TextureCacheCubemap();

UnityEditor.SceneView.onSceneGUIDelegate += OnSceneGUI;
#endif
InitShadowSystem(hdAsset.globalFrameSettings.shadowInitParams, shadowSettings);
InitShadowSystem(hdAsset.GetGlobalFrameSettings().shadowInitParams, shadowSettings);
}
public void Cleanup()

11
ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs


// This is use to be able to read stencil value in compute shader
Material m_CopyStencilForSplitLighting;
SubsurfaceScatteringSettings m_sssSettings;
public SubsurfaceScatteringManager()
{
m_SSSBuffer0 = HDShaderIDs._SSSBufferTexture[0];

public void Build(HDRenderPipelineAsset hdAsset)
{
m_sssSettings = hdAsset.sssSettings;
// Disney SSS (compute + combine)
m_SubsurfaceScatteringCS = hdAsset.renderPipelineResources.subsurfaceScatteringCS;
m_SubsurfaceScatteringKernel = m_SubsurfaceScatteringCS.FindKernel("SubsurfaceScattering");

public void SubsurfaceScatteringPass(HDCamera hdCamera, CommandBuffer cmd, SubsurfaceScatteringSettings sssParameters, FrameSettings frameSettings,
RenderTargetIdentifier colorBufferRT, RenderTargetIdentifier diffuseBufferRT, RenderTargetIdentifier depthStencilBufferRT, RenderTargetIdentifier depthTextureRT)
{
if (m_sssSettings == null || !frameSettings.lightingSettings.enableSSSAndTransmission)
if (sssParameters == null || !frameSettings.lightingSettings.enableSSSAndTransmission)
return;
using (new ProfilingSample(cmd, "Subsurface Scattering", HDRenderPipeline.GetSampler(CustomSamplerId.SubsurfaceScattering)))

// For Jimenez we always need an extra buffer, for Disney it depends on platform
if (!m_sssSettings.useDisneySSS ||
(m_sssSettings.useDisneySSS && NeedTemporarySubsurfaceBuffer()))
if (!sssParameters.useDisneySSS ||
(sssParameters.useDisneySSS && NeedTemporarySubsurfaceBuffer()))
{
// Caution: must be same format as m_CameraSssDiffuseLightingBuffer
cmd.ReleaseTemporaryRT(m_CameraFilteringBuffer);

}
}
if (m_sssSettings.useDisneySSS)
if (sssParameters.useDisneySSS)
{
using (new ProfilingSample(cmd, "HTile for SSS", HDRenderPipeline.GetSampler(CustomSamplerId.HTileForSSS)))
{

2
ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/GlobalFrameSettings.cs


// GlobalFrameSettings represent settings that are immutable at runtime.
// There is a dedicated RenderRenderPipelineSettings for each platform
[Serializable]
public class GlobalFrameSettings : ScriptableObject
public class GlobalFrameSettings
{
[Serializable]
public class GlobalLightingSettings

正在加载...
取消
保存