浏览代码

Perform branching on light type earlier

/main
Evgenii Golubev 8 年前
当前提交
f2bf0055
共有 2 个文件被更改,包括 21 次插入23 次删除
  1. 12
      Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePassLoop.hlsl
  2. 32
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.hlsl

12
Assets/ScriptableRenderLoop/HDRenderLoop/Lighting/SinglePass/SinglePassLoop.hlsl


{
float3 localDiffuseLighting, localSpecularLighting;
EvaluateBSDF_Area(context, V, positionWS, prelightData, _AreaLightList[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
if (_AreaLightList[i].lightType == GPULIGHTTYPE_LINE)
{
EvaluateBSDF_Line(context, V, positionWS, prelightData, _AreaLightList[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
}
else
{
EvaluateBSDF_Area(context, V, positionWS, prelightData, _AreaLightList[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
}
diffuseLighting += localDiffuseLighting;
specularLighting += localSpecularLighting;

32
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.hlsl


LightData lightData, BSDFData bsdfData,
out float3 diffuseLighting, out float3 specularLighting)
{
#ifdef LIT_DISPLAY_REFERENCE_AREA
IntegrateBSDFLineRef(V, positionWS, preLightData, lightData, bsdfData,
diffuseLighting, specularLighting);
#else
diffuseLighting = float3(0.0, 0.0, 0.0);
specularLighting = float3(0.0, 0.0, 0.0);

ltcValue *= lightData.specularScale;
specularLighting = fresnelTerm * lightData.color * ltcValue;
}
#endif
}
//-----------------------------------------------------------------------------

out float3 specularLighting)
{
#ifdef LIT_DISPLAY_REFERENCE_AREA
if (lightData.lightType == GPULIGHTTYPE_LINE)
{
IntegrateBSDFLineRef(V, positionWS, preLightData, lightData, bsdfData,
diffuseLighting, specularLighting);
}
else
{
IntegrateGGXAreaRef(V, positionWS, preLightData, lightData, bsdfData,
diffuseLighting, specularLighting);
}
#else
if (lightData.lightType == GPULIGHTTYPE_LINE)
{
EvaluateBSDF_Line(lightLoopContext, V, positionWS, preLightData, lightData, bsdfData,
diffuseLighting, specularLighting);
return;
}
IntegrateGGXAreaRef(V, positionWS, preLightData, lightData, bsdfData,
diffuseLighting, specularLighting);
#else
diffuseLighting = float3(0.0, 0.0, 0.0);
specularLighting = float3(0.0, 0.0, 0.0);
// TODO: This could be precomputed
float halfWidth = lightData.size.x * 0.5;
float halfHeight = lightData.size.y * 0.5;

float4x3 matL = float4x3(p0, p1, p2, p3);
float4x3 L = matL - float4x3(positionWS, positionWS, positionWS, positionWS);
diffuseLighting = float3(0.0, 0.0, 0.0);
specularLighting = float3(0.0, 0.0, 0.0);
// Pick the correct axis along which to expand the fade-out sphere into an ellipsoid.
float3 axisLS;

正在加载...
取消
保存