feat(environment): add painterly skies and living meadows
This commit is contained in:
@@ -10,8 +10,11 @@ uniform float gust_speed : hint_range(0.0, 1.0) = 0.12;
|
||||
uniform float gust_strength : hint_range(0.0, 0.8) = 0.35;
|
||||
uniform float flutter_strength : hint_range(0.0, 0.05) = 0.012;
|
||||
uniform float wind_phase : hint_range(0.0, 6.2832) = 0.0;
|
||||
uniform float wind_base_height = -1.2;
|
||||
uniform float wind_full_height = 1.2;
|
||||
uniform vec3 albedo : source_color = vec3(0.19, 0.38, 0.17);
|
||||
uniform float roughness : hint_range(0.0, 1.0) = 0.9;
|
||||
uniform float painted_vertex_weight : hint_range(0.0, 1.0) = 0.0;
|
||||
uniform vec3 contact_root = vec3(0.0);
|
||||
uniform float contact_strength = 0.0;
|
||||
uniform int interactor_count = 0;
|
||||
@@ -20,8 +23,7 @@ varying vec3 paint_position;
|
||||
|
||||
void vertex() {
|
||||
paint_position = VERTEX;
|
||||
float half_height = 1.2;
|
||||
float height_factor = clamp((VERTEX.y + half_height) / (half_height * 2.0), 0.0, 1.0);
|
||||
float height_factor = clamp((VERTEX.y - wind_base_height) / max(wind_full_height - wind_base_height, 0.01), 0.0, 1.0);
|
||||
height_factor = height_factor * height_factor;
|
||||
|
||||
vec2 direction = normalize(wind_direction);
|
||||
@@ -32,8 +34,10 @@ void vertex() {
|
||||
float bend = sin(TIME * wind_speed + world_phase) * wind_strength * gust;
|
||||
float flutter = sin(TIME * 1.7 + world_phase * 1.9 + VERTEX.y * 2.0) * flutter_strength;
|
||||
|
||||
VERTEX.xz += direction * bend * height_factor;
|
||||
VERTEX.xz += crosswind * flutter * height_factor;
|
||||
// Crown orientation varies, but all foliage follows the same world breeze.
|
||||
vec3 world_bend = vec3(direction.x, 0.0, direction.y) * bend;
|
||||
world_bend += vec3(crosswind.x, 0.0, crosswind.y) * flutter;
|
||||
VERTEX += (inverse(MODEL_MATRIX) * vec4(world_bend, 0.0)).xyz * height_factor;
|
||||
if (foliage_trails_enabled && contact_strength > 0.0) {
|
||||
// One bend for the whole bush, including fruit; its base remains planted.
|
||||
vec3 contact = sample_foliage_trail(contact_root);
|
||||
@@ -69,7 +73,10 @@ void vertex() {
|
||||
void fragment() {
|
||||
float patches = sin(paint_position.x * 6.0 + sin(paint_position.z * 7.0)) * sin(paint_position.y * 5.0);
|
||||
float top = smoothstep(-0.65, 0.8, paint_position.y);
|
||||
ALBEDO = albedo * mix(0.85, 1.17, top) * (1.0 + smoothstep(0.2, 0.4, patches) * 0.10);
|
||||
vec3 pigment = mix(vec3(1.0), COLOR.rgb, painted_vertex_weight);
|
||||
vec3 shade_tint = mix(vec3(0.77, 0.95, 1.01), vec3(1.10, 1.06, 0.87), top);
|
||||
ALBEDO = albedo * pigment * shade_tint * mix(0.91, 1.13, top);
|
||||
ALBEDO *= 1.0 + smoothstep(0.18, 0.65, patches) * 0.07;
|
||||
ROUGHNESS = roughness;
|
||||
SPECULAR = 0.0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user