浏览代码

Provided way of passing in values for per frame shadow update budgets.

/main
uygar 7 年前
当前提交
706c8fbf
共有 2 个文件被更改,包括 25 次插入1 次删除
  1. 19
      ScriptableRenderPipeline/Core/CoreRP/Shadow/Shadow.cs
  2. 7
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs

19
ScriptableRenderPipeline/Core/CoreRP/Shadow/Shadow.cs


public VectorArray<ShadowPayload> payloads { get { return m_Payloads; } set { m_Payloads = value; } }
}
public struct ShadowBudgets
{
public int maxPointLights;
public int maxSpotLights;
public int maxDirectionalLights;
}
private const int k_MaxShadowmapPerType = 4;
private ShadowSettings m_ShadowSettings;
private ShadowmapBase[] m_Shadowmaps;

// and register itself
AdditionalShadowDataEditor.SetRegistry( this );
#endif
}
public ShadowManager(ShadowSettings shadowSettings, ref ShadowContext.CtxtInit ctxtInitializer, ref ShadowBudgets budgets, ShadowmapBase[] shadowmaps ) : this( shadowSettings, ref ctxtInitializer, shadowmaps )
{
SetPerFrameBudgets( ref budgets );
}
public void SetPerFrameBudgets( ref ShadowBudgets budgets )
{
m_MaxShadows[(int)GPUShadowType.Point ,0] = m_MaxShadows[(int)GPUShadowType.Point ,1] = budgets.maxPointLights;
m_MaxShadows[(int)GPUShadowType.Spot ,0] = m_MaxShadows[(int)GPUShadowType.Spot ,1] = budgets.maxSpotLights;
m_MaxShadows[(int)GPUShadowType.Directional,0] = m_MaxShadows[(int)GPUShadowType.Directional ,1] = budgets.maxDirectionalLights;
}
public override void UpdateCullingParameters( ref ScriptableCullingParameters cullingParams )

7
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


scInit.dataSyncer = syncer;
scInit.resourceBinder = binder;
m_ShadowMgr = new ShadowManager(shadowSettings, ref scInit, m_Shadowmaps);
ShadowManager.ShadowBudgets budgets;
budgets.maxPointLights = 6;
budgets.maxSpotLights = 12;
budgets.maxDirectionalLights = 1;
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
bool useGlobalOverrides = true;
m_ShadowMgr.SetGlobalShadowOverride( GPUShadowType.Point , ShadowAlgorithm.PCF, ShadowVariant.V2, ShadowPrecision.High, useGlobalOverrides );

正在加载...
取消
保存