add snow coverage to tea material
This commit is contained in:
@@ -135,7 +135,7 @@ func _apply_dynamic_environment_materials(node: Node) -> void:
|
||||
if node.is_in_group("weather_node"):
|
||||
_apply_weather_overlay_to_node(node, WEATHER_SHADER)
|
||||
|
||||
if node.is_in_group("weather_vegetables_node"):
|
||||
if _should_clear_weather_overlay(node):
|
||||
_clear_weather_overlay_from_node(node)
|
||||
|
||||
func ApplyWindNoiseToMaterials():
|
||||
@@ -162,10 +162,11 @@ func ApplyWeatherShaderToMaterials():
|
||||
_apply_weather_overlay_to_node(node, WEATHER_SHADER)
|
||||
|
||||
for node in get_tree().get_nodes_in_group("weather_vegetables_node"):
|
||||
_clear_weather_overlay_from_node(node)
|
||||
if _should_clear_weather_overlay(node):
|
||||
_clear_weather_overlay_from_node(node)
|
||||
|
||||
func _apply_weather_overlay_to_node(node: Node, material: Material) -> void:
|
||||
if node.is_in_group("weather_vegetables_node"):
|
||||
if _should_clear_weather_overlay(node):
|
||||
_clear_weather_overlay_from_node(node)
|
||||
return
|
||||
|
||||
@@ -210,6 +211,9 @@ func _shader_material_uses_alpha_texture(material: ShaderMaterial) -> bool:
|
||||
|
||||
return material.shader.code.find("alpha_texture") != -1
|
||||
|
||||
func _should_clear_weather_overlay(node: Node) -> bool:
|
||||
return node.is_in_group("weather_vegetables_node")
|
||||
|
||||
func select_day_time(normalized_time: float) -> void:
|
||||
#set show_day_time_debug = true to show debug on screen
|
||||
#normalized_time is a value between 0 and 1; the time of the day is calculate as "normalized_time" * 1440; day_time is the step to pass from sunrise, to day, to sunset, to night
|
||||
|
||||
@@ -33,7 +33,8 @@ uniform vec4 variance_color : source_color = vec4(0.3, 0.5, 0.2, 1.0); // Colore
|
||||
uniform float variance_intensity : hint_range(0.0, 1.0) = 0.4; // Quanto si vedono le chiazze
|
||||
|
||||
uniform vec4 snow_color : source_color = vec4(0.85, 0.9, 0.95, 1.0);
|
||||
uniform float snow_visibility : hint_range(0.0, 1.0) = 1.0;
|
||||
uniform float snow_visibility : hint_range(0.0, 3.0) = 1.0;
|
||||
uniform float snow_coverage : hint_range(0.05, 1.0) = 0.35;
|
||||
|
||||
// --- CONTROLLO GRADIENTE E RANDOM ---
|
||||
uniform float height_min = 0.0;
|
||||
@@ -135,8 +136,10 @@ void fragment() {
|
||||
float snow_amount = smoothstep(0.0, 1.0, get_snow_progress());
|
||||
|
||||
float top_mask = 1.0 - shifted_uv.y;
|
||||
float snow_mask = smoothstep(0.65, 1.0, top_mask) * snow_amount * snow_visibility;
|
||||
float snow_start = 1.0 - clamp(snow_coverage, 0.05, 1.0);
|
||||
float snow_mask = smoothstep(snow_start, 1.0, top_mask) * snow_amount * snow_visibility;
|
||||
snow_mask *= step(0.01, snow_amount);
|
||||
snow_mask = clamp(snow_mask, 0.0, 1.0);
|
||||
|
||||
vec3 dark_snow = snow_color.rgb * (1.0 - shadow_intensity);
|
||||
vec3 shaded_snow = mix(dark_snow, snow_color.rgb, v_shade_factor);
|
||||
|
||||
Reference in New Issue
Block a user