mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed rain drop normals and wind direction for sprites
This commit is contained in:
parent
20610bae23
commit
c12e6426fa
@ -153,9 +153,11 @@ void main() {
|
||||
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: Find a good way to know the *actual* surface normal, minus normal mapping
|
||||
vec3 flat_norm = vec3(0, 0, 1);//round(surf_norm);
|
||||
if (dot(refl_dir, flat_norm) <= 0.0) {
|
||||
// TODO: This assumes that the surface is axis-aligned!
|
||||
refl_dir = normalize(refl_dir.xyz * (1.0 - abs(round(surf_norm))));
|
||||
refl_dir = normalize(refl_dir.xyz * (1.0 - abs(flat_norm)));
|
||||
}
|
||||
|
||||
vec4 clip = (all_mat * vec4(cam_pos.xyz + refl_dir, 1.0));
|
||||
|
@ -80,11 +80,11 @@ float wind_wave(float off, float scaling, float speed, float strength) {
|
||||
|
||||
// TODO: Right now, the wind model is pretty simplistic. This means that there is frequently no wind at all, which
|
||||
// looks bad. For now, we add a lower bound on the wind speed to keep things looking nice.
|
||||
strength = max(strength, 3.0);
|
||||
aspeed = max(aspeed, 3.0);
|
||||
strength = max(strength, 6.0);
|
||||
aspeed = max(aspeed, 5.0);
|
||||
|
||||
return (sin(tick.x * 0.75 * scaling * floor(aspeed) + off) * (1.0 - fract(aspeed))
|
||||
+ sin(tick.x * 0.75 * scaling * ceil(aspeed) + off) * fract(aspeed)) * abs(strength) * 0.5;
|
||||
return (sin(tick.x * 0.35 * scaling * floor(aspeed) + off) * (1.0 - fract(aspeed))
|
||||
+ sin(tick.x * 0.35 * scaling * ceil(aspeed) + off) * fract(aspeed)) * abs(strength) * 0.25;
|
||||
//return sin(tick.x * 1.5 * scaling + off) + sin(tick.x * 0.35 * scaling + off);
|
||||
}
|
||||
|
||||
@ -161,13 +161,13 @@ void main() {
|
||||
|
||||
#ifndef EXPERIMENTAL_BAREMINIMUM
|
||||
// Wind sway effect
|
||||
f_pos.xy += (wind_vel * 0.1 + vec2(
|
||||
f_pos.xy += (wind_vel * 0.35 + vec2(
|
||||
wind_wave(f_pos.y * 0.1, 0.9, wind_vel.x, wind_vel.y),
|
||||
wind_wave(f_pos.x * 0.1, 1.1, wind_vel.y, wind_vel.x)
|
||||
))
|
||||
* model_wind_sway
|
||||
//* mix(10.0, abs(v_pos.z), 1.0 / (1.0 + abs(v_pos.z) * 0.1))
|
||||
* v_pos.z
|
||||
* abs(v_pos.z)
|
||||
* model_z_scale
|
||||
* SCALE_FACTOR;
|
||||
|
||||
|
@ -281,7 +281,7 @@ void main() {
|
||||
vec3 off = vec3(hash_fast(uvec3(cell * 13)), hash_fast(uvec3(cell * 5)), 0);
|
||||
vec3 near_cell = (cell + 0.5 + (off - 0.5) * 0.5) / drop_density;
|
||||
|
||||
float dist = length((drop_pos - near_cell) / vec3(1, 1, 2));
|
||||
float dist = length((drop_pos - near_cell) * vec3(1, 1, 0.5));
|
||||
float drop_rad = 0.075 + puddle * 0.05;
|
||||
float distort = max(1.0 - abs(dist - drop_rad) * 100, 0) * 1.5 * max(drop_pos.z - near_cell.z, 0);
|
||||
k_a += distort;
|
||||
|
Loading…
Reference in New Issue
Block a user