浏览代码

Fixed issue that was causing spot light shadows to not be rendered when cascades were enabled.

/vr_sandbox
Felipe Lira 8 年前
当前提交
a6f26ba7
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 15
      Assets/LowEndMobilePipeline/LowEndMobilePipeline.cs

15
Assets/LowEndMobilePipeline/LowEndMobilePipeline.cs


private static readonly int kMaxCascades = 4;
private static readonly int kMaxLights = 8;
private int m_ShadowCasterCascadesCount = kMaxCascades;
private int m_ShadowMapProperty;
private RenderTargetIdentifier m_ShadowMapRTID;
private int m_DepthBufferBits = 24;

// Setup light and shadow shader constants
SetupLightShaderVariables(cull.visibleLights, context);
if (shadowsRendered)
SetupShadowShaderVariables(context, m_ShadowSettings.directionalLightCascadeCount);
SetupShadowShaderVariables(context, m_ShadowCasterCascadesCount);
// Render Opaques
var settings = new DrawRendererSettings(cull, camera, m_ForwardBasePassName);

private bool RenderShadows(CullResults cullResults, ScriptableRenderContext context)
{
int cascadeCount = m_ShadowSettings.directionalLightCascadeCount;
m_ShadowCasterCascadesCount = m_ShadowSettings.directionalLightCascadeCount;
VisibleLight[] lights = cullResults.visibleLights;
int lightCount = lights.Length;

{
lightIndex = i;
if (lights[i].lightType == LightType.Spot)
cascadeCount = 1;
m_ShadowCasterCascadesCount = 1;
m_ShadowSettings.shadowAtlasHeight, cascadeCount);
m_ShadowSettings.shadowAtlasHeight, m_ShadowCasterCascadesCount);
break;
}
}

}
else if (lights[lightIndex].lightType == LightType.Directional)
{
for (int cascadeIdx = 0; cascadeIdx < cascadeCount; ++cascadeIdx)
for (int cascadeIdx = 0; cascadeIdx < m_ShadowCasterCascadesCount; ++cascadeIdx)
cascadeIdx, cascadeCount, splitRatio, shadowResolution, shadowNearPlane, out view, out proj,
cascadeIdx, m_ShadowCasterCascadesCount, splitRatio, shadowResolution, shadowNearPlane, out view, out proj,
out settings.splitData);
m_DirectionalShadowSplitDistances[cascadeIdx] = settings.splitData.cullingSphere;

else
cmd.DisableShaderKeyword("_VERTEX_LIGHTS");
if (m_Asset.CascadeCount == 1)
if (m_ShadowCasterCascadesCount == 1)
cmd.DisableShaderKeyword("_SHADOW_CASCADES");
else
cmd.EnableShaderKeyword("_SHADOW_CASCADES");

正在加载...
取消
保存