diff --git a/VERSIONS.md b/VERSIONS.md index 78ef2029..914fbeb8 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -5,6 +5,7 @@ - Cleaned up StartXR - Allow grab-points and poses to work with different types of hand trackers - Add end_xr support to StartXR +- Fixed vignette shader # 4.3.3 - Fix Viewport2Din3D property forwarding diff --git a/addons/godot-xr-tools/effects/vignette.gdshader b/addons/godot-xr-tools/effects/vignette.gdshader index 1309301e..0b3f0d3f 100644 --- a/addons/godot-xr-tools/effects/vignette.gdshader +++ b/addons/godot-xr-tools/effects/vignette.gdshader @@ -8,7 +8,7 @@ uniform float fade = 0.05; varying float dist; void vertex() { - vec3 v = VERTEX; + vec2 v = VERTEX.xy; dist = length(v); // outer ring is 2.0, inner ring is 1.0, so this scales purely the inner ring @@ -21,11 +21,11 @@ void vertex() { vec4 eye = PROJECTION_MATRIX * vec4(0.0, 0.0, 100.0, 1.0); // and we offset our inner circle - v.xy += eye.xy / eye.z; + v += eye.xy / eye.w; } - - // looks like this is broken in Godot 4... - POSITION = vec4(v, 1.0); + + float z = PROJECTION_MATRIX[2][2] < 0.0 ? 0.0 : 1.0; + POSITION = vec4(v, z, 1.0); } void fragment() { diff --git a/addons/godot-xr-tools/effects/vignette.tres b/addons/godot-xr-tools/effects/vignette.tres index 0acb398d..632d344b 100644 --- a/addons/godot-xr-tools/effects/vignette.tres +++ b/addons/godot-xr-tools/effects/vignette.tres @@ -3,8 +3,8 @@ [ext_resource type="Shader" path="res://addons/godot-xr-tools/effects/vignette.gdshader" id="1_x02h0"] [resource] -render_priority = 0 +render_priority = 99 shader = ExtResource("1_x02h0") shader_parameter/color = Color(0, 0, 0, 1) -shader_parameter/radius = 0.2 +shader_parameter/radius = 0.282843 shader_parameter/fade = 0.05 diff --git a/scenes/main_menu/main_menu_level.tscn b/scenes/main_menu/main_menu_level.tscn index 5252b6a4..a4dfa4da 100644 --- a/scenes/main_menu/main_menu_level.tscn +++ b/scenes/main_menu/main_menu_level.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=52 format=3 uid="uid://037lluf8eoy6"] +[gd_scene load_steps=53 format=3 uid="uid://037lluf8eoy6"] [ext_resource type="PackedScene" uid="uid://qbmx03iibuuu" path="res://addons/godot-xr-tools/staging/scene_base.tscn" id="1"] [ext_resource type="Script" path="res://scenes/main_menu/main_menu_level.gd" id="2_taoax"] @@ -6,6 +6,7 @@ [ext_resource type="PackedScene" uid="uid://bjcxf427un2wp" path="res://addons/godot-xr-tools/player/poke/poke.tscn" id="4_eoo0b"] [ext_resource type="PackedScene" uid="uid://42xbeno6pt3y" path="res://addons/godot-xr-tools/desktop-support/function_desktop_pointer.tscn" id="4_ru24x"] [ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="5"] +[ext_resource type="PackedScene" uid="uid://cc6ngdqie8o8c" path="res://addons/godot-xr-tools/effects/vignette.tscn" id="5_wwfro"] [ext_resource type="PackedScene" uid="uid://bft3xyxs31ci3" path="res://addons/godot-xr-tools/functions/function_pose_detector.tscn" id="5_xgcrx"] [ext_resource type="PackedScene" uid="uid://bl2nuu3qhlb5k" path="res://addons/godot-xr-tools/functions/movement_direct.tscn" id="6"] [ext_resource type="PackedScene" uid="uid://bwr0eqi231lf0" path="res://assets/meshes/control_pad/control_pad_location_left.tscn" id="7_kl172"] @@ -40,65 +41,65 @@ [ext_resource type="Texture2D" uid="uid://cr1l4g7btdyht" path="res://scenes/origin_gravity_demo/origin_gravity_demo.png" id="32_c4n1q"] [ext_resource type="Texture2D" uid="uid://dhd30j0xpcxoi" path="res://scenes/sphere_world_demo/sphere_world_demo.png" id="34_xw8ig"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kw8yq"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_sj2ko"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1sb84"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6aaih"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_38yrq"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_brcrv"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_70ibd"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_248ms"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_wd8f5"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_2gkw7"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_3y2lf"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_mh5hs"] graph_offset = Vector2(-536, 11) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_kw8yq") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_sj2ko") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_1sb84") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_6aaih") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_38yrq") +nodes/Grip/node = SubResource("AnimationNodeBlend2_brcrv") nodes/Grip/position = Vector2(0, 20) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_70ibd") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_248ms") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_wd8f5") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_2gkw7") nodes/Trigger/position = Vector2(-360, 20) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_rnsn8"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_s4vic"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7v0g3"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_70e5h"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_mybsn"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_6pk6s"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7wp03"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_85bwh"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_yletx"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_uijff"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_w2u6w"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_nh6hc"] graph_offset = Vector2(-552.664, 107.301) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_rnsn8") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_s4vic") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_7v0g3") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_70e5h") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_mybsn") +nodes/Grip/node = SubResource("AnimationNodeBlend2_6pk6s") nodes/Grip/position = Vector2(0, 40) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_7wp03") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_85bwh") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_yletx") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_uijff") nodes/Trigger/position = Vector2(-360, 40) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] @@ -109,6 +110,9 @@ script = ExtResource("2_taoax") [node name="FunctionDesktopPointer" parent="XROrigin3D/XRCamera3D" index="1" instance=ExtResource("4_ru24x")] +[node name="Vignette" parent="XROrigin3D/XRCamera3D" index="2" instance=ExtResource("5_wwfro")] +auto_inner_radius = 0.5 + [node name="LeftHand" parent="XROrigin3D/LeftHand" index="0" instance=ExtResource("23_pr05t")] [node name="Skeleton3D" parent="XROrigin3D/LeftHand/LeftHand/Hand_low_L/Armature" index="0"] @@ -142,7 +146,7 @@ transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) [node name="AnimationTree" parent="XROrigin3D/LeftHand/LeftHand" index="1"] root_node = NodePath("../Hand_low_L") -tree_root = SubResource("AnimationNodeBlendTree_3y2lf") +tree_root = SubResource("AnimationNodeBlendTree_mh5hs") [node name="FunctionPoseDetector" parent="XROrigin3D/LeftHand" index="1" instance=ExtResource("5_xgcrx")] @@ -189,7 +193,7 @@ transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) [node name="AnimationTree" parent="XROrigin3D/RightHand/RightHand" index="1"] root_node = NodePath("../Hand_low_R") -tree_root = SubResource("AnimationNodeBlendTree_w2u6w") +tree_root = SubResource("AnimationNodeBlendTree_nh6hc") [node name="FunctionPoseDetector" parent="XROrigin3D/RightHand" index="1" instance=ExtResource("5_xgcrx")]