You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our image-based lighting codes do not normalize the view vector, leading to (slightly) incorrect lighting calculations.
For example, in ImageBasedLightingStageFS,
vec3 proceduralIBL(...)
{
vec3 v =-positionEC;
vec3 n = normalEC;
vec3 r =normalize(czm_inverseViewRotation *normalize(reflect(v, n)));
float NdotV =abs(dot(n, v)) +0.001;
NdotV should represent the cosine of the angle between normal and view vectors. But with v being unnormalized, NdotV can potentially be greater than 1 at normal incidence, and too large at angles between 0 and 90°.
The first line should read as follows:
vec3 v =-normalize(positionEC);
There is a similar problem in the textureIBL function.
Here are a few images showing the impact of the error, as noticed while working on #11988.
Default environmental lighting (textureIBL), current code:
Default environmental lighting, corrected code. Note the additional light at the edges of the spheres in the right column, as well as a slightly more linear trend in brightness from left to right.
Procedural lighting (proceduralIBL), current code:
Procedural lighting, corrected code. Note the more linear trend in brightness from left to right.
Our image-based lighting codes do not normalize the view vector, leading to (slightly) incorrect lighting calculations.
For example, in
ImageBasedLightingStageFS
,NdotV
should represent the cosine of the angle between normal and view vectors. But withv
being unnormalized,NdotV
can potentially be greater than 1 at normal incidence, and too large at angles between 0 and 90°.The first line should read as follows:
There is a similar problem in the
textureIBL
function.Here are a few images showing the impact of the error, as noticed while working on #11988.
Default environmental lighting (
textureIBL
), current code:Default environmental lighting, corrected code. Note the additional light at the edges of the spheres in the right column, as well as a slightly more linear trend in brightness from left to right.
Procedural lighting (
proceduralIBL
), current code:Procedural lighting, corrected code. Note the more linear trend in brightness from left to right.
Local Sandcastle for testing
The text was updated successfully, but these errors were encountered: