mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Prevent double multiplication of Fresnel.
This commit is contained in:
@@ -95,10 +95,10 @@ int main()
|
|||||||
glm::vec3( 10.0f, -10.0f, 10.0f),
|
glm::vec3( 10.0f, -10.0f, 10.0f),
|
||||||
};
|
};
|
||||||
glm::vec3 lightColors[] = {
|
glm::vec3 lightColors[] = {
|
||||||
glm::vec3(5.0f, 5.0f, 5.0f),
|
glm::vec3(2.0f, 2.0f, 2.0f),
|
||||||
glm::vec3(5.0f, 5.0f, 5.0f),
|
glm::vec3(2.0f, 2.0f, 2.0f),
|
||||||
glm::vec3(5.0f, 5.0f, 5.0f),
|
glm::vec3(2.0f, 2.0f, 2.0f),
|
||||||
glm::vec3(5.0f, 5.0f, 5.0f)
|
glm::vec3(2.0f, 2.0f, 2.0f)
|
||||||
};
|
};
|
||||||
int nrRows = 7;
|
int nrRows = 7;
|
||||||
int nrColumns = 7;
|
int nrColumns = 7;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void main()
|
|||||||
float NdotL = max(dot(N, L), 0.0);
|
float NdotL = max(dot(N, L), 0.0);
|
||||||
|
|
||||||
// add to outgoing radiance Lo
|
// add to outgoing radiance Lo
|
||||||
Lo += (kD * albedo / PI + kS * brdf) * radiance * NdotL;
|
Lo += (kD * albedo / PI + brdf) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again
|
||||||
}
|
}
|
||||||
|
|
||||||
// ambient lighting (note that the next IBL tutorial will replace
|
// ambient lighting (note that the next IBL tutorial will replace
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void main()
|
|||||||
float NdotL = max(dot(N, L), 0.0);
|
float NdotL = max(dot(N, L), 0.0);
|
||||||
|
|
||||||
// add to outgoing radiance Lo
|
// add to outgoing radiance Lo
|
||||||
Lo += (kD * albedo / PI + kS * brdf) * radiance * NdotL;
|
Lo += (kD * albedo / PI + brdf) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again
|
||||||
}
|
}
|
||||||
|
|
||||||
// ambient lighting (note that the next IBL tutorial will replace
|
// ambient lighting (note that the next IBL tutorial will replace
|
||||||
|
|||||||
Reference in New Issue
Block a user