Fixed Vignette (but still crashes GPU), fixed camera fov on zoom

unbroken
unfa 2021-05-22 18:52:29 +02:00
parent 860478b09c
commit 2ef705c4fd
6 changed files with 53 additions and 147 deletions

View File

@ -22,16 +22,39 @@
<filter <filter
inkscape:collect="always" inkscape:collect="always"
style="color-interpolation-filters:sRGB" style="color-interpolation-filters:sRGB"
id="filter1703" id="filter1509"
x="-0.26476598" x="-0.49932388"
width="1.529532" width="1.9986478"
y="-0.26476598" y="-0.49932388"
height="1.529532"> height="1.9986478">
<feGaussianBlur <feGaussianBlur
inkscape:collect="always" inkscape:collect="always"
stdDeviation="87.590765" stdDeviation="165.18799"
id="feGaussianBlur1705" /> id="feGaussianBlur1511" />
</filter> </filter>
<mask
maskUnits="userSpaceOnUse"
id="mask1517">
<g
id="g1523"
transform="matrix(3.7795276,0,0,3.7795276,-4294.4845,-4.57192e-5)">
<rect
style="opacity:1;fill:#ffffff;stroke-linecap:round;stroke-miterlimit:16;paint-order:markers stroke fill"
id="rect1519"
width="1920"
height="1080"
x="0"
y="0"
transform="matrix(0.26458333,0,0,0.26458333,1136.249,1.8e-6)" />
<circle
style="fill:#000000;stroke-linecap:round;stroke-miterlimit:16;paint-order:markers stroke fill;filter:url(#filter1509)"
id="circle1521"
cx="904.63379"
cy="547.9386"
transform="matrix(0.5253879,0,0,0.5253879,914.96538,-145.00531)"
r="396.98801" />
</g>
</mask>
</defs> </defs>
<sodipodi:namedview <sodipodi:namedview
id="base" id="base"
@ -40,9 +63,9 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="0.35" inkscape:zoom="0.24748737"
inkscape:cx="1042.4763" inkscape:cx="1507.5388"
inkscape:cy="593.68372" inkscape:cy="521.49705"
inkscape:document-units="mm" inkscape:document-units="mm"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
inkscape:document-rotation="0" inkscape:document-rotation="0"
@ -50,10 +73,12 @@
units="px" units="px"
inkscape:snap-page="true" inkscape:snap-page="true"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1051" inkscape:window-height="1006"
inkscape:window-x="1920" inkscape:window-x="0"
inkscape:window-y="0" inkscape:window-y="0"
inkscape:window-maximized="1" /> inkscape:window-maximized="1"
inkscape:pagecheckerboard="true"
borderlayer="true" />
<metadata <metadata
id="metadata853"> id="metadata853">
<rdf:RDF> <rdf:RDF>
@ -71,19 +96,13 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1">
<rect <rect
style="opacity:1;fill:#000000;stroke-linecap:round;stroke-miterlimit:16;paint-order:markers stroke fill" style="fill:#000000;stroke-linecap:round;stroke-miterlimit:16;paint-order:markers stroke fill"
id="rect1419" id="rect1419"
width="1920" width="1920"
height="1080" height="1080"
x="0" x="0"
y="0" y="0"
transform="scale(0.26458333)" /> transform="scale(0.26458333)"
<circle mask="url(#mask1517)" />
style="opacity:1;fill:#ffffff;stroke-linecap:round;stroke-miterlimit:16;paint-order:markers stroke fill;filter:url(#filter1703)"
id="path1421"
cx="904.63379"
cy="547.9386"
r="396.98801"
transform="matrix(0.65488695,0,0,0.65488695,-338.43286,-215.96284)" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -13,12 +13,12 @@ extends KinematicBody3D
@onready var vignette = hud.get_node("Vignette") @onready var vignette = hud.get_node("Vignette")
var base_fov = 90 var base_fov = 90
var view_zoom := 1.0 : var view_zoom := .0 :
set(zoom): set(zoom):
view_zoom = zoom view_zoom = zoom
camera.fov = base_fov / (zoom * 4) camera.fov = base_fov / ((zoom + 1) * 2)
crosshair.modulate.a = 1 - (zoom - 1) * 2 #crosshair.modulate.a = 1 - (zoom - 1) * 2
vignette.material["shader_param/Factor"] = zoom #vignette.modulate.a = zoom
var direction := Vector3.ZERO var direction := Vector3.ZERO
var accel := 0 var accel := 0
@ -82,14 +82,12 @@ func _input(event) -> void:
func _physics_process(delta): func _physics_process(delta):
direction = Vector3.ZERO direction = Vector3.ZERO
snap = Vector3.ZERO
if is_on_floor() and ground_check.is_colliding(): if is_on_floor() and ground_check.is_colliding():
#snap = -get_floor_normal() snap = -get_floor_normal()
medium = "ground" medium = "ground"
gravity_vec = Vector3.ZERO gravity_vec = Vector3.ZERO
else: else:
#snap = Vector3.DOWN snap = Vector3.DOWN
medium = "air" medium = "air"
gravity_vec += Vector3.DOWN * gravity * delta gravity_vec += Vector3.DOWN * gravity * delta

View File

@ -9,11 +9,3 @@ func hit():
func kill(): func kill():
aplayer.stop() aplayer.stop()
aplayer.play("Kill") aplayer.play("Kill")
#func hide():
# aplayer.stop()
# aplayer.play("Hide")
##
#func show():
# aplayer.stop()
# aplayer.play("Show")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://Assets/Characters/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://Assets/Characters/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/HUD/Crosshair.png" type="Texture2D" id=2] [ext_resource path="res://Assets/HUD/Crosshair.png" type="Texture2D" id=2]
@ -61,23 +61,6 @@ tracks/0/keys = {
} }
[sub_resource type="Animation" id=7] [sub_resource type="Animation" id=7]
resource_name = "Hide"
length = 0.2
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Crosshair:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.2 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[sub_resource type="Animation" id=8]
length = 0.2 length = 0.2
step = 0.05 step = 0.05
tracks/0/type = "value" tracks/0/type = "value"
@ -107,7 +90,7 @@ tracks/1/keys = {
"times": PackedFloat32Array( 0 ) "times": PackedFloat32Array( 0 )
} }
[sub_resource type="Animation" id=9] [sub_resource type="Animation" id=8]
length = 0.5 length = 0.5
step = 0.05 step = 0.05
tracks/0/type = "value" tracks/0/type = "value"
@ -137,90 +120,6 @@ tracks/1/keys = {
"times": PackedFloat32Array( 0 ) "times": PackedFloat32Array( 0 )
} }
[sub_resource type="Animation" id=10]
resource_name = "Show"
length = 0.2
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Crosshair:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.2 ),
"transitions": PackedFloat32Array( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
[sub_resource type="VisualShaderNodeFloatUniform" id=11]
default_input_values = [ ]
uniform_name = "Factor"
hint = 1
default_value_enabled = true
[sub_resource type="VisualShaderNodeInput" id=12]
output_port_for_preview = 0
default_input_values = [ ]
input_name = "color"
[sub_resource type="VisualShaderNodeMix" id=13]
default_input_values = [ 0, Vector3( 1, 1, 1 ), 1, Vector3( 1, 1, 1 ), 2, 0.5 ]
op_type = 2
[sub_resource type="VisualShader" id=14]
code = "shader_type canvas_item;
render_mode blend_mul;
uniform float Factor : hint_range(0, 1) = 0;
void vertex() {
// Output:0
}
void fragment() {
// Input:3
vec3 n_out3p0 = COLOR.rgb;
// FloatUniform:2
float n_out2p0 = Factor;
// Mix:4
vec3 n_in4p0 = vec3(1.00000, 1.00000, 1.00000);
vec3 n_out4p0 = mix(n_in4p0, n_out3p0, n_out2p0);
// Output:0
COLOR.rgb = n_out4p0;
}
void light() {
// Output:0
}
"
graph_offset = Vector2( -113, 35 )
version = "4.0"
mode = 1
modes/blend = 3
flags/light_only = false
nodes/fragment/0/position = Vector2( 400, 180 )
nodes/fragment/2/node = SubResource( 11 )
nodes/fragment/2/position = Vector2( -440, 300 )
nodes/fragment/3/node = SubResource( 12 )
nodes/fragment/3/position = Vector2( -400, 120 )
nodes/fragment/4/node = SubResource( 13 )
nodes/fragment/4/position = Vector2( 60, 180 )
nodes/fragment/connections = PackedInt32Array( 4, 0, 0, 0, 2, 0, 4, 2, 3, 0, 4, 1 )
[sub_resource type="ShaderMaterial" id=15]
shader = SubResource( 14 )
shader_param/Factor = 0.0
[node name="Game" type="Node3D"] [node name="Game" type="Node3D"]
script = null script = null
@ -291,10 +190,8 @@ __meta__ = {
[node name="AnimationPlayer" type="AnimationPlayer" parent="HUD/Crosshair"] [node name="AnimationPlayer" type="AnimationPlayer" parent="HUD/Crosshair"]
autoplay = "Default" autoplay = "Default"
anims/Default = SubResource( 6 ) anims/Default = SubResource( 6 )
anims/Hide = SubResource( 7 ) anims/Hit = SubResource( 7 )
anims/Hit = SubResource( 8 ) anims/Kill = SubResource( 8 )
anims/Kill = SubResource( 9 )
anims/Show = SubResource( 10 )
blend_times = [ ] blend_times = [ ]
script = null script = null
@ -303,7 +200,6 @@ stream = ExtResource( 6 )
script = null script = null
[node name="Vignette" type="TextureRect" parent="HUD"] [node name="Vignette" type="TextureRect" parent="HUD"]
material = SubResource( 15 )
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
texture = ExtResource( 8 ) texture = ExtResource( 8 )

View File

@ -58,7 +58,7 @@ trigger_secondary={
} }
view_zoom={ view_zoom={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777240,"physical_keycode":0,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":90,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
] ]
} }
move_special={ move_special={
@ -100,4 +100,5 @@ weapon_3={
global_illumination/sdfgi/probe_ray_count=2 global_illumination/sdfgi/probe_ray_count=2
global_illumination/sdfgi/frames_to_converge=0 global_illumination/sdfgi/frames_to_converge=0
global_illumination/sdfgi/frames_to_update_lights=4 global_illumination/sdfgi/frames_to_update_lights=4
anti_aliasing/quality/use_debanding=true
environment/defaults/default_environment="res://default_env.tres" environment/defaults/default_environment="res://default_env.tres"