mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Passed light direction instead of light object into computeHazeColorKeyLightAttenuation
.
This commit is contained in:
parent
026b19d770
commit
c352d5fc23
2 changed files with 2 additions and 7 deletions
|
@ -121,10 +121,6 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
|
|||
color += ambientDiffuse;
|
||||
color += ambientSpecular;
|
||||
|
||||
// Directional
|
||||
// Get directional light (used by both directional light and haze attenuation)
|
||||
Light directionalLight = getLight();
|
||||
|
||||
vec3 directionalDiffuse;
|
||||
vec3 directionalSpecular;
|
||||
evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, fragEyeDir, fragNormal, roughness, metallic, fresnel, albedo, shadowAttenuation
|
||||
|
@ -137,7 +133,7 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
|
|||
|
||||
// Attenuate the light if haze effect selected
|
||||
if ((hazeParams.hazeMode & HAZE_MODE_IS_KEYLIGHT_ATTENUATED) == HAZE_MODE_IS_KEYLIGHT_ATTENUATED) {
|
||||
color = computeHazeColorKeyLightAttenuation(color, directionalLight, position);
|
||||
color = computeHazeColorKeyLightAttenuation(color, lightDirection, position);
|
||||
}
|
||||
|
||||
return color;
|
||||
|
|
|
@ -50,13 +50,12 @@ layout(std140) uniform hazeBuffer {
|
|||
//
|
||||
// General algorithm taken from http://www.iquilezles.org/www/articles/fog/fog.htm, with permission
|
||||
//
|
||||
vec3 computeHazeColorKeyLightAttenuation(vec3 color, Light directionalLight, vec3 worldFragPos) {
|
||||
vec3 computeHazeColorKeyLightAttenuation(vec3 color, vec3 lightDirection, vec3 worldFragPos) {
|
||||
// Directional light attenuation is simulated by assuming the light source is at a fixed height above the
|
||||
// fragment. This height is where the haze density is reduced by 95% from the haze at the fragment's height
|
||||
//
|
||||
// The distance is computed from the height and the directional light orientation
|
||||
// The distance is limited to height * 1,000, which gives an angle of ~0.057 degrees
|
||||
vec3 lightDirection = getLightDirection(directionalLight);
|
||||
|
||||
// Height at which haze density is reduced by 95% (default set to 2000.0 for safety ,this should never happen)
|
||||
float height_95p = 2000.0;
|
||||
|
|
Loading…
Reference in a new issue