mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed light extinction
This commit is contained in:
parent
212392a062
commit
b94d560a20
@ -195,11 +195,12 @@ void main() {
|
|||||||
// Attenuate sunlight
|
// Attenuate sunlight
|
||||||
if (medium.x == 1) {
|
if (medium.x == 1) {
|
||||||
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
|
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
|
||||||
vec3 cam_attenuation = compute_attenuation_point(cam_pos.xyz, view_dir, MU_WATER, fluid_alt, f_pos);
|
|
||||||
|
|
||||||
vec3 attenuate = pow(vec3(0.0, 0.98, 0.99), vec3(max(fluid_alt - cam_pos.z, 0)));
|
float water_dist = max(fluid_alt - f_pos.z, 0);
|
||||||
|
vec3 attenuate = pow(vec3(0.5, 0.98, 0.99), vec3(water_dist * 0.1));
|
||||||
emitted_light *= attenuate;
|
emitted_light *= attenuate;
|
||||||
reflected_light *= attenuate;
|
reflected_light *= attenuate;
|
||||||
|
surf_color *= attenuate;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ void main() {
|
|||||||
// Attenuate sunlight
|
// Attenuate sunlight
|
||||||
if (medium.x == 1) {
|
if (medium.x == 1) {
|
||||||
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
|
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
|
||||||
vec3 cam_attenuation = compute_attenuation_point(cam_pos.xyz, view_dir, MU_WATER, fluid_alt, f_pos);
|
|
||||||
|
|
||||||
vec3 attenuate = pow(vec3(0.0, 0.98, 0.99), vec3(max(fluid_alt - cam_pos.z, 0)));
|
float water_dist = max(fluid_alt - f_pos.z, 0);
|
||||||
|
vec3 attenuate = pow(vec3(0.5, 0.98, 0.99), vec3(water_dist * 0.1));
|
||||||
emitted_light *= attenuate;
|
emitted_light *= attenuate;
|
||||||
reflected_light *= attenuate;
|
reflected_light *= attenuate;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user