浏览代码

Main light keyword must be set up before shadow gather

/main
John 7 年前
当前提交
354589c6
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 9
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

9
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


context.DrawRenderers(m_CullResults.visibleRenderers, ref opaqueDrawSettings, opaqueFilterSettings);
}
//NOTE: Currently shader keywords are set before the forward pass, so the collect pass is one frame behind the current keyword.
// Might be best to move keyword + constant setup before shadow collect?
private void ShadowCollectPass(ref ScriptableRenderContext context, List<VisibleLight> lights, ref LightData lightData)
{
if (m_Asset.AreShadowsEnabled() && lightData.mainLightIndex != -1)

SetupShadowReceiverConstants(cmd, lights[lightData.mainLightIndex]); //Reciever constants set up here in case of screen space shadows.
//NOTE: We need to set up certain constants + keywords in case of collecting shadows. Ideally a cleaner way than this.
SetupShadowReceiverConstants(cmd, lights[lightData.mainLightIndex]);
SetShaderKeywords(cmd, ref lightData, lights);
cmd.GetTemporaryRT(m_ScreenSpaceShadowMapRTID, m_CurrCamera.pixelWidth, m_CurrCamera.pixelHeight, 0, FilterMode.Bilinear, RenderTextureFormat.R8);
cmd.Blit(null, m_ScreenSpaceShadowMapRT, m_ScreenSpaceShadowsMaterial);

// Main light has an optimized shader path for main light. This will benefit games that only care about a single light.
// Lightweight pipeline also supports only a single shadow light, if available it will be the main light.
SetupMainLightConstants(cmd, lights, lightData.mainLightIndex);
if (lightData.shadowMapSampleType != LightShadows.None && !m_UseScreenSpaceShadows) //TODO: Nicer way to know about SSS.
if (lightData.shadowMapSampleType != LightShadows.None)
SetupShadowReceiverConstants(cmd, lights[lightData.mainLightIndex]);
SetupAdditionalListConstants(cmd, lights, ref lightData);

正在加载...
取消
保存