浏览代码

Merge pull request #1586 from Unity-Technologies/ExposeShadowBudgetParameters

Expose shadow budget parameters
/main
GitHub 7 年前
当前提交
dc7e7036
共有 6 个文件被更改,包括 45 次插入4 次删除
  1. 7
      com.unity.render-pipelines.core/CoreRP/Shadow/ShadowBase.cs
  2. 1
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  3. 7
      com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/SerializedShadowInitParameters.cs
  4. 24
      com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/ShadowInitParametersUI.cs
  5. 4
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
  6. 6
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs

7
com.unity.render-pipelines.core/CoreRP/Shadow/ShadowBase.cs


public class ShadowInitParameters
{
public const int kDefaultShadowAtlasSize = 4096;
public const int kDefaultMaxPointLightShadows = 6;
public const int kDefaultMaxSpotLightShadows = 12;
public const int kDefaultMaxDirectionalLightShadows = 1;
public int maxPointLightShadows = kDefaultMaxPointLightShadows;
public int maxSpotLightShadows = kDefaultMaxSpotLightShadows;
public int maxDirectionalLightShadows = kDefaultMaxDirectionalLightShadows;
}
// Class used to pass parameters to the shadow system on a per frame basis.

1
com.unity.render-pipelines.high-definition/CHANGELOG.md


- Add option supportDitheringCrossFade on HDRP Asset to allow to remove shader variant during player build if needed
- Add contact shadows for punctual lights (in additional shadow settings), only one light is allowed to cast contact shadows at the same time and so at each frame a dominant light is choosed among all light with contact shadows enabled.
- Add PCSS shadow filter support (from SRP Core)
- Exposed shadow budget parameters in HDRP asset
### Changed
- Re-enable shadow mask mode in debug view

7
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/SerializedShadowInitParameters.cs


public SerializedProperty shadowAtlasWidth;
public SerializedProperty shadowAtlasHeight;
public SerializedProperty maxPointLightShadows;
public SerializedProperty maxSpotLightShadows;
public SerializedProperty maxDirectionalLightShadows;
public SerializedShadowInitParameters(SerializedProperty root)
{
this.root = root;

maxPointLightShadows = root.Find((ShadowInitParameters s) => s.maxPointLightShadows);
maxSpotLightShadows = root.Find((ShadowInitParameters s) => s.maxSpotLightShadows);
maxDirectionalLightShadows = root.Find((ShadowInitParameters s) => s.maxDirectionalLightShadows);
}
}
}

24
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/ShadowInitParametersUI.cs


using UnityEditor.AnimatedValues;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering
{

static void Drawer_FieldShadowSize(ShadowInitParametersUI s, SerializedShadowInitParameters d, Editor o)
{
EditorGUILayout.LabelField(_.GetContent("Shadow Atlas Settings"), EditorStyles.boldLabel);
EditorGUILayout.LabelField(_.GetContent("Shadow"), EditorStyles.boldLabel);
++EditorGUI.indentLevel;
EditorGUILayout.LabelField(_.GetContent("Shadow Atlas"), EditorStyles.boldLabel);
--EditorGUI.indentLevel;
EditorGUILayout.Space();
EditorGUILayout.LabelField(_.GetContent("Shadow Map Budget"), EditorStyles.boldLabel);
++EditorGUI.indentLevel;
EditorGUILayout.PropertyField(d.maxPointLightShadows, _.GetContent("Max Point Light Shadows"));
EditorGUILayout.PropertyField(d.maxSpotLightShadows, _.GetContent("Max Spot Light Shadows"));
EditorGUILayout.PropertyField(d.maxDirectionalLightShadows, _.GetContent("Max Directional Light Shadows"));
--EditorGUI.indentLevel;
// Clamp negative values
d.shadowAtlasHeight.intValue = Mathf.Max(0, d.shadowAtlasHeight.intValue);
d.shadowAtlasWidth.intValue = Mathf.Max(0, d.shadowAtlasWidth.intValue);
d.maxPointLightShadows.intValue = Mathf.Max(0, d.maxPointLightShadows.intValue);
d.maxSpotLightShadows.intValue = Mathf.Max(0, d.maxSpotLightShadows.intValue);
d.maxDirectionalLightShadows.intValue = Mathf.Max(0, d.maxDirectionalLightShadows.intValue);
--EditorGUI.indentLevel;
}
}

4
com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset


enableUltraQualitySSS: 0
supportVolumetric: 1
supportRuntimeDebugDisplay: 1
supportDitheringCrossFade: 1
supportDBuffer: 1
supportMSAA: 0
msaaSampleCount: 1

shadowInitParams:
shadowAtlasWidth: 4096
shadowAtlasHeight: 4096
maxPointLightShadows: 6
maxSpotLightShadows: 12
maxDirectionalLightShadows: 1
decalSettings:
drawDistance: 1000
atlasWidth: 4096

6
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


scInit.resourceBinder = binder;
ShadowManager.ShadowBudgets budgets;
budgets.maxPointLights = 6;
budgets.maxSpotLights = 12;
budgets.maxDirectionalLights = 1;
budgets.maxPointLights = shadowInit.maxPointLightShadows;
budgets.maxSpotLights = shadowInit.maxSpotLightShadows;
budgets.maxDirectionalLights = shadowInit.maxDirectionalLightShadows;
m_ShadowMgr = new ShadowManager(shadowSettings, ref scInit, ref budgets, m_Shadowmaps);
// set global overrides - these need to match the override specified in LightLoop/Shadow.hlsl

正在加载...
取消
保存