feat(environment): add painterly skies and living meadows
This commit is contained in:
@@ -7,17 +7,17 @@ extends Node
|
||||
|
||||
const TO_RAD := PI / 180.0
|
||||
|
||||
const DAY_SKY_TOP := Color(0.27, 0.57, 0.74, 1)
|
||||
const DAY_SKY_HORIZON := Color(0.79, 0.88, 0.82, 1)
|
||||
const DAY_SKY_TOP := Color(0.12, 0.49, 0.69, 1)
|
||||
const DAY_SKY_HORIZON := Color(0.65, 0.84, 0.84, 1)
|
||||
const DAY_GROUND_BOTTOM := Color(0.12, 0.17, 0.12, 1)
|
||||
const DAY_GROUND_HORIZON := Color(0.56, 0.69, 0.57, 1)
|
||||
const DAY_AMBIENT := Color(0.72, 0.83, 0.88, 1)
|
||||
const DAY_AMBIENT_ENERGY := 0.55
|
||||
const DAY_FOG_LIGHT := Color(0.70, 0.83, 0.81, 1)
|
||||
const DAY_GROUND_HORIZON := DAY_SKY_HORIZON
|
||||
const DAY_AMBIENT := Color(0.65, 0.80, 0.87, 1)
|
||||
const DAY_AMBIENT_ENERGY := 0.65
|
||||
const DAY_FOG_LIGHT := Color(0.63, 0.80, 0.82, 1)
|
||||
const DAY_FOG_LIGHT_ENERGY := 0.8
|
||||
const DAY_FOG_DENSITY := 0.0015
|
||||
const DAY_FOG_DENSITY := 0.0018
|
||||
const DAY_LIGHT_COLOR := Color(1, 0.94, 0.79, 1)
|
||||
const DAY_LIGHT_ENERGY := 1.2
|
||||
const DAY_LIGHT_ENERGY := 1.35
|
||||
|
||||
const NIGHT_SKY_TOP := Color(0.04, 0.04, 0.12, 1)
|
||||
const NIGHT_SKY_HORIZON := Color(0.08, 0.06, 0.14, 1)
|
||||
@@ -76,8 +76,13 @@ func _process(delta: float) -> void:
|
||||
func _apply_light_rotation(cycle: float) -> void:
|
||||
if directional_light == null:
|
||||
return
|
||||
var angle_rad: float = cycle * 2.0 * PI
|
||||
directional_light.rotation = Vector3(-PI / 4.0 + sin(angle_rad) * PI / 4.0, angle_rad, 0)
|
||||
# The bright interval and the sun's arc share dawn/noon/dusk. The old
|
||||
# quarter-cycle offset put the brightest morning sun on the horizon.
|
||||
var solar_progress := clampf((cycle - 0.15) / 0.7, 0.0, 1.0)
|
||||
var elevation := 8.0 + sin(solar_progress * PI) * 52.0
|
||||
if cycle < 0.15 or cycle > 0.85:
|
||||
elevation = 32.0 # One cool moon fill during the night interval.
|
||||
directional_light.rotation = Vector3(-elevation * TO_RAD, cycle * TAU, 0)
|
||||
|
||||
|
||||
func _apply_environment(cycle: float) -> void:
|
||||
@@ -85,7 +90,6 @@ func _apply_environment(cycle: float) -> void:
|
||||
return
|
||||
|
||||
var day_factor := _day_factor(cycle)
|
||||
var night_factor := 1.0 - day_factor
|
||||
|
||||
directional_light.light_color = _lerp_color(NIGHT_LIGHT_COLOR, DAY_LIGHT_COLOR, day_factor)
|
||||
directional_light.light_energy = lerpf(NIGHT_LIGHT_ENERGY, DAY_LIGHT_ENERGY, day_factor)
|
||||
@@ -136,6 +140,7 @@ func _apply_environment(cycle: float) -> void:
|
||||
"ground_horizon_color", NIGHT_GROUND_HORIZON.lerp(DAY_GROUND_HORIZON, day_factor)
|
||||
)
|
||||
mat.set_shader_parameter("daylight", day_factor)
|
||||
mat.set_shader_parameter("golden_hour", transition_peak)
|
||||
|
||||
|
||||
func _find_simulation_node() -> void:
|
||||
@@ -155,10 +160,10 @@ func _day_factor(cycle: float) -> float:
|
||||
|
||||
|
||||
func _sunrise_sunset_weight(cycle: float) -> float:
|
||||
if cycle < 0.15:
|
||||
return smoothstep(0.05, 0.15, cycle) * (1.0 - smoothstep(0.1, 0.15, cycle))
|
||||
if cycle > 0.85:
|
||||
return smoothstep(0.85, 0.95, cycle) * (1.0 - smoothstep(0.9, 0.95, cycle))
|
||||
if cycle < 0.3:
|
||||
return smoothstep(0.15, 0.21, cycle) * (1.0 - smoothstep(0.23, 0.3, cycle))
|
||||
if cycle > 0.7:
|
||||
return smoothstep(0.7, 0.77, cycle) * (1.0 - smoothstep(0.79, 0.85, cycle))
|
||||
return 0.0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user