else if (influenceShapeType == ENVSHAPETYPE_BOX)
weight = InfluenceBoxWeight(lightData, bsdfData, positionWS, positionLS, dirLS);
// When we are rough, we tend to see outward shifting of the reflection when at the boundary of the projection volume
// Also it appear like more sharp. To avoid these artifact and at the same time get better match to reference we lerp to original unmodified reflection.
// Formula is empirical.
float iblMipLevel = PerceptualRoughnessToMipmapLevel(preLightData.iblPerceptualRoughness);
float sampleWeight = 1;
float3 texCoord = GetSampleEnvCoordinates(lightLoopContext, lightData.envIndex, R, iblMipLevel, sampleWeight);
//weight *= sampleWeight;
uint index = lightData.envIndex >> 1;
float2 positionNCD = ComputeNormalizedDeviceCoordinates(positionWS, _Env2DCaptureVP[index]);
//float2 positionNCD = ComputeNormalizedDeviceCoordinates(_Env2DCapturePositionWS[index] + R, _Env2DCaptureVP[index]);
texCoord = positionNCD.xyy;
float4 preLD = SampleEnv(lightLoopContext, lightData.envIndex, texCoord, iblMipLevel);
float4 preLD = SampleEnv(lightLoopContext, lightData.envIndex, R, iblMipLevel, sampleWeight);
weight *= sampleWeight;
// Smooth weighting
weight = Smoothstep01(weight);
envLighting *= Sq(1.0 - preLightData.coatIblF);
// Evaluate the Clear Coat color
texCoord = GetSampleEnvCoordinates(lightLoopContext, lightData.envIndex, coatR, 0.0, sampleWeight);
float4 preLD = SampleEnv(lightLoopContext, lightData.envIndex, texCoord, 0.0);
float4 preLD = SampleEnv(lightLoopContext, lightData.envIndex, coatR, 0.0, sampleWeight);
envLighting += preLightData.coatIblF * preLD.rgb;
// Can't attenuate diffuse lighting here, may try to apply something on bakeLighting in PostEvaluateBSDF