diffuseLighting = float4(0.0, 0.0, 0.0, 0.0);
specularLighting = float4(0.0, 0.0, 0.0, 0.0);
for (int i = 0; i < _PunctualLightCount; ++i)
int i = 0; // Declare once to avoid the D3D11 compiler warning.
for (i = 0; i < _PunctualLightCount; ++i)
float4 localDiffuseLighting;
float4 localSpecularLighting;
EvaluateBSDF_Punctual(context, V, positionWS, prelightData, _PunctualLightList[i], bsdfData, localDiffuseLighting, localSpecularLighting);
diffuseLighting += localDiffuseLighting;
float4 localDiffuseLighting, localSpecularLighting;
EvaluateBSDF_Punctual(context, V, positionWS, prelightData, _PunctualLightList[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
diffuseLighting += localDiffuseLighting;
for (int i = 0; i < _AreaLightCount; ++i)
for (i = 0; i < _AreaLightCount; ++i)
EvaluateBSDF_Area(context, V, positionWS, prelightData, _AreaLightList[i], bsdfData, localDiffuseLighting, localSpecularLighting);
EvaluateBSDF_Area(context, V, positionWS, prelightData, _AreaLightList[i], bsdfData,
localDiffuseLighting, localSpecularLighting);
diffuseLighting += localDiffuseLighting;
specularLighting += localSpecularLighting;
float4 iblSpecularLighting = float4(0.0, 0.0, 0.0, 0.0);
for (int j = 0; j < _EnvLightCount; ++j)
for (i = 0; i < _EnvLightCount; ++i)
float4 localDiffuseLighting;
float4 localSpecularLighting;
float4 localDiffuseLighting, localSpecularLighting;
EvaluateBSDF_Env(context, V, positionWS, prelightData, _EnvLightList[j], bsdfData, localDiffuseLighting, localSpecularLighting);
EvaluateBSDF_Env(context, V, positionWS, prelightData, _EnvLightList[i], bsdfData, localDiffuseLighting, localSpecularLighting);
iblDiffuseLighting.rgb = lerp(iblDiffuseLighting.rgb, localDiffuseLighting.rgb, localDiffuseLighting.a); // Should be remove by the compiler if it is smart as all is constant 0
iblSpecularLighting.rgb = lerp(iblSpecularLighting.rgb, localSpecularLighting.rgb, localSpecularLighting.a);
}
{
float4 localDiffuseLighting;
float4 localSpecularLighting;
float4 localDiffuseLighting, localSpecularLighting;
context.sampleReflection = SINGLE_PASS_CONTEXT_SAMPLE_SKY;
EvaluateBSDF_Env(context, V, positionWS, prelightData, _EnvLightSky, bsdfData, localDiffuseLighting, localSpecularLighting);
iblDiffuseLighting.rgb = lerp(iblDiffuseLighting.rgb, localDiffuseLighting.rgb, localDiffuseLighting.a); // Should be remove by the compiler if it is smart as all is constant 0