Also interpolate light energy depending on daytime
This commit is contained in:
parent
ab455bdd67
commit
879839d36d
@ -58,16 +58,24 @@ func _light_rotation():
|
|||||||
|
|
||||||
#set light color depending on daytime
|
#set light color depending on daytime
|
||||||
func _sky_light():
|
func _sky_light():
|
||||||
|
var new_light_energy = 0.0
|
||||||
|
|
||||||
if _degree <= SUNRISE_DEGREE:
|
if _degree <= SUNRISE_DEGREE:
|
||||||
#_worldEnvironment.environment.background_sky.sky_curve = 1
|
#_worldEnvironment.environment.background_sky.sky_curve = 1
|
||||||
_setSkyColor = SUNRISE
|
_setSkyColor = SUNRISE
|
||||||
elif _degree > SUNRISE_DEGREE and _degree < RISE_INTERPOL: #interpolate colors from sunrise sky to daytime sky
|
elif _degree > SUNRISE_DEGREE and _degree < RISE_INTERPOL: #interpolate colors from sunrise sky to daytime sky
|
||||||
_setSkyColor = SUNRISE.linear_interpolate(STANDARD_SKY_TOP, ((_degree-SUNRISE_DEGREE)/(RISE_INTERPOL-SUNRISE_DEGREE)))
|
_setSkyColor = SUNRISE.linear_interpolate(STANDARD_SKY_TOP, ((_degree-SUNRISE_DEGREE)/(RISE_INTERPOL-SUNRISE_DEGREE)))
|
||||||
|
new_light_energy = inverse_lerp(SUNRISE_DEGREE, RISE_INTERPOL, _degree)
|
||||||
elif _degree >= RISE_INTERPOL and _degree <= SET_INTERPOL:
|
elif _degree >= RISE_INTERPOL and _degree <= SET_INTERPOL:
|
||||||
#_worldEnvironment.environment.background_sky.sky_curve = 0.09
|
#_worldEnvironment.environment.background_sky.sky_curve = 0.09
|
||||||
_setSkyColor = STANDARD_SKY_TOP
|
_setSkyColor = STANDARD_SKY_TOP
|
||||||
|
new_light_energy = 1.0
|
||||||
elif _degree > SET_INTERPOL and _degree < SUNSET_DEGREE: #interpolate colors from daytime sky to sunset sky
|
elif _degree > SET_INTERPOL and _degree < SUNSET_DEGREE: #interpolate colors from daytime sky to sunset sky
|
||||||
_setSkyColor = STANDARD_SKY_TOP.linear_interpolate(SUNSET, ((_degree-SET_INTERPOL)/(SUNSET_DEGREE-SET_INTERPOL)))
|
_setSkyColor = STANDARD_SKY_TOP.linear_interpolate(SUNSET, ((_degree-SET_INTERPOL)/(SUNSET_DEGREE-SET_INTERPOL)))
|
||||||
|
new_light_energy = 1.0 - inverse_lerp(SET_INTERPOL, SUNSET_DEGREE, _degree)
|
||||||
elif _degree >= SUNSET_DEGREE:
|
elif _degree >= SUNSET_DEGREE:
|
||||||
_setSkyColor = SUNSET
|
_setSkyColor = SUNSET
|
||||||
|
|
||||||
_worldEnvironment.environment.background_sky.sky_horizon_color = _setSkyColor
|
_worldEnvironment.environment.background_sky.sky_horizon_color = _setSkyColor
|
||||||
|
_light.light_energy = new_light_energy
|
||||||
|
_worldEnvironment.environment.ambient_light_energy = 0.2 + 0.3 * new_light_energy
|
Loading…
x
Reference in New Issue
Block a user