Merge branch 'zesterer/graphics-fixes' into 'master'

Fixed internal water reflections and improved underwarper

See merge request veloren/veloren!3754
This commit is contained in:
Joshua Barretto 2023-01-13 17:30:04 +00:00
commit 47edca8740
2 changed files with 7 additions and 1 deletions

View File

@ -152,6 +152,12 @@ void main() {
vec3 surf_norm = vec3(mat.xyz) / 127.0 - 1.0;
vec3 refl_dir = reflect(dir, surf_norm);
// Don't reflect back into the surface by snapping the reflection to the *actual* (i.e: not normal-mapped) surface plane
if (dot(refl_dir, round(surf_norm)) <= 0.0) {
// TODO: This assumes that the surface is axis-aligned!
refl_dir = normalize(refl_dir.xyz * (1.0 - abs(round(surf_norm))));
}
vec4 clip = (all_mat * vec4(cam_pos.xyz + refl_dir, 1.0));
vec2 new_uv = (clip.xy / max(clip.w, 0)) * 0.5 * vec2(1, -1) + 0.5;

View File

@ -211,7 +211,7 @@ void main() {
vec2 sample_uv = uv;
#ifdef EXPERIMENTAL_UNDERWARPER
if (medium.x == MEDIUM_WATER) {
sample_uv += sin(uv.yx * 40 + tick.xx * 1.0) * 0.003;
sample_uv += sin(uv.yx * 60 + tick.xx * 3.0) * 0.003;
}
#endif