浏览代码

Fixed multiple local shadows.

/main
Felipe Lira 6 年前
当前提交
cc538d3c
共有 2 个文件被更改,包括 5 次插入7 次删除
  1. 5
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 7
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Shadows.hlsl

5
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


m_MaxLocalLightsShadedPerPass = m_UseComputeBuffer ? kMaxVisibleLocalLights : kMaxNonIndexedLocalLights;
m_LocalLightIndices = new List<int>(m_MaxLocalLightsShadedPerPass);
m_ShadowPass = new LightweightShadowPass(m_Asset, m_MaxLocalLightsShadedPerPass);
m_ShadowPass = new LightweightShadowPass(m_Asset, kMaxVisibleLocalLights);
// Let engine know we have MSAA on for cases where we support MSAA backbuffer
if (QualitySettings.antiAliasing != m_Asset.MSAASampleCount)

{
if (visibleLights[i].lightType != LightType.Directional)
m_LocalLightIndices.Add(i);
if (m_LocalLightIndices.Count >= m_MaxLocalLightsShadedPerPass)
break;
}
// Clear to default all light constant data

7
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/Shadows.hlsl


CBUFFER_END
CBUFFER_START(_LocalShadowBuffer)
float4x4 _LocalWorldToShadowAtlas[4];
half _LocalShadowStrength[4];
float4x4 _LocalWorldToShadowAtlas[MAX_VISIBLE_LIGHTS];
half _LocalShadowStrength[MAX_VISIBLE_LIGHTS];
half4 _LocalShadowOffset0;
half4 _LocalShadowOffset1;
half4 _LocalShadowOffset2;

float4 shadowCoord = mul(_LocalWorldToShadowAtlas[lightIndex], float4(positionWS, 1.0));
ShadowSamplingData shadowSamplingData = GetLocalLightShadowSamplingData();
half shadowStrength = GetLocalLightShadowStrenth(lightIndex);
return SampleShadowmap(shadowCoord, TEXTURE2D_PARAM(_LocalShadowMapAtlas, sampler_LocalShadowMapAtlas), shadowSamplingData, shadowStrength);
half attenuation = SampleShadowmap(shadowCoord, TEXTURE2D_PARAM(_LocalShadowMapAtlas, sampler_LocalShadowMapAtlas), shadowSamplingData, shadowStrength);
return (shadowStrength > 0.0h) ? attenuation : 1.0h;
#endif
}
正在加载...
取消
保存