mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-16 05:20:06 +01:00
Add a 3D sky shaders demo (#809)
This uses https://github.com/Rytelier/godot-sky-and-volumetric-clouds as a base, with several changes made: - Spheres are now used to represent radiance map reflections of varying roughness and metallic values. - A day/night cycle is now featured. - Mipmaps are enabled on the weather texture as an optimization. - The default radiance map settings are more conservative to account for the real-time sky shader. - This makes reflections lower quality, but it's not too noticeable in most real world scenes (especially if using GI techniques for reflections). - Debanding is now applied in the project settings, rather than on the sky shader. This is significantly faster (over 0.1 ms saved on a RX 6900 XT in 3840×2160). It also has the benefit of working on materials, which can exhibit banding if not textured. - The sky shader has debanding commented out in case it's needed. This debanding also applies to the lower half of the sky as well in this case, as it was required to get rid of noticeable banding on the lower half. - Cloud coverage and density uniform hints now allow values as low as 0.001. Co-authored-by: Rytelier <45795134+Rytelier@users.noreply.github.com> Co-authored-by: Clay John <claynjohn@gmail.com>
This commit is contained in:
572
3d/sky_shaders/Main.tscn
Normal file
572
3d/sky_shaders/Main.tscn
Normal file
@@ -0,0 +1,572 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://w330ipq14vp4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cwxsditbkarya" path="res://main.gd" id="1_t20f6"]
|
||||
[ext_resource type="Shader" uid="uid://x1tpa10wfi7g" path="res://sky_volumetric_clouds.gdshader" id="2_7kao2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcf4fxk846cq4" path="res://weather.webp" id="2_wytgt"]
|
||||
[ext_resource type="CompressedTexture3D" uid="uid://48aujjq3b6pj" path="res://perlworlnoise.png" id="3_k3m6m"]
|
||||
[ext_resource type="CompressedTexture3D" uid="uid://bflk6wdrcm8kq" path="res://worlnoise.webp" id="4_ix4p0"]
|
||||
[ext_resource type="Script" uid="uid://dgprxredbdjd7" path="res://spheres.gd" id="5_00idb"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvpkajbs1yfug" path="res://space.webp" id="5_ua1c5"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qen42"]
|
||||
length = 0.001
|
||||
step = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("YawLight/DirectionalLight3D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(-0.6325349, 0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/space_emit_strength")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/mie")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.166]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/mie_color")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.921569, 0.54902, 0.568627, 1)]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/mie_eccentricity")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.701]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/rayleigh")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.467]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/rayleigh_color")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.26, 0.41, 0.58, 1)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/turbidity")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.797]
|
||||
}
|
||||
tracks/8/type = "value"
|
||||
tracks/8/imported = false
|
||||
tracks/8/enabled = true
|
||||
tracks/8/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/exposure")
|
||||
tracks/8/interp = 1
|
||||
tracks/8/loop_wrap = true
|
||||
tracks/8/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.1]
|
||||
}
|
||||
tracks/9/type = "value"
|
||||
tracks/9/imported = false
|
||||
tracks/9/enabled = true
|
||||
tracks/9/path = NodePath("YawLight/DirectionalLight3D:light_energy")
|
||||
tracks/9/interp = 1
|
||||
tracks/9/loop_wrap = true
|
||||
tracks/9/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.0]
|
||||
}
|
||||
tracks/10/type = "value"
|
||||
tracks/10/imported = false
|
||||
tracks/10/enabled = true
|
||||
tracks/10/path = NodePath("YawLight/DirectionalLight3D:light_color")
|
||||
tracks/10/interp = 1
|
||||
tracks/10/loop_wrap = true
|
||||
tracks/10/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.87513953, 0.92508376, 0.9344481, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fgbjk"]
|
||||
resource_name = "day_night_cycle"
|
||||
length = 30.0
|
||||
loop_mode = 1
|
||||
step = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("YawLight/DirectionalLight3D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 14.9, 15, 30),
|
||||
"transitions": PackedFloat32Array(1, 1, 0, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0), Vector3(-0.6325349, 0, 0), Vector3(-3.14159, 0, 0), Vector3(0, 0, 0), Vector3(-3.14159, 0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/space_emit_strength")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15, 16.5, 28.5, 30),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 0.0, 0.0, 1.0, 1.0, 0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/mie")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [0.166, 0.166, 0.021]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/mie_color")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [Color(0.921569, 0.54902, 0.568627, 1), Color(0.921569, 0.54902, 0.568627, 1), Color(0.435294, 0.756863, 0.937255, 1)]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/mie_eccentricity")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [0.701, 0.701, 0.919]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/rayleigh")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [1.467, 1.467, 3.676]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/rayleigh_color")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [Color(0.26, 0.41, 0.58, 1), Color(0.26, 0.41, 0.58, 1), Color(0.109804, 0.184314, 0.266667, 1)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/turbidity")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [0.797, 0.797, 75.758]
|
||||
}
|
||||
tracks/8/type = "value"
|
||||
tracks/8/imported = false
|
||||
tracks/8/enabled = true
|
||||
tracks/8/path = NodePath("WorldEnvironment:environment:sky:sky_material:shader_parameter/exposure")
|
||||
tracks/8/interp = 1
|
||||
tracks/8/loop_wrap = true
|
||||
tracks/8/keys = {
|
||||
"times": PackedFloat32Array(0, 3, 15),
|
||||
"transitions": PackedFloat32Array(0, 1, 0),
|
||||
"update": 0,
|
||||
"values": [0.1, 0.1, 0.015]
|
||||
}
|
||||
tracks/9/type = "value"
|
||||
tracks/9/imported = false
|
||||
tracks/9/enabled = true
|
||||
tracks/9/path = NodePath("YawLight/DirectionalLight3D:light_energy")
|
||||
tracks/9/interp = 1
|
||||
tracks/9/loop_wrap = true
|
||||
tracks/9/keys = {
|
||||
"times": PackedFloat32Array(0, 1, 3, 14, 14.9, 15, 16, 29),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0, 1.0, 1.0, 0.0, 4.33488e-07, 0.5, 0.5]
|
||||
}
|
||||
tracks/10/type = "value"
|
||||
tracks/10/imported = false
|
||||
tracks/10/enabled = true
|
||||
tracks/10/path = NodePath("YawLight/DirectionalLight3D:light_color")
|
||||
tracks/10/interp = 1
|
||||
tracks/10/loop_wrap = true
|
||||
tracks/10/keys = {
|
||||
"times": PackedFloat32Array(3, 14.9, 15),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.87513953, 0.92508376, 0.9344481, 1), Color(1, 1, 1, 1), Color(0.686275, 0.811765, 0.835294, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_mqv34"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_qen42"),
|
||||
&"day_night_cycle": SubResource("Animation_fgbjk")
|
||||
}
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jcxn0"]
|
||||
shader = ExtResource("2_7kao2")
|
||||
shader_parameter/worlnoise = ExtResource("4_ix4p0")
|
||||
shader_parameter/perlworlnoise = ExtResource("3_k3m6m")
|
||||
shader_parameter/cloud_map = ExtResource("2_wytgt")
|
||||
shader_parameter/cloud_density = 0.05
|
||||
shader_parameter/cloud_coverage = 0.2
|
||||
shader_parameter/cloud_time_scale = 5.0
|
||||
shader_parameter/cloud_time_offset = 0.0
|
||||
shader_parameter/cloud_direction = Vector2(0.9, 1)
|
||||
shader_parameter/cloud_steps_range = Vector2(192, 108)
|
||||
shader_parameter/clouds_screen_lod = 1.0
|
||||
shader_parameter/cloud_modulate = Color(1, 1, 1, 1)
|
||||
shader_parameter/cloud_camera_position_mult = Vector2(0.1, 0.2)
|
||||
shader_parameter/cloud_camera_height = 0.0
|
||||
shader_parameter/rayleigh = 1.467
|
||||
shader_parameter/rayleigh_color = Color(0.26, 0.41, 0.58, 1)
|
||||
shader_parameter/mie = 0.166
|
||||
shader_parameter/mie_eccentricity = 0.701
|
||||
shader_parameter/mie_color = Color(0.921569, 0.54902, 0.568627, 1)
|
||||
shader_parameter/turbidity = 0.797
|
||||
shader_parameter/sun_disk_scale = 1.823
|
||||
shader_parameter/ground_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/exposure = 0.1
|
||||
shader_parameter/space_emit = ExtResource("5_ua1c5")
|
||||
shader_parameter/space_emit_color = Color(0.662745, 0.854902, 1, 1)
|
||||
shader_parameter/space_emit_angle = 0.0
|
||||
shader_parameter/space_emit_strength = 0.0
|
||||
|
||||
[sub_resource type="Sky" id="Sky_m81e2"]
|
||||
sky_material = SubResource("ShaderMaterial_jcxn0")
|
||||
process_mode = 2
|
||||
radiance_size = 0
|
||||
|
||||
[sub_resource type="Environment" id="3"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_m81e2")
|
||||
tonemap_mode = 3
|
||||
tonemap_white = 6.0
|
||||
fog_density = 0.25
|
||||
fog_aerial_perspective = 1.0
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
transform = Transform3D(1, 0.0003427, -0.00016891, -0.000342464, 0.999999, 0.00143352, 0.000169389, -0.00143346, 0.999999, 0, 0, 0)
|
||||
script = ExtResource("1_t20f6")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_mqv34")
|
||||
}
|
||||
autoplay = "day_night_cycle"
|
||||
speed_scale = 0.1
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
offset_right = 493.0
|
||||
offset_bottom = 186.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="TimeOfDay" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
text = "Time of Day"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
max_value = 30.0
|
||||
step = 0.01
|
||||
|
||||
[node name="Value" type="Label" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.15
|
||||
text = "12:00"
|
||||
|
||||
[node name="HSeparator" type="VSeparator" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SpeedMinus" type="Button" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
text = " - "
|
||||
|
||||
[node name="CurrentSpeed" type="Label" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
text = "1.00×"
|
||||
|
||||
[node name="SpeedPlus" type="Button" parent="Panel/MarginContainer/VBoxContainer/TimeOfDay"]
|
||||
layout_mode = 2
|
||||
text = " + "
|
||||
|
||||
[node name="Clouds" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="CoverageLabel" type="Label" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
layout_mode = 2
|
||||
text = "Cloud Coverage"
|
||||
|
||||
[node name="CoverageSlider" type="HSlider" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
max_value = 0.99
|
||||
step = 0.01
|
||||
value = 0.2
|
||||
|
||||
[node name="CoverageValue" type="Label" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
custom_minimum_size = Vector2(33, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.15
|
||||
text = "20%"
|
||||
|
||||
[node name="HSeparator" type="VSeparator" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DensityLabel" type="Label" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
layout_mode = 2
|
||||
text = "Density"
|
||||
|
||||
[node name="DensitySlider" type="HSlider" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
min_value = 0.01
|
||||
max_value = 0.99
|
||||
step = 0.01
|
||||
value = 0.05
|
||||
|
||||
[node name="DensityValue" type="Label" parent="Panel/MarginContainer/VBoxContainer/Clouds"]
|
||||
custom_minimum_size = Vector2(33, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.15
|
||||
text = "5%"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ProcessMode" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/ProcessMode"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.32
|
||||
text = "Process Mode"
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Panel/MarginContainer/VBoxContainer/ProcessMode"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 1
|
||||
item_count = 3
|
||||
popup/item_0/text = "High-Quality"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "High-Quality Incremental"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Real-Time"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[node name="RadianceSize" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/RadianceSize"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.32
|
||||
text = "Radiance Size"
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Panel/MarginContainer/VBoxContainer/RadianceSize"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 0
|
||||
item_count = 5
|
||||
popup/item_0/text = "32 (Faster)"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "64 (Fast)"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "128 (Average)"
|
||||
popup/item_2/id = 2
|
||||
popup/item_3/text = "256 (Slow)"
|
||||
popup/item_3/id = 3
|
||||
popup/item_4/text = "512 (Slowest)"
|
||||
popup/item_4/id = 4
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("3")
|
||||
|
||||
[node name="YawLight" type="Node3D" parent="."]
|
||||
transform = Transform3D(0.965926, 0, 0.258819, 0, 1, 0, -0.258819, 0, 0.965926, 0, 0, 0)
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="YawLight"]
|
||||
transform = Transform3D(1.0000002, 0, 0, 0, 0.8065315, 0.5911911, 0, -0.5911912, 0.8065314, -0.000684916, 2, 0.00286704)
|
||||
light_color = Color(0.87513953, 0.92508376, 0.9344481, 1)
|
||||
|
||||
[node name="Spheres" type="Node3D" parent="."]
|
||||
script = ExtResource("5_00idb")
|
||||
|
||||
[node name="RoughnessLabel" type="Label3D" parent="Spheres"]
|
||||
transform = Transform3D(1, 0.00017379, -0.000511611, 0.00051161, 7.57864e-08, 1, 0.00017379, -1, -1.36206e-08, 0.000828605, 0.500142, 5.70057)
|
||||
shaded = true
|
||||
double_sided = false
|
||||
text = "- Roughness +"
|
||||
font_size = 64
|
||||
outline_size = 24
|
||||
|
||||
[node name="RoughnessLabel2" type="Label3D" parent="Spheres"]
|
||||
transform = Transform3D(-1, -0.000172721, -0.000173317, -0.000172821, -0.00286709, 0.999997, -0.000173217, 0.999997, 0.00286705, -0.00110257, 0.516483, -5.69942)
|
||||
shaded = true
|
||||
double_sided = false
|
||||
text = "+ Roughness -"
|
||||
font_size = 64
|
||||
outline_size = 24
|
||||
|
||||
[node name="MetallicLabel" type="Label3D" parent="Spheres"]
|
||||
transform = Transform3D(-0.000173158, 1, 0.00109107, -0.00126419, -0.00109129, 0.999999, 1, 0.000171779, 0.00126438, -5.70014, 0.500033, 0.00153612)
|
||||
shaded = true
|
||||
double_sided = false
|
||||
text = "- Metallic +"
|
||||
font_size = 64
|
||||
outline_size = 24
|
||||
|
||||
[node name="MetallicLabel2" type="Label3D" parent="Spheres"]
|
||||
transform = Transform3D(0.000172955, -0.999999, -0.001776, 0.00160297, -0.00177572, 0.999998, -1, -0.000175801, 0.00160266, 5.69987, 0.50394, -0.000389313)
|
||||
shaded = true
|
||||
double_sided = false
|
||||
text = "+ Metallic -"
|
||||
font_size = 64
|
||||
outline_size = 24
|
||||
|
||||
[node name="YawCamera" type="Node3D" parent="."]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="YawCamera"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 9)
|
||||
fov = 65.0
|
||||
|
||||
[node name="Help" type="Label" parent="."]
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 16.0
|
||||
offset_top = -39.0
|
||||
offset_right = 56.0
|
||||
offset_bottom = -16.0
|
||||
grow_vertical = 0
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 4
|
||||
text = "F1: Hide/show GUI
|
||||
F2: Hide/show spheres
|
||||
Escape or F10: Toggle mouse capture
|
||||
Mouse wheel or Up/down: Adjust camera FOV"
|
||||
|
||||
[connection signal="value_changed" from="Panel/MarginContainer/VBoxContainer/TimeOfDay/HSlider" to="." method="_on_time_of_day_value_changed"]
|
||||
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/TimeOfDay/SpeedMinus" to="." method="_on_speed_minus_pressed"]
|
||||
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/TimeOfDay/SpeedPlus" to="." method="_on_speed_plus_pressed"]
|
||||
[connection signal="value_changed" from="Panel/MarginContainer/VBoxContainer/Clouds/CoverageSlider" to="." method="_on_cloud_coverage_value_changed"]
|
||||
[connection signal="value_changed" from="Panel/MarginContainer/VBoxContainer/Clouds/DensitySlider" to="." method="_on_cloud_density_value_changed"]
|
||||
[connection signal="item_selected" from="Panel/MarginContainer/VBoxContainer/ProcessMode/OptionButton" to="." method="_on_process_mode_item_selected"]
|
||||
[connection signal="item_selected" from="Panel/MarginContainer/VBoxContainer/RadianceSize/OptionButton" to="." method="_on_radiance_size_item_selected"]
|
||||
43
3d/sky_shaders/README.md
Normal file
43
3d/sky_shaders/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 3D Sky Shaders
|
||||
|
||||
An example of a sky shader in Godot. This shader features real-time volumetric
|
||||
clouds and physical sky with Raleigh and Mie scattering, which causes the sky's
|
||||
colors to adjust automatically depending on the sun angle. The sun's angle is set
|
||||
automatically from the first DirectionalLight3D node in the scene
|
||||
(unless its sky mode is **Light Only**).
|
||||
|
||||
Physical sky features are based on the built-in PhysicalSkyMaterial, while
|
||||
volumetric clouds were added after converting PhysicalSkyMaterial to a
|
||||
ShaderMaterial using the **Convert to ShaderMaterial** button in the editor
|
||||
resource dropdown.
|
||||
|
||||
> **Warning**
|
||||
>
|
||||
> Sky shaders are rendered every frame if they use the `TIME` variable or are
|
||||
> otherwise updated every frame (e.g. if an uniform is updated in `_process()`
|
||||
> or with an AnimationPlayer). This has a significant performance impact for
|
||||
> complex sky shaders. The performance impact can be reduced by adjusting the
|
||||
> radiance map properties in Environment, but it will remain significant.
|
||||
>
|
||||
> The shader in this demo project is expensive, and is intended to be used in
|
||||
> games where most of the sky remains visible at all times (such as flight
|
||||
> simulators).
|
||||
>
|
||||
> Optimizations to sky shader rendering are planned in future Godot releases.
|
||||
|
||||
Language: GDScript
|
||||
|
||||
Renderer: Forward Plus
|
||||
|
||||
## How does it work?
|
||||
|
||||
The day/night cycle is performed using an AnimationPlayer node that adjusts node
|
||||
properties and the sky shader parameters in real-time.
|
||||
|
||||
Spheres with varying levels of roughness and metallic materials are instanced using
|
||||
a [`@tool` script](https://docs.godotengine.org/en/latest/tutorials/plugins/running_code_in_the_editor.html)
|
||||
so that they don't have to be created manually in the editor, yet they can still be previewed within the editor.
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
7
3d/sky_shaders/default_env.tres
Normal file
7
3d/sky_shaders/default_env.tres
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
sky = SubResource( 1 )
|
||||
BIN
3d/sky_shaders/icon.png
Normal file
BIN
3d/sky_shaders/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
40
3d/sky_shaders/icon.png.import
Normal file
40
3d/sky_shaders/icon.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ckaq2n0hvlwq1"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
122
3d/sky_shaders/main.gd
Normal file
122
3d/sky_shaders/main.gd
Normal file
@@ -0,0 +1,122 @@
|
||||
extends Node3D
|
||||
|
||||
const MOUSE_SENSITIVITY = 0.001
|
||||
|
||||
# The camera field of view to smoothly interpolate to.
|
||||
@onready var desired_fov: float = $YawCamera/Camera3D.fov
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
# Make the slider follow the day/night cycle.
|
||||
$Panel/MarginContainer/VBoxContainer/TimeOfDay/HSlider.value = $AnimationPlayer.current_animation_position
|
||||
$WorldEnvironment.environment.sky.sky_material.set_shader_parameter("cloud_time_offset", $AnimationPlayer.current_animation_position)
|
||||
|
||||
$YawCamera/Camera3D.fov = lerpf($YawCamera/Camera3D.fov, desired_fov, 1.0 - exp(-delta * 10.0))
|
||||
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("toggle_gui"):
|
||||
$Panel.visible = not $Panel.visible
|
||||
$Help.visible = not $Help.visible
|
||||
|
||||
if event.is_action_pressed("toggle_spheres"):
|
||||
$Spheres.visible = not $Spheres.visible
|
||||
|
||||
if event.is_action_pressed("toggle_mouse_capture"):
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
else:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED and event is InputEventMouseMotion:
|
||||
# Mouselook.
|
||||
var relative_motion: Vector2 = event.screen_relative
|
||||
$YawCamera.rotation.x = clampf($YawCamera.rotation.x - relative_motion.y * MOUSE_SENSITIVITY, -TAU * 0.25, TAU * 0.25)
|
||||
$YawCamera.rotation.y -= relative_motion.x * MOUSE_SENSITIVITY
|
||||
|
||||
# Mouse wheel currently doesn't work in input actions. Hardcode mouse wheel as a workaround.
|
||||
if event.is_action_pressed("increase_camera_fov") or Input.is_mouse_button_pressed(MOUSE_BUTTON_WHEEL_DOWN):
|
||||
desired_fov = clampf(desired_fov + 5.0, 20.0, 120.0)
|
||||
if event.is_action_pressed("decrease_camera_fov") or Input.is_mouse_button_pressed(MOUSE_BUTTON_WHEEL_UP):
|
||||
desired_fov = clampf(desired_fov - 5.0, 20.0, 120.0)
|
||||
|
||||
|
||||
func _on_time_of_day_value_changed(value: float) -> void:
|
||||
# Update time of day.
|
||||
$AnimationPlayer.seek(value)
|
||||
# TODO: Display HH:MM time.
|
||||
$Panel/MarginContainer/VBoxContainer/TimeOfDay/Value.text = str(value).pad_decimals(2)
|
||||
|
||||
|
||||
func _on_speed_minus_pressed() -> void:
|
||||
# Allow minimum value to be zero so that the special case can be reached for pausing.
|
||||
$AnimationPlayer.speed_scale = clampf($AnimationPlayer.speed_scale * 0.5, 0.0, 12.8)
|
||||
if $AnimationPlayer.speed_scale < 0.0499:
|
||||
# Going below 0.5× speed; pause.
|
||||
$AnimationPlayer.speed_scale = 0.0
|
||||
|
||||
update_speed_label()
|
||||
|
||||
|
||||
func _on_speed_plus_pressed() -> void:
|
||||
$AnimationPlayer.speed_scale = clampf($AnimationPlayer.speed_scale * 2.0, 0.05, 12.8)
|
||||
if is_zero_approx($AnimationPlayer.speed_scale):
|
||||
# Currently paused; resume playback.
|
||||
$AnimationPlayer.speed_scale = 0.1
|
||||
|
||||
update_speed_label()
|
||||
|
||||
|
||||
func update_speed_label() -> void:
|
||||
# The default speed scale for this AnimationPlayer is internally 0.1, so multiply the displayed value by 10.
|
||||
if is_zero_approx($AnimationPlayer.speed_scale):
|
||||
$Panel/MarginContainer/VBoxContainer/TimeOfDay/CurrentSpeed.text = "Pause"
|
||||
else:
|
||||
$Panel/MarginContainer/VBoxContainer/TimeOfDay/CurrentSpeed.text = "%.2f×" % ($AnimationPlayer.speed_scale * 10)
|
||||
|
||||
|
||||
func _on_cloud_coverage_value_changed(value: float) -> void:
|
||||
$WorldEnvironment.environment.sky.sky_material.set_shader_parameter("cloud_coverage", value)
|
||||
$Panel/MarginContainer/VBoxContainer/Clouds/CoverageValue.text = "%d%%" % (value * 100)
|
||||
|
||||
|
||||
func _on_cloud_density_value_changed(value: float) -> void:
|
||||
$WorldEnvironment.environment.sky.sky_material.set_shader_parameter("cloud_density", value)
|
||||
$Panel/MarginContainer/VBoxContainer/Clouds/DensityValue.text = "%d%%" % (value * 100)
|
||||
|
||||
|
||||
func _on_process_mode_item_selected(index: int) -> void:
|
||||
match index:
|
||||
0:
|
||||
$WorldEnvironment.environment.sky.process_mode = Sky.PROCESS_MODE_QUALITY
|
||||
$Panel/MarginContainer/VBoxContainer/RadianceSize.visible = true
|
||||
# Reset radiance size as the engine forces radiance size to 256 after switching to the Real-Time process mode.
|
||||
_on_radiance_size_item_selected($Panel/MarginContainer/VBoxContainer/RadianceSize/OptionButton.selected)
|
||||
1:
|
||||
$WorldEnvironment.environment.sky.process_mode = Sky.PROCESS_MODE_INCREMENTAL
|
||||
$Panel/MarginContainer/VBoxContainer/RadianceSize.visible = true
|
||||
# Reset radiance size as the engine forces radiance size to 256 after switching to the Real-Time process mode.
|
||||
_on_radiance_size_item_selected($Panel/MarginContainer/VBoxContainer/RadianceSize/OptionButton.selected)
|
||||
2:
|
||||
$WorldEnvironment.environment.sky.process_mode = Sky.PROCESS_MODE_REALTIME
|
||||
# Radiance size is forced to 256 by the engine when using Real-Time process mode.
|
||||
$Panel/MarginContainer/VBoxContainer/RadianceSize.visible = false
|
||||
|
||||
|
||||
func _on_radiance_size_item_selected(index: int) -> void:
|
||||
match index:
|
||||
0:
|
||||
$WorldEnvironment.environment.sky.radiance_size = Sky.RADIANCE_SIZE_32
|
||||
1:
|
||||
$WorldEnvironment.environment.sky.radiance_size = Sky.RADIANCE_SIZE_64
|
||||
2:
|
||||
$WorldEnvironment.environment.sky.radiance_size = Sky.RADIANCE_SIZE_128
|
||||
3:
|
||||
$WorldEnvironment.environment.sky.radiance_size = Sky.RADIANCE_SIZE_256
|
||||
4:
|
||||
$WorldEnvironment.environment.sky.radiance_size = Sky.RADIANCE_SIZE_512
|
||||
1
3d/sky_shaders/main.gd.uid
Normal file
1
3d/sky_shaders/main.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cwxsditbkarya
|
||||
BIN
3d/sky_shaders/perlworlnoise.png
Normal file
BIN
3d/sky_shaders/perlworlnoise.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 MiB |
28
3d/sky_shaders/perlworlnoise.png.import
Normal file
28
3d/sky_shaders/perlworlnoise.png.import
Normal file
@@ -0,0 +1,28 @@
|
||||
[remap]
|
||||
|
||||
importer="3d_texture"
|
||||
type="CompressedTexture3D"
|
||||
uid="uid://48aujjq3b6pj"
|
||||
path="res://.godot/imported/perlworlnoise.png-3a040af7870a245e2e85a129517a2537.ctex3d"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://perlworlnoise.png"
|
||||
dest_files=["res://.godot/imported/perlworlnoise.png-3a040af7870a245e2e85a129517a2537.ctex3d"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
slices/horizontal=128
|
||||
slices/vertical=1
|
||||
62
3d/sky_shaders/project.godot
Normal file
62
3d/sky_shaders/project.godot
Normal file
@@ -0,0 +1,62 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="3D Sky Shaders"
|
||||
config/description="A short educational sample showing one way of using sky shaders to render real time volumetric cloudscapes."
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/features=PackedStringArray("4.5")
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[debug]
|
||||
|
||||
gdscript/warnings/untyped_declaration=1
|
||||
|
||||
[display]
|
||||
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
window/vsync/use_vsync=false
|
||||
|
||||
[input]
|
||||
|
||||
toggle_mouse_capture={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194341,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_gui={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_spheres={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
increase_camera_fov={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
decrease_camera_fov={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
anti_aliasing/quality/msaa_3d=2
|
||||
anti_aliasing/quality/use_debanding=true
|
||||
vram_compression/import_etc2=false
|
||||
0
3d/sky_shaders/screenshots/.gdignore
Normal file
0
3d/sky_shaders/screenshots/.gdignore
Normal file
BIN
3d/sky_shaders/screenshots/sky_shaders.webp
Normal file
BIN
3d/sky_shaders/screenshots/sky_shaders.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 373 KiB |
320
3d/sky_shaders/sky_volumetric_clouds.gdshader
Normal file
320
3d/sky_shaders/sky_volumetric_clouds.gdshader
Normal file
@@ -0,0 +1,320 @@
|
||||
// Cloud Raymarching based on:
|
||||
// A. Schneider. “The Real-Time Volumetric Cloudscapes Of Horizon: Zero Dawn”.
|
||||
// ACM SIGGRAPH. Los Angeles, CA: ACM SIGGRAPH, 2015. Web. 26 Aug. 2015.
|
||||
|
||||
shader_type sky;
|
||||
render_mode use_half_res_pass, use_quarter_res_pass;
|
||||
|
||||
uniform sampler3D worlnoise : filter_linear_mipmap, repeat_enable;
|
||||
uniform sampler3D perlworlnoise : filter_linear_mipmap, repeat_enable;
|
||||
uniform sampler2D cloud_map : filter_linear_mipmap, repeat_enable;
|
||||
|
||||
uniform float cloud_density : hint_range(0.01, 0.99) = 0.05;
|
||||
uniform float cloud_coverage : hint_range(0.0, 0.99) = 0.2;
|
||||
uniform float cloud_time_scale : hint_range(0.0, 20.0) = 1.0;
|
||||
uniform float cloud_time_offset : hint_range(0.0, 1000.0, 0.1) = 0.0;
|
||||
uniform vec2 cloud_direction = vec2(0.9, 1.0);
|
||||
uniform vec2 cloud_steps_range = vec2(192.0, 108.0);
|
||||
uniform float clouds_screen_lod : hint_range(0.0, 1.0, 0.1) = 1.0;
|
||||
uniform vec4 cloud_modulate : source_color = vec4(1.0);
|
||||
uniform vec2 cloud_camera_position_mult = vec2(0.1, 0.2);
|
||||
uniform float cloud_camera_height;
|
||||
|
||||
uniform float rayleigh : hint_range(0, 64) = 2.0;
|
||||
uniform vec4 rayleigh_color : source_color = vec4(0.26, 0.41, 0.58, 1.0);
|
||||
uniform float mie : hint_range(0, 1) = 0.005;
|
||||
uniform float mie_eccentricity : hint_range(-1, 1) = 0.8;
|
||||
uniform vec4 mie_color : source_color = vec4(0.63, 0.77, 0.92, 1.0);
|
||||
|
||||
uniform float turbidity : hint_range(0, 1000) = 10.0;
|
||||
uniform float sun_disk_scale : hint_range(0, 360) = 1.0;
|
||||
uniform vec4 ground_color : source_color = vec4(1.0);
|
||||
uniform float exposure : hint_range(0, 128) = 0.1;
|
||||
|
||||
uniform sampler2D space_emit : hint_default_transparent, filter_linear;
|
||||
uniform vec4 space_emit_color : source_color = vec4(1.0);
|
||||
uniform float space_emit_angle : hint_range(0.0, 1.0, 0.001);
|
||||
uniform float space_emit_strength = 1.0;
|
||||
|
||||
const vec3 UP = vec3(0.0, 1.0, 0.0);
|
||||
|
||||
// Approximately earth sizes.
|
||||
const float GROUND_RADIUS = 6000000.0;
|
||||
const float SKY_BOTTOM_RADIUS = 6001500.0; // Bottom of cloud layer.
|
||||
const float SKY_TOP_RADIUS = 6004000.0; // Top of cloud layer.
|
||||
|
||||
// Sun constants.
|
||||
const float SOL_SIZE = 0.00872663806;
|
||||
const float SUN_ENERGY = 1000.0;
|
||||
|
||||
// Optical length at zenith for molecules.
|
||||
const float rayleigh_zenith_size = 8.4e3;
|
||||
const float mie_zenith_size = 1.25e3;
|
||||
|
||||
float parabola(float x, float k) {
|
||||
return pow(4.0 * x * (1.0 - x), k);
|
||||
}
|
||||
|
||||
// From: https://www.shadertoy.com/view/4sfGzS.
|
||||
// Credit to Inigo Quilez.
|
||||
float hash(vec3 p) {
|
||||
p = fract(p * 0.3183099 + 0.1);
|
||||
p *= 17.0;
|
||||
return fract(p.x * p.y * p.z * (p.x + p.y + p.z));
|
||||
}
|
||||
|
||||
// Utility function that maps a value from one range to another (similar to GDScript's `remap()`).
|
||||
float remap(float original_value, float original_min, float original_max, float new_min, float new_max) {
|
||||
return new_min + (((original_value - original_min) / (original_max - original_min)) * (new_max - new_min));
|
||||
}
|
||||
|
||||
// Phase function.
|
||||
float henyey_greenstein(float cos_theta, float g) {
|
||||
const float k = 0.0795774715459;
|
||||
return k * (1.0 - g * g) / (pow(1.0 + g * g - 2.0 * g * cos_theta, 1.5));
|
||||
}
|
||||
|
||||
// Simple analytic sky.
|
||||
// In a real project, you should use a texture to improve performance.
|
||||
vec3 atmosphere(vec3 eye_dir, vec2 coords, float space) {
|
||||
float zenith_angle = clamp(dot(UP, normalize(LIGHT0_DIRECTION)), -1.0, 1.0);
|
||||
float sun_energy = max(0.0, 1.0 - exp(-((PI * 0.5) - acos(zenith_angle)))) * SUN_ENERGY * LIGHT0_ENERGY;
|
||||
float sun_fade = 1.0 - clamp(1.0 - exp(LIGHT0_DIRECTION.y), 0.0, 1.0);
|
||||
|
||||
// Rayleigh coefficients.
|
||||
float rayleigh_coefficient = rayleigh - (1.0 * (1.0 - sun_fade));
|
||||
vec3 rayleigh_beta = rayleigh_coefficient * rayleigh_color.rgb * 0.0001;
|
||||
// Mie coefficients from Preetham.
|
||||
vec3 mie_beta = turbidity * mie * mie_color.rgb * 0.000434;
|
||||
|
||||
// Optical length.
|
||||
float zenith = acos(max(0.0, dot(UP, eye_dir)));
|
||||
float optical_mass = 1.0 / (cos(zenith) + 0.15 * pow(93.885 - degrees(zenith), -1.253));
|
||||
float rayleigh_scatter = rayleigh_zenith_size * optical_mass;
|
||||
float mie_scatter = mie_zenith_size * optical_mass;
|
||||
|
||||
// Light extinction based on thickness of atmosphere.
|
||||
vec3 extinction = exp(-(rayleigh_beta * rayleigh_scatter + mie_beta * mie_scatter));
|
||||
|
||||
// In scattering.
|
||||
float cos_theta = dot(eye_dir, normalize(LIGHT0_DIRECTION));
|
||||
|
||||
float rayleigh_phase = (3.0 / (16.0 * PI)) * (1.0 + pow(cos_theta * 0.5 + 0.5, 2.0));
|
||||
vec3 betaRTheta = rayleigh_beta * rayleigh_phase;
|
||||
|
||||
float mie_phase = henyey_greenstein(cos_theta, mie_eccentricity);
|
||||
vec3 betaMTheta = mie_beta * mie_phase;
|
||||
|
||||
vec3 Lin = pow(sun_energy * ((betaRTheta + betaMTheta) / (rayleigh_beta + mie_beta)) * (1.0 - extinction), vec3(1.5));
|
||||
// Hack from <https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js>.
|
||||
Lin *= mix(vec3(1.0), pow(sun_energy * ((betaRTheta + betaMTheta) / (rayleigh_beta + mie_beta)) * extinction, vec3(0.5)), clamp(pow(1.0 - zenith_angle, 5.0), 0.0, 1.0));
|
||||
|
||||
// Hack in the ground color.
|
||||
Lin *= mix(ground_color.rgb, vec3(1.0), smoothstep(-0.1, 0.1, dot(UP, eye_dir)));
|
||||
|
||||
// Solar disk and out-scattering.
|
||||
float sunAngularDiameterCos = cos(SOL_SIZE * sun_disk_scale);
|
||||
float sunAngularDiameterCos2 = cos(SOL_SIZE * sun_disk_scale * 0.5);
|
||||
float sundisk = smoothstep(sunAngularDiameterCos, sunAngularDiameterCos2, cos_theta);
|
||||
vec3 L0 = (sun_energy * 1900.0 * extinction) * sundisk * LIGHT0_COLOR;
|
||||
|
||||
// Add night-time sky.
|
||||
vec2 space_coords = vec2(fract(coords.x + space_emit_angle), coords.y);
|
||||
vec4 space_tex = texture(space_emit, space_coords * vec2(1.0, 2.0));
|
||||
vec3 space_color = space_tex.rgb * space_tex.a * space_emit_color.rgb * space_emit_color.a;
|
||||
|
||||
L0 += space_color * 5000.0 * space_emit_strength * extinction * space;
|
||||
|
||||
vec3 color = (Lin + L0) * 0.04;
|
||||
color = pow(color, vec3(1.0 / (1.2 + (1.2 * sun_fade))));
|
||||
color *= exposure;
|
||||
return color;
|
||||
}
|
||||
|
||||
float get_height_fraction_for_point(float in_position) {
|
||||
float height_fraction = (in_position - SKY_BOTTOM_RADIUS) / (SKY_TOP_RADIUS - SKY_BOTTOM_RADIUS);
|
||||
return clamp(height_fraction, 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec4 mix_gradients(float cloud_type) {
|
||||
const vec4 STRATUS_GRADIENT = vec4(0.02, 0.05, 0.09, 0.11);
|
||||
const vec4 STRATOCUMULUS_GRADIENT = vec4(0.02, 0.2, 0.48, 0.625);
|
||||
const vec4 CUMULUS_GRADIENT = vec4(0.01, 0.0625, 0.78, 1.0);
|
||||
float stratus = 1.0f - clamp(cloud_type * 2.0, 0.0, 1.0);
|
||||
float stratocumulus = 1.0f - abs(cloud_type - 0.5) * 2.0;
|
||||
float cumulus = clamp(cloud_type - 0.5, 0.0, 1.0) * 2.0;
|
||||
return STRATUS_GRADIENT * stratus + STRATOCUMULUS_GRADIENT * stratocumulus + CUMULUS_GRADIENT * cumulus;
|
||||
}
|
||||
|
||||
float density_height_gradient(float height_frac, float cloud_type) {
|
||||
vec4 cloud_gradient = mix_gradients(cloud_type);
|
||||
return smoothstep(cloud_gradient.x, cloud_gradient.y, height_frac) - smoothstep(cloud_gradient.z, cloud_gradient.w, height_frac);
|
||||
}
|
||||
|
||||
float intersect_sphere(vec3 pos, vec3 dir, float r) {
|
||||
float a = dot(dir, dir);
|
||||
float b = 2.0 * dot(dir, pos);
|
||||
float c = dot(pos, pos) - (r * r);
|
||||
float d = sqrt((b * b) - 4.0 * a * c);
|
||||
float p = -b - d;
|
||||
float p2 = -b + d;
|
||||
return max(p, p2) / (2.0 * a);
|
||||
}
|
||||
|
||||
// Returns density at a given point.
|
||||
// Heavily based on method from Schneider.
|
||||
float density(vec3 pip, vec3 weather, float mip) {
|
||||
vec3 p = pip;
|
||||
p.x += 10.0 * cloud_time_offset * cloud_time_scale;
|
||||
float height_fraction = get_height_fraction_for_point(length(p));
|
||||
vec4 n = textureLod(perlworlnoise, p.xyz * 0.00008, mip - 2.0);
|
||||
float fbm = n.g * 0.625 + n.b * 0.25 + n.a * 0.125;
|
||||
float g = density_height_gradient(height_fraction, weather.r);
|
||||
float base_cloud = remap(n.r, -(1.0 - fbm), 1.0, 0.0, 1.0);
|
||||
float weather_coverage = cloud_coverage * weather.b;
|
||||
base_cloud = remap(base_cloud * g, 1.0 - weather_coverage, 1.0, 0.0, 1.0);
|
||||
base_cloud *= weather_coverage;
|
||||
p.xy -= 40.0 * cloud_time_offset * cloud_time_scale;
|
||||
vec3 hn = textureLod(worlnoise, p * 0.001, mip).rgb;
|
||||
float hfbm = hn.r * 0.625 + hn.g * 0.25 + hn.b * 0.125;
|
||||
hfbm = mix(hfbm, 1.0 - hfbm, clamp(height_fraction * 4.0, 0.0, 1.0));
|
||||
base_cloud = remap(base_cloud, hfbm * 0.4 * height_fraction, 1.0, 0.0, 1.0);
|
||||
return pow(clamp(base_cloud, 0.0, 1.0), (1.0 - height_fraction) * 0.8 + 0.5);
|
||||
}
|
||||
|
||||
vec4 march(vec3 pos, vec3 end, vec3 dir, int depth) {
|
||||
const vec3 RANDOM_VECTORS[6] = {
|
||||
vec3(0.38051305, 0.92453449, -0.02111345),
|
||||
vec3(-0.50625799, -0.03590792, -0.86163418),
|
||||
vec3(-0.32509218, -0.94557439, 0.01428793),
|
||||
vec3(0.09026238, -0.27376545, 0.95755165),
|
||||
vec3(0.28128598, 0.42443639, -0.86065785),
|
||||
vec3(-0.16852403, 0.14748697, 0.97460106)};
|
||||
|
||||
float T = 1.0;
|
||||
float alpha = 0.0;
|
||||
float ss = length(dir);
|
||||
dir = normalize(dir);
|
||||
vec3 p = pos + hash(pos * 10.0) * ss;
|
||||
const float t_dist = SKY_TOP_RADIUS - SKY_BOTTOM_RADIUS;
|
||||
float lss = (t_dist / 36.0);
|
||||
vec3 ldir = normalize(LIGHT0_DIRECTION);
|
||||
vec3 L = vec3(0.0);
|
||||
int count = 0;
|
||||
float t = 1.0;
|
||||
|
||||
float cos_theta = dot(ldir, dir);
|
||||
// Stack multiple phase functions to emulate some backscattering.
|
||||
float phase = max(max(henyey_greenstein(cos_theta, 0.6), henyey_greenstein(cos_theta, (0.4 - 1.4 * ldir.y))), henyey_greenstein(cos_theta, -0.2));
|
||||
|
||||
// Precalculate sun and ambient colors.
|
||||
// This should really come from a uniform or texture for performance reasons.
|
||||
vec3 atmosphere_sun = atmosphere(LIGHT0_DIRECTION, vec2(0), 0) * LIGHT0_ENERGY * ss * 0.1;
|
||||
vec3 atmosphere_ambient = atmosphere(normalize(vec3(1.0, 1.0, 0.0)), vec2(0), 0);
|
||||
vec3 atmosphere_ground = atmosphere(normalize(vec3(1.0, -1.0, 0.0)), vec2(0), 0);
|
||||
|
||||
const float WEATHER_SCALE = 0.00006;
|
||||
float time = 0.003 * cloud_time_offset * cloud_time_scale;
|
||||
vec2 weather_pos = vec2(time * cloud_direction.x, time * cloud_direction.y);
|
||||
|
||||
for (int i = 0; i < depth; i++) {
|
||||
p += dir * ss;
|
||||
vec3 weather_sample = texture(cloud_map, p.xz * WEATHER_SCALE + 0.5 + weather_pos).xyz;
|
||||
float height_fraction = get_height_fraction_for_point(length(p));
|
||||
|
||||
t = density(p, weather_sample, 0.0);
|
||||
float dt = exp(-cloud_density * t * ss);
|
||||
T *= dt;
|
||||
vec3 lp = p;
|
||||
float lt = 1.0;
|
||||
float cd = 0.0;
|
||||
|
||||
if (t > 0.0) {
|
||||
// Calculate lighting, but only when we're in the cloud.
|
||||
float lheight_fraction = 0.0;
|
||||
for (int j = 0; j < 6; j++) {
|
||||
lp += (ldir + RANDOM_VECTORS[j] * float(j)) * lss;
|
||||
lheight_fraction = get_height_fraction_for_point(length(lp));
|
||||
vec3 lweather = texture(cloud_map, lp.xz * WEATHER_SCALE + 0.5 + weather_pos).xyz;
|
||||
lt = density(lp, lweather, float(j));
|
||||
cd += lt;
|
||||
}
|
||||
|
||||
// Take a single distant sample.
|
||||
lp = p + ldir * 18.0 * lss;
|
||||
lheight_fraction = get_height_fraction_for_point(length(lp));
|
||||
vec3 lweather = texture(cloud_map, lp.xz * WEATHER_SCALE + 0.5).xyz;
|
||||
lt = pow(density(lp, lweather, 5.0), (1.0 - lheight_fraction) * 0.8 + 0.5);
|
||||
cd += lt;
|
||||
|
||||
// Captures the direct lighting from the sun.
|
||||
float beers = exp(-cloud_density * cd * lss);
|
||||
float beers2 = exp(-cloud_density * cd * lss * 0.25) * 0.7;
|
||||
float beers_total = max(beers, beers2);
|
||||
|
||||
vec3 ambient = mix(atmosphere_ground, vec3(1.0), smoothstep(0.0, 1.0, height_fraction)) * cloud_density * mix(atmosphere_ambient, vec3(1.0), 0.4) * (LIGHT0_DIRECTION.y);
|
||||
alpha += (1.0 - dt) * (1.0 - alpha);
|
||||
L += (ambient + beers_total * atmosphere_sun * phase * alpha) * T * t;
|
||||
}
|
||||
}
|
||||
return clamp(vec4(L, alpha), 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec4 clouds(vec3 dir, vec3 background, vec2 steps_in, float screen_x, vec3 camera) {
|
||||
vec4 col;
|
||||
if (dir.y > 0.0) {
|
||||
vec3 camera_position = vec3(0.0, GROUND_RADIUS, 0.0) + vec3(camera.x * cloud_camera_position_mult.x, camera.y * cloud_camera_position_mult.y + cloud_camera_height, camera.z * cloud_camera_position_mult.x);
|
||||
vec3 start = camera_position + dir * intersect_sphere(camera_position, dir, SKY_BOTTOM_RADIUS);
|
||||
vec3 end = camera_position + dir * intersect_sphere(camera_position, dir, SKY_TOP_RADIUS);
|
||||
float shell_distance = (length(end - start));
|
||||
// Take fewer steps towards horizon and screen sides.
|
||||
float steps = mix(steps_in.y, steps_in.x, clamp(dot(dir, vec3(0.0, 1.0, 0.0)) * mix(1.0, parabola(screen_x, 0.75), clouds_screen_lod), 0.0, 1.0));
|
||||
vec3 ray_step = dir * shell_distance / steps;
|
||||
vec4 volume = march(start, end, ray_step, int(steps));
|
||||
volume *= cloud_modulate;
|
||||
|
||||
// Draw cloud shape.
|
||||
col = vec4(background * (1.0 - volume.a) + volume.xyz, 1.0);
|
||||
// Blend distant clouds into the sky.
|
||||
col.xyz = mix(clamp(col.xyz, vec3(0.0), vec3(1.0)), clamp(background, vec3(0.0), vec3(1.0)), smoothstep(0.6, 1.0, 1.0 - dir.y));
|
||||
col = volume;
|
||||
}
|
||||
|
||||
// Draw to quarter-resolution buffer for reflections.
|
||||
// Draw to half-resolution buffer for main sky.
|
||||
return col;
|
||||
}
|
||||
|
||||
vec4 clouds_post(vec3 direction, vec4 volume, vec3 background) {
|
||||
// Draw background at full resolution pass.
|
||||
vec4 col;
|
||||
|
||||
if (direction.y > 0.0) {
|
||||
// Draw cloud shape.
|
||||
col = vec4(background * (1.0 - volume.a) + volume.xyz, 1.0);
|
||||
// Blend distant clouds into the sky.
|
||||
col.xyz = mix(clamp(col.xyz, vec3(0.0), vec3(1.0)), clamp(background, vec3(0.0), vec3(1.0)), smoothstep(0.6, 1.0, 1.0 - direction.y));
|
||||
} else {
|
||||
col = vec4(atmosphere(direction, vec2(0), 0), 1.0);
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
void sky() {
|
||||
vec3 background = atmosphere(EYEDIR, SKY_COORDS, 1.0);
|
||||
|
||||
if (AT_HALF_RES_PASS && !AT_CUBEMAP_PASS) {
|
||||
vec4 col = clouds(EYEDIR, background, cloud_steps_range, SCREEN_UV.x, POSITION);
|
||||
COLOR = col.rgb;
|
||||
ALPHA = col.a;
|
||||
} else if (AT_QUARTER_RES_PASS && AT_CUBEMAP_PASS) {
|
||||
COLOR = clouds_post(EYEDIR, clouds(EYEDIR, background, vec2(15, 10), SCREEN_UV.x, POSITION), background).rgb;
|
||||
ALPHA = 1.0;
|
||||
} else if (AT_CUBEMAP_PASS) {
|
||||
COLOR = QUARTER_RES_COLOR.rgb;
|
||||
} else {
|
||||
COLOR = clouds_post(EYEDIR, vec4(HALF_RES_COLOR), background).rgb;
|
||||
ALPHA = 1.0;
|
||||
}
|
||||
}
|
||||
1
3d/sky_shaders/sky_volumetric_clouds.gdshader.uid
Normal file
1
3d/sky_shaders/sky_volumetric_clouds.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://x1tpa10wfi7g
|
||||
BIN
3d/sky_shaders/space.webp
Normal file
BIN
3d/sky_shaders/space.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 270 KiB |
40
3d/sky_shaders/space.webp.import
Normal file
40
3d/sky_shaders/space.webp.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvpkajbs1yfug"
|
||||
path="res://.godot/imported/space.webp-b2559122813bb5c660d9bc201c230cdd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://space.webp"
|
||||
dest_files=["res://.godot/imported/space.webp-b2559122813bb5c660d9bc201c230cdd.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
20
3d/sky_shaders/spheres.gd
Normal file
20
3d/sky_shaders/spheres.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Create spheres to represent various levels of material roughness and metallic.
|
||||
for roughness in range(11):
|
||||
for metallic in range(11):
|
||||
var sphere := MeshInstance3D.new()
|
||||
sphere.mesh = SphereMesh.new()
|
||||
# Center the spheres around the node origin.
|
||||
sphere.position = Vector3(roughness, 0, metallic) - Vector3(5, 0, 5)
|
||||
|
||||
var material := StandardMaterial3D.new()
|
||||
material.albedo_color = Color(0.5, 0.5, 0.5)
|
||||
material.roughness = roughness * 0.1
|
||||
material.metallic = metallic * 0.1
|
||||
sphere.material_override = material
|
||||
|
||||
add_child(sphere)
|
||||
1
3d/sky_shaders/spheres.gd.uid
Normal file
1
3d/sky_shaders/spheres.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dgprxredbdjd7
|
||||
BIN
3d/sky_shaders/weather.webp
Normal file
BIN
3d/sky_shaders/weather.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
41
3d/sky_shaders/weather.webp.import
Normal file
41
3d/sky_shaders/weather.webp.import
Normal file
@@ -0,0 +1,41 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dcf4fxk846cq4"
|
||||
path.s3tc="res://.godot/imported/weather.webp-79431eb6f279f7711620ff384b309c21.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://weather.webp"
|
||||
dest_files=["res://.godot/imported/weather.webp-79431eb6f279f7711620ff384b309c21.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
BIN
3d/sky_shaders/worlnoise.webp
Normal file
BIN
3d/sky_shaders/worlnoise.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
29
3d/sky_shaders/worlnoise.webp.import
Normal file
29
3d/sky_shaders/worlnoise.webp.import
Normal file
@@ -0,0 +1,29 @@
|
||||
[remap]
|
||||
|
||||
importer="3d_texture"
|
||||
type="CompressedTexture3D"
|
||||
uid="uid://bflk6wdrcm8kq"
|
||||
path.s3tc="res://.godot/imported/worlnoise.webp-bcfb62b368e2c1367f314f5db51ae668.s3tc.ctex3d"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://worlnoise.webp"
|
||||
dest_files=["res://.godot/imported/worlnoise.webp-bcfb62b368e2c1367f314f5db51ae668.s3tc.ctex3d"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
slices/horizontal=32
|
||||
slices/vertical=1
|
||||
Reference in New Issue
Block a user