feat(environment): add painterly skies and living meadows

This commit is contained in:
Rijad Zuzo
2026-09-05 20:27:09 +02:00
parent 7899d36f03
commit ec16e2f2ca
71 changed files with 2280 additions and 213 deletions
+18 -19
View File
@@ -1,27 +1,26 @@
shader_type sky;
uniform vec3 sky_top_color : source_color = vec3(0.27, 0.57, 0.74);
uniform vec3 sky_horizon_color : source_color = vec3(0.79, 0.88, 0.82);
// Original painted panorama; no volume or per-frame sky pass.
uniform sampler2D painted_panorama : source_color, filter_linear_mipmap, repeat_enable;
uniform vec3 sky_top_color : source_color = vec3(0.12, 0.49, 0.69);
uniform vec3 sky_horizon_color : source_color = vec3(0.65, 0.84, 0.84);
uniform vec3 ground_bottom_color : source_color = vec3(0.12, 0.17, 0.12);
uniform vec3 ground_horizon_color : source_color = vec3(0.56, 0.69, 0.57);
uniform vec3 ground_horizon_color : source_color = vec3(0.65, 0.84, 0.84);
uniform float daylight : hint_range(0.0, 1.0) = 1.0;
float hash21(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
float noise(vec2 p) {
vec2 i = floor(p);
vec2 f = fract(p);
f = f * f * (3.0 - 2.0 * f);
return mix(mix(hash21(i), hash21(i + vec2(1.0, 0.0)), f.x), mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0)), f.x), f.y);
}
uniform float golden_hour : hint_range(0.0, 1.0) = 0.0;
void sky() {
float height = max(EYEDIR.y, 0.0);
vec3 sky_color = mix(sky_horizon_color, sky_top_color, pow(height, 0.48));
vec2 p = EYEDIR.xz / max(0.17, height) * 1.15;
float cloud = noise(p) * 0.65 + noise(p * 2.1 + 7.3) * 0.25 + noise(p * 4.3) * 0.10;
float mask = smoothstep(0.55, 0.64, cloud) * smoothstep(0.02, 0.20, height);
vec3 cloud_shadow = mix(vec3(0.08, 0.10, 0.19), vec3(0.70, 0.80, 0.80), daylight);
vec3 cloud_light = mix(vec3(0.15, 0.18, 0.29), vec3(1.0, 0.98, 0.87), daylight);
vec3 cloud_color = mix(cloud_shadow, cloud_light, smoothstep(0.61, 0.77, cloud));
sky_color = mix(sky_color, cloud_color, mask);
vec3 sky_gradient = mix(sky_horizon_color, sky_top_color, pow(height, 0.45));
// Art horizon is at 69% of the sheet. Remap only the upper hemisphere;
// the ground bounce uses the day/night palette and never paints terrain.
vec2 panorama_uv = vec2(fract(SKY_COORDS.x * 2.0 + 0.40), clamp((SKY_COORDS.y - 0.26) * 2.875, 0.0, 0.69));
vec3 painted = texture(painted_panorama, panorama_uv).rgb;
vec3 seam_color = (texture(painted_panorama, vec2(0.001, panorama_uv.y)).rgb + texture(painted_panorama, vec2(0.999, panorama_uv.y)).rgb) * 0.5;
painted = mix(seam_color, painted, smoothstep(0.0, 0.025, min(panorama_uv.x, 1.0 - panorama_uv.x)));
painted = mix(painted, painted * vec3(1.18, 0.79, 0.66), golden_hour * 0.50);
vec3 night_paint = painted * vec3(0.045, 0.07, 0.14) + sky_gradient * 0.12;
vec3 sky_color = mix(night_paint, painted, daylight);
// Dissolve the panorama edge into the haze at the actual horizon.
sky_color = mix(sky_gradient, sky_color, smoothstep(0.0, 0.075, height));
COLOR = EYEDIR.y >= 0.0 ? sky_color : mix(ground_horizon_color, ground_bottom_color, pow(-EYEDIR.y, 0.4));
}