浏览代码

Added support to multiple shadow casting lights.

/main
Felipe Lira 7 年前
当前提交
e1a64f54
共有 1 个文件被更改,包括 7 次插入8 次删除
  1. 15
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightShadowPass.cs

15
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightShadowPass.cs


List<int> localLightIndices = lightData.localLightIndices;
List<VisibleLight> visibleLights = lightData.visibleLights;
// TODO: for now we just support 1 local shadow casting light
const int kMaxLocalShadowCastingLightsCount = 1;
for (int i = 0; i < localLightIndices.Count; ++i)
int localLightsCount = Math.Min(localLightIndices.Count, kMaxLocalPixelLightPerPass);
for (int i = 0; i < localLightsCount; ++i)
if (shadowLight.lightType == LightType.Spot && shadowLight.light.shadows != LightShadows.None && shadowCastingLightsCount < kMaxLocalShadowCastingLightsCount)
if (shadowLight.lightType == LightType.Spot && shadowLight.light.shadows != LightShadows.None)
shadowCastingLightsCount++;
}

CoreUtils.SetRenderTarget(cmd, m_LocalShadowmapTexture, ClearFlag.Depth);
for (int i = 0; i < localLightIndices.Count; ++i)
for (int i = 0; i < localLightsCount; ++i)
{
int shadowLightIndex = localLightIndices[i];
VisibleLight shadowLight = visibleLights[shadowLightIndex];

m_LocalLightSlices[i].resolution = sliceResolution;
m_LocalLightSlices[i].shadowTransform = GetShadowTransform(proj, view);
if (shadowCastingLightsCount > 1)
ApplySliceTransform(ref m_LocalLightSlices[i], atlasWidth, atlasHeight);
// TODO: only one local shadow casting light is supported for now.
break;
}
}

正在加载...
取消
保存