浏览代码

Setup shadow reciever constants before gather pass.

/main
John 7 年前
当前提交
23c8824d
共有 2 个文件被更改,包括 8 次插入4 次删除
  1. 11
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 1
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandard.shader

11
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


{
DepthPass(ref context);
if(m_Asset.UsesScreenSpaceShadows) //NOTE: Should this be added to the FrameRenderingConfiguration?
ShadowCollectPass(ref context);
ShadowCollectPass(ref context, visibleLights, ref lightData);
}
ForwardPass(visibleLights, frameRenderingConfiguration, ref context, ref lightData, stereoEnabled);

return corners;
}
private void ShadowCollectPass(ref ScriptableRenderContext context)
private void ShadowCollectPass(ref ScriptableRenderContext context, List<VisibleLight> lights, ref LightData lightData)
//Reciever constants set up here in case of screen space shadows.
SetupShadowReceiverConstants(cmd, lights[lightData.mainLightIndex]);
cmd.SetGlobalVectorArray("_FrustumCorners", GetFarPlaneCorners());
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)
if (lightData.shadowMapSampleType != LightShadows.None && !m_Asset.UsesScreenSpaceShadows) //TODO: Nicer way to know about SSS.
SetupShadowReceiverConstants(cmd, lights[lightData.mainLightIndex]);
SetupAdditionalListConstants(cmd, lights, ref lightData);

1
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightStandard.shader


#pragma multi_compile _ _VERTEX_LIGHTS
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
#pragma multi_compile _ FOG_LINEAR FOG_EXP2
#pragma multi_compile _ _SCREEN_SPACE_SHADOWS //TODO: Move to Shadows.hlsl
// -------------------------------------
// Unity defined keywords

正在加载...
取消
保存