浏览代码

Fixed issue that was causing point lights to not be shaded when only 1 light was visible.

/Add-support-for-light-specular-color-tint
Felipe Lira 7 年前
当前提交
e3ae9976
共有 1 个文件被更改,包括 9 次插入11 次删除
  1. 20
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs

20
ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


lightData.shadowsRendered = false;
// We always support at least one per-pixel light, which is main light. Shade objects up to a limit of per-object
// pixel lights defined in the pipeline settings.
int maxSupportedPixelLights = Math.Min(m_Asset.MaxAdditionalPixelLights, kMaxPerObjectAdditionalLights) + 1;
int maxPixelLights = Math.Min(maxSupportedPixelLights, visibleLightsCount);
// If vertex lighting is enabled in the pipeline settings, then we shade the remaining visible lights per-vertex
// up to the maximum amount of per-object lights.
int vertexLights = (m_Asset.SupportsVertexLight) ? kMaxPerObjectAdditionalLights + 1 - maxPixelLights : 0;
lightData.pixelAdditionalLightsCount = Math.Max(0, maxPixelLights - 1);
lightData.totalAdditionalLightsCount = lightData.pixelAdditionalLightsCount + vertexLights;
// If we have a main light we don't shade it in the per-object light loop. We also remove it from the per-object cull list
int additionalLightsCount = (lightData.mainLightIndex > 0) ? visibleLightsCount - 1 : visibleLightsCount;
additionalLightsCount = Math.Min(additionalLightsCount, kMaxPerObjectAdditionalLights);
int pixelLightsCount = Math.Min(additionalLightsCount, m_Asset.MaxAdditionalPixelLights);
int vertexLightCount = (m_Asset.SupportsVertexLight) ? additionalLightsCount - pixelLightsCount : 0;
lightData.pixelAdditionalLightsCount = pixelLightsCount;
lightData.totalAdditionalLightsCount = pixelLightsCount + vertexLightCount;
}
private int SortLights(VisibleLight[] visibleLights)

正在加载...
取消
保存