mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Sprite and figure attenuation
This commit is contained in:
parent
b3bf06b07d
commit
d2d4ca33c9
@ -191,6 +191,18 @@ void main() {
|
||||
// emitted_light *= point_shadow;
|
||||
// max_light *= point_shadow;
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_SHINY)
|
||||
// Attenuate sunlight
|
||||
if (medium.x == 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)));
|
||||
emitted_light *= attenuate;
|
||||
reflected_light *= attenuate;
|
||||
}
|
||||
#endif
|
||||
|
||||
max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||
|
||||
float ao = f_ao * sqrt(f_ao);//0.25 + f_ao * 0.75; ///*pow(f_ao, 0.5)*/f_ao * 0.85 + 0.15;
|
||||
|
@ -82,6 +82,21 @@ void main() {
|
||||
float max_light = 0.0;
|
||||
max_light += get_sun_diffuse2(sun_info, moon_info, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||
|
||||
emitted_light *= sun_info.block;
|
||||
reflected_light *= sun_info.block;
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_SHINY)
|
||||
// Attenuate sunlight
|
||||
if (medium.x == 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)));
|
||||
emitted_light *= attenuate;
|
||||
reflected_light *= attenuate;
|
||||
}
|
||||
#endif
|
||||
|
||||
max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||
|
||||
vec3 glow = pow(f_inst_light.y, 3) * 4 * glow_light(f_pos);
|
||||
|
Loading…
Reference in New Issue
Block a user