mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Made ice reflective
This commit is contained in:
parent
05863eb1ef
commit
83dc22dfbf
@ -128,7 +128,11 @@ void main() {
|
|||||||
// vec3 surf_norm = normalize(vec3(nz * 0.03 / (1.0 + dist * 0.1), 1));
|
// vec3 surf_norm = normalize(vec3(nz * 0.03 / (1.0 + dist * 0.1), 1));
|
||||||
// refr_dir = refract(dir, surf_norm * -sign(dir.z), 1.0 / n2);
|
// refr_dir = refract(dir, surf_norm * -sign(dir.z), 1.0 / n2);
|
||||||
// } else {
|
// } else {
|
||||||
refr_dir = normalize(dir + vec3(nz * 1.5 / dist, 0.0));
|
if (mat.a == MAT_FLUID) {
|
||||||
|
refr_dir = normalize(dir + vec3(nz * 1.5 / dist, 0.0));
|
||||||
|
} else {
|
||||||
|
refr_dir = dir;
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
vec4 clip = (all_mat * vec4(cam_pos.xyz + refr_dir, 1.0));
|
vec4 clip = (all_mat * vec4(cam_pos.xyz + refr_dir, 1.0));
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
#define BLOCK_SNOW 0x21
|
#define BLOCK_SNOW 0x21
|
||||||
#define BLOCK_ART_SNOW 0x22
|
#define BLOCK_ART_SNOW 0x22
|
||||||
|
#define BLOCK_ICE 0x43
|
||||||
|
|
||||||
// An arbitrary value that represents a very far distance (at least as far as the player should be able to see) without
|
// An arbitrary value that represents a very far distance (at least as far as the player should be able to see) without
|
||||||
// being too far that we end up with precision issues (used in clouds and elsewhere).
|
// being too far that we end up with precision issues (used in clouds and elsewhere).
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#version 420 core
|
#version 430 core
|
||||||
|
|
||||||
#define FIGURE_SHADER
|
#define FIGURE_SHADER
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#version 420 core
|
#version 430 core
|
||||||
|
|
||||||
#include <constants.glsl>
|
#include <constants.glsl>
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ void main() {
|
|||||||
uint f_kind;
|
uint f_kind;
|
||||||
vec3 f_col = greedy_extract_col_light_kind_terrain(t_col_light, s_col_light, t_kind, f_uv_pos, f_light, f_glow, f_ao, f_sky_exposure, f_kind);
|
vec3 f_col = greedy_extract_col_light_kind_terrain(t_col_light, s_col_light, t_kind, f_uv_pos, f_light, f_glow, f_ao, f_sky_exposure, f_kind);
|
||||||
|
|
||||||
|
uint f_mat = MAT_BLOCK;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_BAREMINIMUM
|
#ifdef EXPERIMENTAL_BAREMINIMUM
|
||||||
tgt_color = vec4(simple_lighting(f_pos.xyz, f_col, f_light), 1);
|
tgt_color = vec4(simple_lighting(f_pos.xyz, f_col, f_light), 1);
|
||||||
return;
|
return;
|
||||||
@ -280,6 +282,7 @@ void main() {
|
|||||||
alpha = mix(1.0, 0.2, puddle);
|
alpha = mix(1.0, 0.2, puddle);
|
||||||
f_col.rgb *= mix(1.0, 0.7, puddle);
|
f_col.rgb *= mix(1.0, 0.7, puddle);
|
||||||
k_s = mix(k_s, vec3(0.7, 0.7, 1.0), puddle);
|
k_s = mix(k_s, vec3(0.7, 0.7, 1.0), puddle);
|
||||||
|
f_mat = MAT_FLUID;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -306,6 +309,12 @@ void main() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Reflections on ice
|
||||||
|
if (f_kind == BLOCK_ICE && f_norm.z == 1.0) {
|
||||||
|
f_alpha = min(f_alpha, 0.3);
|
||||||
|
k_s = mix(k_s, vec3(0.7, 0.7, 1.0), 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
// float sun_light = get_sun_brightness(sun_dir);
|
// float sun_light = get_sun_brightness(sun_dir);
|
||||||
// float moon_light = get_moon_brightness(moon_dir);
|
// float moon_light = get_moon_brightness(moon_dir);
|
||||||
/* float sun_shade_frac = horizon_at(f_pos, sun_dir);
|
/* float sun_shade_frac = horizon_at(f_pos, sun_dir);
|
||||||
@ -559,6 +568,6 @@ void main() {
|
|||||||
surf_color += f_select * (surf_color + 0.1) * vec3(0.5, 0.5, 0.5);
|
surf_color += f_select * (surf_color + 0.1) * vec3(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
tgt_color = vec4(surf_color, f_alpha);
|
tgt_color = vec4(surf_color, f_alpha);
|
||||||
tgt_mat = uvec4(uvec3((f_norm + 1.0) * 127.0), MAT_BLOCK);
|
tgt_mat = uvec4(uvec3((f_norm + 1.0) * 127.0), f_mat);
|
||||||
//tgt_color = vec4(f_norm, f_alpha);
|
//tgt_color = vec4(f_norm, f_alpha);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user