project_teddy/scenes/mainmenu-background.tscn

191 lines
7.7 KiB
Text

[gd_scene load_steps=15 format=3 uid="uid://8lhdy8kiejvt"]
[ext_resource type="Script" path="res://scripts/mainmenu-background.gd" id="1_nn4qs"]
[ext_resource type="PackedScene" uid="uid://b3l10agcjfgdx" path="res://characters/teddy/model_glb/teddy.glb" id="2_mie3v"]
[ext_resource type="PackedScene" uid="uid://cyiyctp6y3n3x" path="res://scenes/mainmenu.tscn" id="3_bj3gc"]
[ext_resource type="ArrayMesh" uid="uid://cfsnb4hd7rws7" path="res://characters/Mr. Brown/0_SFusion.obj" id="5_44sv4"]
[ext_resource type="PackedScene" uid="uid://cmrooias7kpru" path="res://scenes/islands-map.tscn" id="5_ep6fx"]
[sub_resource type="Shader" id="Shader_ayl4w"]
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_0f7so"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_11c3r"]
width = 1024
height = 1024
seamless = true
noise = SubResource("FastNoiseLite_0f7so")
[sub_resource type="Gradient" id="Gradient_q5ykc"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_qcsi3"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_lcj8k"]
width = 1024
height = 1024
seamless = true
color_ramp = SubResource("Gradient_q5ykc")
noise = SubResource("FastNoiseLite_qcsi3")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3n1o5"]
shader = SubResource("Shader_ayl4w")
shader_parameter/sky_top_color = Color(1, 0.490803, 0.574236, 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_11c3r")
shader_parameter/cloud_texture2 = SubResource("NoiseTexture2D_lcj8k")
[sub_resource type="Sky" id="Sky_3pmd7"]
sky_material = SubResource("ShaderMaterial_3n1o5")
[sub_resource type="Environment" id="Environment_f0wx0"]
background_mode = 2
sky = SubResource("Sky_3pmd7")
[node name="mainmenu-background" type="Node3D"]
script = ExtResource("1_nn4qs")
[node name="teddy2" parent="." instance=ExtResource("2_mie3v")]
transform = Transform3D(-0.213199, 0, -0.383958, 0, 0.439179, 0, 0.383958, 0, -0.213199, -3.89097, 7.54284, 53.0126)
[node name="teddy" parent="." instance=ExtResource("2_mie3v")]
transform = Transform3D(-0.213199, 0, -0.383958, 0, 0.439179, 0, 0.383958, 0, -0.213199, -1.31314, 7.5242, 47.2253)
[node name="mainmenu" parent="." instance=ExtResource("3_bj3gc")]
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(-0.550189, 0, -0.83504, 0, 1, 0, 0.83504, 0, -0.550189, -26.8376, 15.6553, 37.7756)
current = true
[node name="Brown" type="MeshInstance3D" parent="."]
transform = Transform3D(0.0225339, 0, 0.0023044, 0, 0.0226514, 0, -0.0023044, 0, 0.0225339, 35.5504, 19.536, 58.6725)
visible = false
mesh = ExtResource("5_44sv4")
[node name="islands" parent="." instance=ExtResource("5_ep6fx")]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.553392, -0.0290685, 0.832414, 0, 0.999391, 0.0348995, -0.832921, -0.0193131, 0.553054, 0, 0, 0)
light_color = Color(0.980392, 0.372549, 0.333333, 1)
shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_f0wx0")
[node name="eye_left" type="OmniLight3D" parent="."]
transform = Transform3D(0.198068, 0, 0.980188, 0, 1, 0, -0.980188, 0, 0.198068, 33.7271, 22.9874, 57.5761)
visible = false
light_color = Color(1, 0, 0, 1)
light_energy = 16.0
omni_range = 0.122
[node name="eye_right" type="OmniLight3D" parent="."]
transform = Transform3D(0.198068, 0, 0.980188, 0, 1, 0, -0.980188, 0, 0.198068, 33.62, 22.8856, 59.1944)
visible = false
light_color = Color(1, 0, 0, 1)
light_energy = 16.0
omni_range = 0.122