Better LoD smoothing

This commit is contained in:
Joshua Barretto 2020-02-21 14:27:43 +00:00
parent 2400786c13
commit b9b0674462

View File

@ -8,7 +8,7 @@ vec2 pos_to_uv(vec2 pos) {
} }
float alt_at(vec2 pos) { float alt_at(vec2 pos) {
return texture(t_map, pos_to_uv(pos)).a * (1500.0); return texture(t_map, pos_to_uv(pos)).a * (1450.0);
return 0.0 return 0.0
+ pow(texture(t_noise, pos * 0.00005).x * 1.4, 3.0) * 1000.0 + pow(texture(t_noise, pos * 0.00005).x * 1.4, 3.0) * 1000.0
@ -21,18 +21,19 @@ vec2 splay(vec2 pos, float e) {
} }
float splay_scale(vec2 pos, float e) { float splay_scale(vec2 pos, float e) {
return distance(splay(pos, e), splay(pos + 0.001, e)) * 500000.0; return distance(splay(pos, e), splay(pos + 0.001, e)) * 5000000.0;
} }
vec3 lod_pos(vec2 v_pos) { vec3 lod_pos(vec2 v_pos) {
vec2 hpos = focus_pos.xy + splay(v_pos, 5.0) * 1000000.0; vec2 hpos = focus_pos.xy + splay(v_pos, 5.0) * 1000000.0;
float splay = splay_scale(v_pos, 5.0); float splay = splay_scale(v_pos, 5.0);
return vec3(hpos, ( return vec3(hpos, (
alt_at(hpos) +
alt_at(hpos + vec2(-1, 1) * splay) + alt_at(hpos + vec2(-1, 1) * splay) +
alt_at(hpos + vec2(1, 1) * splay) + alt_at(hpos + vec2(1, 1) * splay) +
alt_at(hpos + vec2(1, -1) * splay) + alt_at(hpos + vec2(1, -1) * splay) +
alt_at(hpos + vec2(-1, -1) * splay) alt_at(hpos + vec2(-1, -1) * splay)
) / 4.0); ) / 5.0);
} }
vec3 lod_norm(vec2 pos) { vec3 lod_norm(vec2 pos) {
@ -50,6 +51,7 @@ vec3 lod_norm(vec2 pos) {
vec3 lod_col(vec2 pos) { vec3 lod_col(vec2 pos) {
return texture(t_map, pos_to_uv(pos)).rgb; return texture(t_map, pos_to_uv(pos)).rgb;
//+ texture(t_noise, pos * 0.02 + texture(t_noise, pos * 1.0).xy * 2.0).x * 0.2;
vec3 warmth = mix( vec3 warmth = mix(
vec3(0.05, 0.4, 0.1), vec3(0.05, 0.4, 0.1),