Compare commits

...

3 Commits

Author SHA1 Message Date
Rob Kelly 9d6a902d78 Added path-based guard rails 2024-11-13 02:11:12 -07:00
Rob Kelly 1bd11434e4 Added retro postprocessing shader for later use 2024-11-13 00:17:41 -07:00
Rob Kelly 6ad1ce2140 Visual tweaks 2024-11-12 23:47:01 -07:00
18 changed files with 632 additions and 58 deletions

Binary file not shown.

BIN
asset_dev/guard_rail/guard_rail.blend (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/textures/guard_rail/guard_rail_post.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cxeela02ysscf"
path="res://.godot/imported/guard_rail_post.png-4447ff881a5916e5281ed251b7beecd0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/guard_rail/guard_rail_post.png"
dest_files=["res://.godot/imported/guard_rail_post.png-4447ff881a5916e5281ed251b7beecd0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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
assets/vista_2.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=36 format=3 uid="uid://bm2o3mex10v11"] [gd_scene load_steps=40 format=3 uid="uid://bm2o3mex10v11"]
[ext_resource type="Terrain3DStorage" uid="uid://bu1gewgsgc5hm" path="res://levels/debug_level/terrain_3d_storage.res" id="1_nlsu2"] [ext_resource type="Terrain3DStorage" uid="uid://bu1gewgsgc5hm" path="res://levels/debug_level/terrain_3d_storage.res" id="1_nlsu2"]
[ext_resource type="Texture2D" path="res://assets/textures/grass_fairway/grass_fairway_albedo.dds" id="2_e4m27"] [ext_resource type="Texture2D" path="res://assets/textures/grass_fairway/grass_fairway_albedo.dds" id="2_e4m27"]
@ -15,6 +15,7 @@
[ext_resource type="PackedScene" uid="uid://di7aql54lksn7" path="res://src/props/scenery/trees/palm_tree/palm_tree.tscn" id="12_sswxf"] [ext_resource type="PackedScene" uid="uid://di7aql54lksn7" path="res://src/props/scenery/trees/palm_tree/palm_tree.tscn" id="12_sswxf"]
[ext_resource type="PackedScene" uid="uid://c7l58wuuahn7w" path="res://src/props/flag/flag.tscn" id="13_6jtao"] [ext_resource type="PackedScene" uid="uid://c7l58wuuahn7w" path="res://src/props/flag/flag.tscn" id="13_6jtao"]
[ext_resource type="Texture2D" uid="uid://dj60e8ri2fco" path="res://assets/models/scenery/city/concrete_building_1/concrete_building_1.png" id="14_y7s2h"] [ext_resource type="Texture2D" uid="uid://dj60e8ri2fco" path="res://assets/models/scenery/city/concrete_building_1/concrete_building_1.png" id="14_y7s2h"]
[ext_resource type="PackedScene" uid="uid://nqar1qcun8ax" path="res://src/props/scenery/highway/guard_rail.tscn" id="16_xtxyj"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_rpgb7"] [sub_resource type="FastNoiseLite" id="FastNoiseLite_rpgb7"]
noise_type = 0 noise_type = 0
@ -38,21 +39,30 @@ _shader_parameters = {
"noise2_scale": 0.076, "noise2_scale": 0.076,
"noise3_scale": 0.021, "noise3_scale": 0.021,
"noise_texture": SubResource("NoiseTexture2D_sb318"), "noise_texture": SubResource("NoiseTexture2D_sb318"),
"vertex_normals_distance": 128.0 "vertex_normals_distance": 128.0,
"world_noise_blend_far": 1.0,
"world_noise_blend_near": 0.57,
"world_noise_height": 74.0,
"world_noise_lod_distance": 16384.0,
"world_noise_max_octaves": 8,
"world_noise_min_octaves": 2,
"world_noise_offset": Vector3(0, -8, 0),
"world_noise_scale": 5.0
} }
world_background = 2
texture_filtering = 1 texture_filtering = 1
show_navigation = true
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ly4sm"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2u1w6"]
cull_mode = 2 cull_mode = 2
vertex_color_use_as_albedo = true vertex_color_use_as_albedo = true
backlight_enabled = true backlight_enabled = true
backlight = Color(0.5, 0.5, 0.5, 1) backlight = Color(0.5, 0.5, 0.5, 1)
[sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_8g62o"] [sub_resource type="Terrain3DMeshAsset" id="Terrain3DMeshAsset_8g62o"]
name = "palm_tree"
height_offset = 0.5 height_offset = 0.5
density = 10.0 density = 10.0
material_override = SubResource("StandardMaterial3D_ly4sm") material_override = SubResource("StandardMaterial3D_2u1w6")
generated_type = 1 generated_type = 1
[sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_kocfk"] [sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_kocfk"]
@ -82,11 +92,16 @@ sky_material = SubResource("PanoramaSkyMaterial_h8tes")
background_mode = 2 background_mode = 2
sky = SubResource("Sky_2xshh") sky = SubResource("Sky_2xshh")
ambient_light_source = 2 ambient_light_source = 2
ambient_light_color = Color(0.838897, 0.838897, 0.838897, 1) ambient_light_color = Color(0.78, 0.78, 0.78, 1)
ssao_enabled = true
ssao_intensity = 1.7
glow_enabled = true
glow_bloom = 0.05
volumetric_fog_enabled = true volumetric_fog_enabled = true
volumetric_fog_density = 0.005 volumetric_fog_density = 0.001
volumetric_fog_emission = Color(0, 1, 1, 1) volumetric_fog_emission = Color(0.6, 1, 1, 1)
volumetric_fog_length = 32.0 volumetric_fog_length = 1024.0
volumetric_fog_sky_affect = 0.0
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_ypy22"] [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_ypy22"]
dof_blur_far_distance = 200.0 dof_blur_far_distance = 200.0
@ -95,6 +110,17 @@ dof_blur_near_enabled = true
dof_blur_near_distance = 1.0 dof_blur_near_distance = 1.0
dof_blur_near_transition = 0.5 dof_blur_near_transition = 0.5
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5p7vs"]
albedo_texture = ExtResource("14_y7s2h")
uv1_scale = Vector3(300, 800, 1)
[sub_resource type="BoxMesh" id="BoxMesh_20p1k"]
material = SubResource("StandardMaterial3D_5p7vs")
size = Vector3(300, 1, 800)
[sub_resource type="BoxShape3D" id="BoxShape3D_g31tw"]
size = Vector3(300, 1, 800)
[sub_resource type="FastNoiseLite" id="FastNoiseLite_mgjj0"] [sub_resource type="FastNoiseLite" id="FastNoiseLite_mgjj0"]
fractal_type = 2 fractal_type = 2
@ -110,8 +136,8 @@ shader_parameter/albedo = Color(0.427451, 0.917647, 1, 1)
shader_parameter/scroll_speed1 = Vector2(0.05, 0) shader_parameter/scroll_speed1 = Vector2(0.05, 0)
shader_parameter/scroll_speed2 = Vector2(-0.03, 0) shader_parameter/scroll_speed2 = Vector2(-0.03, 0)
shader_parameter/blend_factor = 0.5 shader_parameter/blend_factor = 0.5
shader_parameter/scale1 = Vector2(128, 128) shader_parameter/scale1 = Vector2(512, 512)
shader_parameter/scale2 = Vector2(256, 256) shader_parameter/scale2 = Vector2(1024, 1024)
shader_parameter/wave_strength = 0.4 shader_parameter/wave_strength = 0.4
shader_parameter/wave_scale = 0.02 shader_parameter/wave_scale = 0.02
shader_parameter/pixelation_level = 128 shader_parameter/pixelation_level = 128
@ -124,23 +150,26 @@ shader_parameter/noise_texture = SubResource("NoiseTexture2D_0xqld")
[sub_resource type="PlaneMesh" id="PlaneMesh_2ywhk"] [sub_resource type="PlaneMesh" id="PlaneMesh_2ywhk"]
material = SubResource("ShaderMaterial_dkdxa") material = SubResource("ShaderMaterial_dkdxa")
size = Vector2(4096, 4096) size = Vector2(16384, 16384)
subdivide_width = 256 subdivide_width = 1024
subdivide_depth = 256 subdivide_depth = 1024
[sub_resource type="BoxShape3D" id="BoxShape3D_x3wvm"] [sub_resource type="BoxShape3D" id="BoxShape3D_x3wvm"]
size = Vector3(4096, 2, 4096) size = Vector3(4096, 2, 4096)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5p7vs"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_65jc8"]
albedo_texture = ExtResource("14_y7s2h") albedo_color = Color(0.427451, 0.917647, 1, 1)
uv1_scale = Vector3(300, 800, 1)
[sub_resource type="BoxMesh" id="BoxMesh_20p1k"] [sub_resource type="PlaneMesh" id="PlaneMesh_h0mhn"]
material = SubResource("StandardMaterial3D_5p7vs") material = SubResource("StandardMaterial3D_65jc8")
size = Vector3(300, 1, 800) size = Vector2(65536, 65536)
[sub_resource type="BoxShape3D" id="BoxShape3D_g31tw"] [sub_resource type="Curve3D" id="Curve3D_3gyu3"]
size = Vector3(300, 1, 800) _data = {
"points": PackedVector3Array(-4.50073, 0, 25.6049, 4.501, 0, -18.73, -15.152, 0, 5.61563, -20.4021, 0, 1.25826, 20.4021, 0, -1.25826, 25.991, 0, -27.2219, -9.077, 0, -17.164, 6.41687, 0, 33.4636, 72.1845, 0, 6.57864),
"tilts": PackedFloat32Array(0, 0, 0)
}
point_count = 3
[node name="TestLevel" type="Node3D"] [node name="TestLevel" type="Node3D"]
@ -154,22 +183,9 @@ environment = SubResource("Environment_k6wwx")
camera_attributes = SubResource("CameraAttributesPractical_ypy22") camera_attributes = SubResource("CameraAttributesPractical_ypy22")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.29404, 0.955793, 0, -0.955793, 0.29404, 0, 0, 0) transform = Transform3D(0.782608, -0.611691, 0.11558, 0, 0.185667, 0.982613, -0.622515, -0.769001, 0.145304, 0, 0, 0)
shadow_enabled = true
[node name="WaterTable" type="MeshInstance3D" parent="."] shadow_blur = 4.0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0)
mesh = SubResource("PlaneMesh_2ywhk")
[node name="BallZone" type="Area3D" parent="WaterTable"]
script = ExtResource("9_jwlau")
water_hazard = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="WaterTable/BallZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.2, 0)
shape = SubResource("BoxShape3D_x3wvm")
[node name="ShotSetup" parent="." instance=ExtResource("8_h44v5")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 212.717, 4, 294.073)
[node name="Buildings" type="Node3D" parent="."] [node name="Buildings" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 129.404, -9.53674e-07, 309.4) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 129.404, -9.53674e-07, 309.4)
@ -189,23 +205,52 @@ transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0,
[node name="PalmTree" parent="." instance=ExtResource("12_sswxf")] [node name="PalmTree" parent="." instance=ExtResource("12_sswxf")]
transform = Transform3D(-0.69799, 0, -0.716107, 0, 1, 0, 0.716107, 0, -0.69799, 140.872, -9.53674e-07, 296.932) transform = Transform3D(-0.69799, 0, -0.716107, 0, 1, 0, 0.716107, 0, -0.69799, 140.872, -9.53674e-07, 296.932)
[node name="Flag" parent="." instance=ExtResource("13_6jtao")] [node name="Course" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 540, 4, 452)
[node name="DebugTable" type="MeshInstance3D" parent="."] [node name="Fairway" type="Area3D" parent="Course"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 160.1, 0, 885.605)
mesh = SubResource("BoxMesh_20p1k")
[node name="StaticBody3D" type="StaticBody3D" parent="DebugTable"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="DebugTable/StaticBody3D"]
shape = SubResource("BoxShape3D_g31tw")
[node name="Fairway" type="Area3D" parent="."]
script = ExtResource("9_jwlau") script = ExtResource("9_jwlau")
terrain_angular_damping = 2.0 terrain_angular_damping = 2.0
[node name="CollisionPolygon3D" type="CollisionPolygon3D" parent="Fairway"] [node name="CollisionPolygon3D" type="CollisionPolygon3D" parent="Course/Fairway"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 209.788, 6.20358, 256.527) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 209.788, 6.20358, 256.527)
depth = 10.0 depth = 10.0
polygon = PackedVector2Array(-1.47594, 8.77969, -12.788, 19.9447, -17.7778, 31.2864, -19.2001, 41.1398, -19.2001, 55.4081, -16.3465, 66.9813, -15.7123, 75.8594, -14.9196, 82.6765, -12.383, 89.9692, -5.6736, 102.186, 2.88742, 115.027, 9.22891, 125.332, 14.7777, 133.893, 23.4973, 146.417, 35.7046, 159.893, 44.1071, 167.661, 55.8437, 178.18, 64.5632, 185.314, 69.7949, 189.753, 73.7584, 193.082, 80.734, 200.85, 94.5267, 212.899, 106.576, 221.46, 127.915, 233.827, 139.647, 240.802, 170.403, 256.181, 183.721, 262.839, 204.489, 271.717, 216.062, 274.571, 224.465, 279.485, 235.727, 283.429, 246.983, 289.929, 253.958, 290.88, 265.373, 296.27, 275.044, 298.965, 288.995, 299.282, 302.154, 299.599, 330.056, 297.063, 356.532, 289.612, 370.483, 282.636, 382.057, 270.112, 388.081, 259.648, 392.679, 245.221, 395.849, 226.989, 395.863, 185.922, 391.266, 164.52, 381.913, 148.636, 362.889, 133.417, 344.657, 121.051, 327.059, 111.063, 306.291, 103.136, 292.974, 102.66, 277.913, 102.66, 264.913, 105.99, 241.347, 117.315, 222.323, 125.558, 203.457, 127.144, 182.371, 123.973, 157.322, 119.534, 132.908, 107.644, 108.651, 86.0827, 88.8301, 59.386, 82.6471, 48.764, 75.6715, 25.7761, 65.063, 10.562, 56.819, 3.7449, 48.5751, -0.852661, 35.2579, -3.07219, 20.8311, -3.38925, 7.35541, 1.36685) polygon = PackedVector2Array(-1.47594, 8.77969, -12.788, 19.9447, -17.7778, 31.2864, -19.2001, 41.1398, -19.2001, 55.4081, -16.3465, 66.9813, -15.7123, 75.8594, -14.9196, 82.6765, -12.383, 89.9692, -5.6736, 102.186, 2.88742, 115.027, 9.22891, 125.332, 14.7777, 133.893, 23.4973, 146.417, 35.7046, 159.893, 44.1071, 167.661, 55.8437, 178.18, 64.5632, 185.314, 69.7949, 189.753, 73.7584, 193.082, 80.734, 200.85, 94.5267, 212.899, 106.576, 221.46, 127.915, 233.827, 139.647, 240.802, 170.403, 256.181, 183.721, 262.839, 204.489, 271.717, 216.062, 274.571, 224.465, 279.485, 235.727, 283.429, 246.983, 289.929, 253.958, 290.88, 265.373, 296.27, 275.044, 298.965, 288.995, 299.282, 302.154, 299.599, 330.056, 297.063, 356.532, 289.612, 370.483, 282.636, 382.057, 270.112, 388.081, 259.648, 392.679, 245.221, 395.849, 226.989, 395.863, 185.922, 391.266, 164.52, 381.913, 148.636, 362.889, 133.417, 344.657, 121.051, 327.059, 111.063, 306.291, 103.136, 292.974, 102.66, 277.913, 102.66, 264.913, 105.99, 241.347, 117.315, 222.323, 125.558, 203.457, 127.144, 182.371, 123.973, 157.322, 119.534, 132.908, 107.644, 108.651, 86.0827, 88.8301, 59.386, 82.6471, 48.764, 75.6715, 25.7761, 65.063, 10.562, 56.819, 3.7449, 48.5751, -0.852661, 35.2579, -3.07219, 20.8311, -3.38925, 7.35541, 1.36685)
[node name="DebugTable" type="MeshInstance3D" parent="Course"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 150, 0, -400)
mesh = SubResource("BoxMesh_20p1k")
skeleton = NodePath("../..")
[node name="StaticBody3D" type="StaticBody3D" parent="Course/DebugTable"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Course/DebugTable/StaticBody3D"]
shape = SubResource("BoxShape3D_g31tw")
[node name="WaterTable" type="MeshInstance3D" parent="Course"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0)
mesh = SubResource("PlaneMesh_2ywhk")
skeleton = NodePath("../..")
[node name="BallZone" type="Area3D" parent="Course/WaterTable"]
script = ExtResource("9_jwlau")
water_hazard = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="Course/WaterTable/BallZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.2, 0)
shape = SubResource("BoxShape3D_x3wvm")
[node name="MacroWaterTable" type="MeshInstance3D" parent="Course"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -10, 0)
visible = false
mesh = SubResource("PlaneMesh_h0mhn")
skeleton = NodePath("../..")
[node name="Flag" parent="Course" instance=ExtResource("13_6jtao")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 540, 4, 452)
[node name="ShotSetup" parent="Course" instance=ExtResource("8_h44v5")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 212.717, 4, 294.073)
[node name="GuardRail" parent="." instance=ExtResource("16_xtxyj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 211.416, 4, 288.708)
curve = SubResource("Curve3D_3gyu3")

BIN
levels/debug_level/terrain_3d_storage.res (Stored with Git LFS)

Binary file not shown.

View File

@ -151,7 +151,6 @@ select_putter={
[physics] [physics]
3d/physics_engine="JoltPhysics3D" 3d/physics_engine="JoltPhysics3D"
3d/sleep_threshold_linear=0.1
3d/sleep_threshold_angular=2.0 3d/sleep_threshold_angular=2.0
jolt_3d/sleep/velocity_threshold=0.1 jolt_3d/sleep/velocity_threshold=0.1
jolt_3d/sleep/time_threshold=1.0 jolt_3d/sleep/time_threshold=1.0
@ -161,3 +160,5 @@ jolt_3d/limits/max_temporary_memory=64
textures/canvas_textures/default_texture_filter=0 textures/canvas_textures/default_texture_filter=0
anti_aliasing/quality/msaa_3d=3 anti_aliasing/quality/msaa_3d=3
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_debanding=true

View File

@ -169,7 +169,7 @@ bones/23/scale = Vector3(1, 1, 1)
visible = false visible = false
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"] [node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"]
transform = Transform3D(-0.944824, 0.316851, -0.0831417, -0.325647, -0.936013, 0.133541, -0.0355091, 0.153247, 0.98755, -0.1687, 3.15793, 0.845315) transform = Transform3D(-0.944824, 0.316851, -0.0831417, -0.326395, -0.932135, 0.156815, -0.027812, 0.1753, 0.984122, -0.1687, 3.13445, 0.86185)
bone_name = "Hand.R" bone_name = "Hand.R"
bone_idx = 11 bone_idx = 11

View File

@ -14,3 +14,4 @@ shape = SubResource("SphereShape3D_wmusx")
[node name="Camera3D" type="Camera3D" parent="."] [node name="Camera3D" type="Camera3D" parent="."]
current = true current = true
far = 8192.0

View File

@ -13,3 +13,4 @@ spring_length = 3.2
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3)
current = true current = true
far = 8192.0

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=40 format=3 uid="uid://cy7t2tc4y3b4"] [gd_scene load_steps=42 format=3 uid="uid://cy7t2tc4y3b4"]
[ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"] [ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"]
[ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/player/physics_ball/physics_ball.tscn" id="2_1i5j5"] [ext_resource type="PackedScene" uid="uid://dfttci386ohip" path="res://src/player/physics_ball/physics_ball.tscn" id="2_1i5j5"]
@ -7,6 +7,7 @@
[ext_resource type="PackedScene" uid="uid://445qd7m4qe2j" path="res://src/player/shot_setup/club_selector/club_selector.tscn" id="4_56ape"] [ext_resource type="PackedScene" uid="uid://445qd7m4qe2j" path="res://src/player/shot_setup/club_selector/club_selector.tscn" id="4_56ape"]
[ext_resource type="PackedScene" uid="uid://fht6j87o8ecr" path="res://src/ui/projectile_arc/projectile_arc.tscn" id="4_ry2ho"] [ext_resource type="PackedScene" uid="uid://fht6j87o8ecr" path="res://src/ui/projectile_arc/projectile_arc.tscn" id="4_ry2ho"]
[ext_resource type="PackedScene" uid="uid://dbdul15c4oblg" path="res://src/ui/projected_target.tscn" id="6_mynqj"] [ext_resource type="PackedScene" uid="uid://dbdul15c4oblg" path="res://src/ui/projected_target.tscn" id="6_mynqj"]
[ext_resource type="Shader" path="res://src/shaders/canvas_retro.gdshader" id="7_h6c4m"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lnol1"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lnol1"]
albedo_color = Color(0, 0.537255, 1, 1) albedo_color = Color(0, 0.537255, 1, 1)
@ -480,6 +481,15 @@ _data = {
"display": SubResource("Animation_g52q7") "display": SubResource("Animation_g52q7")
} }
[sub_resource type="ShaderMaterial" id="ShaderMaterial_afsun"]
shader = ExtResource("7_h6c4m")
shader_parameter/change_color_depth = true
shader_parameter/target_color_depth = 6
shader_parameter/dithering = true
shader_parameter/scale_resolution = true
shader_parameter/target_resolution_scale = 3
shader_parameter/enable_recolor = false
[sub_resource type="Animation" id="Animation_pk1s7"] [sub_resource type="Animation" id="Animation_pk1s7"]
length = 0.001 length = 0.001
tracks/0/type = "bezier" tracks/0/type = "bezier"
@ -712,6 +722,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6)
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 2.98023e-08, 0, -2.98023e-08, 1, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 2.98023e-08, 0, -2.98023e-08, 1, 0, 0, 0)
current = true current = true
far = 8192.0
[node name="ArrowPivot" type="Node3D" parent="."] [node name="ArrowPivot" type="Node3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
@ -851,6 +862,17 @@ libraries = {
"": SubResource("AnimationLibrary_gbnnr") "": SubResource("AnimationLibrary_gbnnr")
} }
[node name="ColorRect" type="ColorRect" parent="ShotUI"]
visible = false
material = SubResource("ShaderMaterial_afsun")
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="ShotGauges" type="Control" parent="ShotUI"] [node name="ShotGauges" type="Control" parent="ShotUI"]
layout_mode = 1 layout_mode = 1
anchor_left = 0.4 anchor_left = 0.4

View File

@ -0,0 +1,58 @@
@tool
extends Path3D
## Guard rail along a curve with nicely spaced posts
##
## Ref: https://www.youtube.com/watch?v=Gfpnxg-jne4
## Distance between railing posts, in meters
@export var post_space := 4.0:
set(value):
if value != post_space:
_dirty = true
post_space = value
## If enabled, always places a railing post at the end of the curve.
## Post spacing will be adjusted to accomodate.
@export var end_cap := false:
set(value):
if value != end_cap:
_dirty = true
end_cap = value
var _dirty := false
@onready var post_multi_mesh: MultiMeshInstance3D = $PostMultiMesh
func _ready() -> void:
post_multi_mesh.multimesh = post_multi_mesh.multimesh.duplicate()
func _update_multimesh() -> void:
if not curve:
post_multi_mesh.multimesh.instance_count = 0
return
var path_length := curve.get_baked_length()
var count: int = floor(path_length / post_space)
var spacing := post_space
if end_cap:
spacing = path_length / float(count)
count += 1
post_multi_mesh.multimesh.instance_count = count
for i in range(0, count):
var tx := curve.sample_baked_with_rotation(spacing * i, true, true)
post_multi_mesh.multimesh.set_instance_transform(i, tx)
func _process(_delta: float) -> void:
if _dirty:
_update_multimesh()
_dirty = false
func _on_curve_changed() -> void:
_dirty = true

View File

@ -0,0 +1,62 @@
[gd_scene load_steps=6 format=3 uid="uid://nqar1qcun8ax"]
[ext_resource type="Script" path="res://src/props/scenery/highway/guard_rail.gd" id="1_imntf"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_fo7j3"]
load_path = "res://.godot/imported/guard_rail_post.png-4447ff881a5916e5281ed251b7beecd0.ctex"
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_k1yjg"]
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
albedo_texture = SubResource("CompressedTexture2D_fo7j3")
texture_filter = 4
texture_repeat = false
billboard_mode = 2
[sub_resource type="PlaneMesh" id="PlaneMesh_ko4yv"]
material = SubResource("StandardMaterial3D_k1yjg")
size = Vector2(0.5, 1)
center_offset = Vector3(0, 0.5, 0)
orientation = 2
[sub_resource type="MultiMesh" id="MultiMesh_o7ch8"]
transform_format = 1
mesh = SubResource("PlaneMesh_ko4yv")
[node name="GuardRail" type="Path3D"]
script = ExtResource("1_imntf")
end_cap = true
[node name="UpperRail" type="CSGPolygon3D" parent="."]
use_collision = true
polygon = PackedVector2Array(0, 0.8, -0.01, 0.9, 0, 1, 0.01, 0.9)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_local = true
path_continuous_u = true
path_u_distance = 1.0
path_joined = false
[node name="LowerRail" type="CSGPolygon3D" parent="."]
use_collision = true
polygon = PackedVector2Array(0, 0.4, -0.01, 0.5, 0, 0.6, 0.01, 0.5)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_local = true
path_continuous_u = true
path_u_distance = 1.0
path_joined = false
[node name="PostMultiMesh" type="MultiMeshInstance3D" parent="."]
multimesh = SubResource("MultiMesh_o7ch8")
[connection signal="curve_changed" from="." to="." method="_on_curve_changed"]

View File

@ -0,0 +1,168 @@
// CanvasItem Retro Post-processing
// Adapted from https://godotshaders.com/shader/retro-post-processing/
shader_type canvas_item;
// Handles the resolution changes, color depth, and dithering
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
group_uniforms resolution_and_colors;
uniform bool change_color_depth = false;
uniform int target_color_depth : hint_range(1, 8) = 5;
uniform bool dithering = false;
uniform bool scale_resolution = false;
uniform int target_resolution_scale = 3;
// Handles the LUTish recoloring
group_uniforms gradient_recoloring;
uniform bool enable_recolor = false;
uniform sampler2D to_gradient: hint_default_black;
int dithering_pattern(ivec2 fragcoord) {
const int pattern[] = {
-4, +0, -3, +1,
+2, -2, +3, -1,
-3, +1, -4, +0,
+3, -1, +2, -2
};
int x = fragcoord.x % 4;
int y = fragcoord.y % 4;
return pattern[y * 4 + x];
}
vec3 rgb2hsv(vec3 rgb) { //Converts RGB values to HSV
float r = rgb.r;
float g = rgb.g;
float b = rgb.b;
float cmax = max(r,max(g,b));
float cmin = min(r,min(g,b));
float delta = cmax - cmin;
float h = 0.f; //hue
if (delta > 0.f){
if (cmax == r){
h = (g-b)/delta;
h = mod(h,6.f);
} else if (cmax == g){
h = ((b - r) / delta) + 2.f;
} else {
h = ((r-g)/delta) + 4.f;
}
h = h * 60.f;
}
float s = 0.f; //saturation
if (cmax > 0.f){
s = delta / cmax;
}
return vec3(h,s,cmax); // Keep original alpha value
}
vec3 hsv2rgb(vec3 hsv) { //Converts HSV values to RGB
float h = hsv.r;
float s = hsv.g;
float v = hsv.b;
float c = v * s;
//X = C × (1 - |(H / 60°) mod 2 - 1|)
float x = h / 60.f;
x = mod(x,2.f);
x = abs(x - 1.f);
x = c * (1.f - x);
float m = v - c;
vec3 rgb = vec3(0.f,0.f,0.f);
if (h < 60.f) {
rgb = vec3(c,x,0.f);
} else if (h < 120.f){
rgb = vec3(x,c,0.f);
} else if (h < 180.f){
rgb = vec3(0.f,c,x);
} else if (h < 240.f){
rgb = vec3(0.f,x,c);
} else if (h < 300.f){
rgb = vec3(x,0.f,c);
} else if (h < 360.f){
rgb = vec3(c,0.f,x);
}
rgb[0] = rgb[0] + m;
rgb[1] = rgb[1] + m;
rgb[2] = rgb[2] + m;
return rgb;
}
void fragment() {
vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE;
vec2 q = FRAGCOORD.xy / iResolution.xy;
ivec2 uv = ivec2(q);
vec3 color = texture(screen_texture, vec2(q.x,q.y) ).xyz;
if(scale_resolution){
uv = ivec2(FRAGCOORD.xy / float(target_resolution_scale));
color = texelFetch(screen_texture, uv * target_resolution_scale, 0).rgb;
} else {
uv = ivec2(FRAGCOORD.xy);
color = texelFetch(screen_texture, uv, 0).rgb;
}
if(enable_recolor){
vec3 hsv = rgb2hsv(color);
float color_pos = (hsv.x / 360.0);
vec3 new_color = texture(to_gradient, vec2((color_pos), 0.5)).rgb;
vec3 new_hsv = rgb2hsv(new_color);
hsv.x = new_hsv.x;
vec3 final_rgb = hsv2rgb(hsv);
color.rgb = final_rgb;
}
// Convert from [0.0, 1.0] range to [0, 255] range
ivec3 c = ivec3(round(color * 255.0));
// Apply the dithering pattern
if (dithering) {
c += ivec3(dithering_pattern(uv));
}
vec3 final_color;
if(change_color_depth){
// Truncate from 8 bits to color_depth bits
c >>= (8 - target_color_depth);
final_color = vec3(c) / float(1 << target_color_depth);
} else {
final_color = vec3(c) / float(1 << 8);
}
// Convert back to [0.0, 1.0] range
COLOR.rgb = final_color;
}

View File

@ -0,0 +1,143 @@
// Retro Post-Processing shader
// From https://godotshaders.com/shader/retro-post-processing/
shader_type canvas_item;
// Handles the resolution changes, color depth, and dithering
group_uniforms resolution_and_colors;
uniform bool change_color_depth = false;
uniform int target_color_depth : hint_range(1, 8) = 5;
uniform bool dithering = false;
uniform bool scale_resolution = false;
uniform int target_resolution_scale = 3;
// Handles the LUTish recoloring
group_uniforms gradient_recoloring;
uniform bool enable_recolor = false;
uniform sampler2D to_gradient: hint_default_black;
int dithering_pattern(ivec2 fragcoord) {
const int pattern[] = {
-4, +0, -3, +1,
+2, -2, +3, -1,
-3, +1, -4, +0,
+3, -1, +2, -2
};
int x = fragcoord.x % 4;
int y = fragcoord.y % 4;
return pattern[y * 4 + x];
}
vec3 rgb2hsv(vec3 rgb) { //Converts RGB values to HSV
float r = rgb.r;
float g = rgb.g;
float b = rgb.b;
float cmax = max(r,max(g,b));
float cmin = min(r,min(g,b));
float delta = cmax - cmin;
float h = 0.f; //hue
if (delta > 0.f){
if (cmax == r){
h = (g-b)/delta;
h = mod(h,6.f);
} else if (cmax == g){
h = ((b - r) / delta) + 2.f;
} else {
h = ((r-g)/delta) + 4.f;
}
h = h * 60.f;
}
float s = 0.f; //saturation
if (cmax > 0.f){
s = delta / cmax;
}
return vec3(h,s,cmax); // Keep original alpha value
}
vec3 hsv2rgb(vec3 hsv) { //Converts HSV values to RGB
float h = hsv.r;
float s = hsv.g;
float v = hsv.b;
float c = v * s;
//X = C × (1 - |(H / 60°) mod 2 - 1|)
float x = h / 60.f;
x = mod(x,2.f);
x = abs(x - 1.f);
x = c * (1.f - x);
float m = v - c;
vec3 rgb = vec3(0.f,0.f,0.f);
if (h < 60.f) {
rgb = vec3(c,x,0.f);
} else if (h < 120.f){
rgb = vec3(x,c,0.f);
} else if (h < 180.f){
rgb = vec3(0.f,c,x);
} else if (h < 240.f){
rgb = vec3(0.f,x,c);
} else if (h < 300.f){
rgb = vec3(x,0.f,c);
} else if (h < 360.f){
rgb = vec3(c,0.f,x);
}
rgb[0] = rgb[0] + m;
rgb[1] = rgb[1] + m;
rgb[2] = rgb[2] + m;
return rgb;
}
void fragment() {
ivec2 uv;
vec3 color;
if(scale_resolution){
uv = ivec2(FRAGCOORD.xy / float(target_resolution_scale));
color = texelFetch(TEXTURE, uv * target_resolution_scale, 0).rgb;
} else {
uv = ivec2(FRAGCOORD.xy);
color = texelFetch(TEXTURE, uv, 0).rgb;
}
if(enable_recolor){
vec3 hsv = rgb2hsv(color);
float color_pos = (hsv.x / 360.0);
vec3 new_color = texture(to_gradient, vec2((color_pos), 0.5)).rgb;
vec3 new_hsv = rgb2hsv(new_color);
hsv.x = new_hsv.x;
vec3 final_rgb = hsv2rgb(hsv);
color.rgb = final_rgb;
}
// Convert from [0.0, 1.0] range to [0, 255] range
ivec3 c = ivec3(round(color * 255.0));
// Apply the dithering pattern
if (dithering) {
c += ivec3(dithering_pattern(uv));
}
vec3 final_color;
if(change_color_depth){
// Truncate from 8 bits to color_depth bits
c >>= (8 - target_color_depth);
final_color = vec3(c) / float(1 << target_color_depth);
} else {
final_color = vec3(c) / float(1 << 8);
}
// Convert back to [0.0, 1.0] range
COLOR.rgb = final_color;
}

33
src/world/world.tscn Normal file
View File

@ -0,0 +1,33 @@
[gd_scene load_steps=4 format=3 uid="uid://cwnwcd8kushl3"]
[ext_resource type="Shader" path="res://src/shaders/retro_postprocessing.gdshader" id="1_3gv54"]
[ext_resource type="PackedScene" uid="uid://bm2o3mex10v11" path="res://levels/debug_level/debug_level.tscn" id="1_pge3b"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sc4r2"]
shader = ExtResource("1_3gv54")
shader_parameter/change_color_depth = true
shader_parameter/target_color_depth = 8
shader_parameter/dithering = true
shader_parameter/scale_resolution = true
shader_parameter/target_resolution_scale = 3
shader_parameter/enable_recolor = false
[node name="World" type="Node"]
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
material = SubResource("ShaderMaterial_sc4r2")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
stretch = true
[node name="SubViewport" type="SubViewport" parent="SubViewportContainer"]
handle_input_locally = false
size = Vector2i(1280, 720)
render_target_update_mode = 4
[node name="Level" type="Node3D" parent="SubViewportContainer/SubViewport"]
[node name="TestLevel" parent="SubViewportContainer/SubViewport/Level" instance=ExtResource("1_pge3b")]