project_teddy/scenes/alexi-village.tscn

162 lines
6.4 KiB
Text

[gd_scene load_steps=14 format=3 uid="uid://3ai8eha0vqcs"]
[ext_resource type="PackedScene" uid="uid://c6fjxgsvo1ywl" path="res://scenes/alexi-village-map.tscn" id="1_kyhnp"]
[ext_resource type="PackedScene" uid="uid://ytbacsuahxie" path="res://scenes/HUD.tscn" id="1_o0eha"]
[ext_resource type="Script" path="res://scripts/maps/alexi-village.gd" id="1_rq7l4"]
[ext_resource type="PackedScene" uid="uid://buyvavyuwmccw" path="res://joystick/virtual_joystick.tscn" id="3_j88gu"]
[sub_resource type="Shader" id="Shader_cg7kc"]
code = "
// NOTE: Shader automatically converted from Godot Engine 4.2.1.stable's ProceduralSkyMaterial.
shader_type sky;
render_mode use_debanding;
uniform vec4 sky_top_color : source_color = vec4(0.385, 0.454, 0.55, 1.0);
uniform vec4 sky_horizon_color : source_color = vec4(0.646, 0.656, 0.67, 1.0);
uniform float sky_curve : hint_range(0, 1) = 0.15;
uniform float sky_energy = 1.0; // In Lux.
uniform sampler2D sky_cover : filter_linear, source_color, hint_default_black;
uniform vec4 sky_cover_modulate : source_color = vec4(1.0, 1.0, 1.0, 1.0);
uniform vec4 ground_bottom_color : source_color = vec4(0.2, 0.169, 0.133, 1.0);
uniform vec4 ground_horizon_color : source_color = vec4(0.646, 0.656, 0.67, 1.0);
uniform float ground_curve : hint_range(0, 1) = 0.02;
uniform float ground_energy = 1.0;
uniform float sun_angle_max = 30.0;
uniform float sun_curve : hint_range(0, 1) = 0.15;
uniform sampler2D cloud_texture;
uniform sampler2D cloud_texture2;
uniform vec2 cloud_direction;
uniform vec2 cloud_direction2;
uniform vec2 cloud_scale;
uniform float cloud_distance;
uniform float cloud_speed;
uniform float cloud_speed2;
void sky() {
float v_angle = acos(clamp(EYEDIR.y, -1.0, 1.0));
float c = (1.0 - v_angle / (PI * 0.5));
vec3 sky = mix(sky_horizon_color.rgb, sky_top_color.rgb, clamp(1.0 - pow(1.0 - c, 1.0 / sky_curve), 0.0, 1.0));
sky *= sky_energy;
if (LIGHT0_ENABLED) {
float sun_angle = acos(dot(LIGHT0_DIRECTION, EYEDIR));
if (sun_angle < LIGHT0_SIZE) {
sky = LIGHT0_COLOR * LIGHT0_ENERGY;
} else if (sun_angle < sun_angle_max) {
float c2 = (sun_angle - LIGHT0_SIZE) / (sun_angle_max - LIGHT0_SIZE);
sky = mix(LIGHT0_COLOR * LIGHT0_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));
}
}
if (LIGHT1_ENABLED) {
float sun_angle = acos(dot(LIGHT1_DIRECTION, EYEDIR));
if (sun_angle < LIGHT1_SIZE) {
sky = LIGHT1_COLOR * LIGHT1_ENERGY;
} else if (sun_angle < sun_angle_max) {
float c2 = (sun_angle - LIGHT1_SIZE) / (sun_angle_max - LIGHT1_SIZE);
sky = mix(LIGHT1_COLOR * LIGHT1_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));
}
}
if (LIGHT2_ENABLED) {
float sun_angle = acos(dot(LIGHT2_DIRECTION, EYEDIR));
if (sun_angle < LIGHT2_SIZE) {
sky = LIGHT2_COLOR * LIGHT2_ENERGY;
} else if (sun_angle < sun_angle_max) {
float c2 = (sun_angle - LIGHT2_SIZE) / (sun_angle_max - LIGHT2_SIZE);
sky = mix(LIGHT2_COLOR * LIGHT2_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));
}
}
if (LIGHT3_ENABLED) {
float sun_angle = acos(dot(LIGHT3_DIRECTION, EYEDIR));
if (sun_angle < LIGHT3_SIZE) {
sky = LIGHT3_COLOR * LIGHT3_ENERGY;
} else if (sun_angle < sun_angle_max) {
float c2 = (sun_angle - LIGHT3_SIZE) / (sun_angle_max - LIGHT3_SIZE);
sky = mix(LIGHT3_COLOR * LIGHT3_ENERGY, sky, clamp(1.0 - pow(1.0 - c2, 1.0 / sun_curve), 0.0, 1.0));
}
}
vec4 sky_cover_texture = texture(sky_cover, SKY_COORDS);
sky += (sky_cover_texture.rgb * sky_cover_modulate.rgb) * sky_cover_texture.a * sky_cover_modulate.a * sky_energy;
c = (v_angle - (PI * 0.5)) / (PI * 0.5);
vec3 ground = mix(ground_horizon_color.rgb, ground_bottom_color.rgb, clamp(1.0 - pow(1.0 - c, 1.0 / ground_curve), 0.0, 1.0));
ground *= ground_energy;
vec2 sky_uv = EYEDIR.xz / EYEDIR.y;
vec3 clouds = texture(cloud_texture, sky_uv * cloud_scale + TIME * cloud_direction * cloud_speed).rgb - texture(cloud_texture2, sky_uv * cloud_scale + TIME * cloud_direction2 * cloud_speed2).rgb;
clouds = clouds - smoothstep(0.0, EYEDIR.y, cloud_distance);
clouds = clamp(clouds,0,1);
sky += clouds;
COLOR = mix(ground, sky, step(0.0, EYEDIR.y));
}
"
[sub_resource type="FastNoiseLite" id="FastNoiseLite_6glal"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_ovvby"]
width = 1024
height = 1024
seamless = true
noise = SubResource("FastNoiseLite_6glal")
[sub_resource type="Gradient" id="Gradient_3hqdm"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_1uff7"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_krh1g"]
width = 1024
height = 1024
seamless = true
color_ramp = SubResource("Gradient_3hqdm")
noise = SubResource("FastNoiseLite_1uff7")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_v3oi0"]
shader = SubResource("Shader_cg7kc")
shader_parameter/sky_top_color = Color(0.333333, 0.733333, 0.862745, 1)
shader_parameter/sky_horizon_color = Color(0.556863, 0.8, 0.862745, 1)
shader_parameter/sky_curve = 0.15
shader_parameter/sky_energy = 1.0
shader_parameter/sky_cover_modulate = Color(1, 1, 1, 1)
shader_parameter/ground_bottom_color = Color(1, 1, 1, 1)
shader_parameter/ground_horizon_color = Color(0.701961, 0.819608, 0.866667, 1)
shader_parameter/ground_curve = 0.02
shader_parameter/ground_energy = 1.0
shader_parameter/sun_angle_max = 0.523599
shader_parameter/sun_curve = 0.15
shader_parameter/cloud_direction = Vector2(-1, 1)
shader_parameter/cloud_direction2 = Vector2(1, -1)
shader_parameter/cloud_scale = Vector2(0.05, 0.05)
shader_parameter/cloud_distance = -0.025
shader_parameter/cloud_speed = 0.005
shader_parameter/cloud_speed2 = 0.004
shader_parameter/cloud_texture = SubResource("NoiseTexture2D_ovvby")
shader_parameter/cloud_texture2 = SubResource("NoiseTexture2D_krh1g")
[sub_resource type="Sky" id="Sky_1kp45"]
sky_material = SubResource("ShaderMaterial_v3oi0")
[sub_resource type="Environment" id="Environment_3dnl2"]
background_mode = 2
sky = SubResource("Sky_1kp45")
[node name="Alexi-village" type="Node3D"]
script = ExtResource("1_rq7l4")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_3dnl2")
[node name="HUD" parent="." instance=ExtResource("1_o0eha")]
[node name="village" parent="." instance=ExtResource("1_kyhnp")]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.0034906, -0.94887, 0.315647, 0, 0.315649, 0.948876, -0.999994, 0.00331215, -0.00110181, 0, 0, 0)
shadow_enabled = true
[node name="Virtual joystick" parent="." instance=ExtResource("3_j88gu")]