Use sun visibility for sunlight scattering (bug #7309)

macos_ci_fix
Alexei Kotov 7 months ago
parent 48c1c2cf08
commit e1cd5250af

@ -69,6 +69,7 @@
Bug #7284: "Your weapon has no effect." message doesn't always show when the player character attempts to attack
Bug #7298: Water ripples from projectiles sometimes are not spawned
Bug #7307: Alchemy "Magic Effect" search string does not match on tool tip for effects related to attributes
Bug #7309: Sunlight scattering is visible in inappropriate situations
Bug #7322: Shadows don't cover groundcover depending on the view angle and perspective with compute scene bounds = primitives
Bug #7413: Generated wilderness cells don't spawn fish
Bug #7415: Unbreakable lock discrepancies

@ -173,7 +173,7 @@ void main(void)
vec3 waterColor = WATER_COLOR * sunFade;
vec4 sunSpec = lcalcSpecular(0);
// alpha component is sun visibility; we want to start fading specularity when visibility is low
// alpha component is sun visibility; we want to start fading lighting effects when visibility is low
sunSpec.a = min(1.0, sunSpec.a / SUN_SPEC_FADING_THRESHOLD);
// artificial specularity to make rain ripples more noticeable
@ -202,7 +202,7 @@ void main(void)
float sunHeight = lVec.z;
vec3 scatterColour = mix(SCATTER_COLOUR*vec3(1.0,0.4,0.0), SCATTER_COLOUR, clamp(1.0-exp(-sunHeight*SUN_EXT), 0.0, 1.0));
vec3 lR = reflect(lVec, lNormal);
float lightScatter = clamp(dot(lVec,lNormal)*0.7+0.3, 0.0, 1.0) * clamp(dot(lR, vVec)*2.0-1.2, 0.0, 1.0) * SCATTER_AMOUNT * sunFade * clamp(1.0-exp(-sunHeight), 0.0, 1.0);
float lightScatter = clamp(dot(lVec,lNormal)*0.7+0.3, 0.0, 1.0) * clamp(dot(lR, vVec)*2.0-1.2, 0.0, 1.0) * SCATTER_AMOUNT * sunFade * sunSpec.a * clamp(1.0-exp(-sunHeight), 0.0, 1.0);
gl_FragData[0].xyz = mix(mix(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpec.rgb * sunSpec.a + rainSpecular;
gl_FragData[0].w = 1.0;

Loading…
Cancel
Save