dof update
This commit is contained in:
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dj212qfoybtsx"
|
||||
valid=false
|
||||
path="res://.godot/imported/ANIM_matador.blend-b1e70d45dbbcdad4cfd79f74415e6628.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/ANIM_matador.blend"
|
||||
dest_files=["res://.godot/imported/ANIM_matador.blend-b1e70d45dbbcdad4cfd79f74415e6628.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://fv7q2kiamni5"
|
||||
valid=false
|
||||
path="res://.godot/imported/ANIM_publik_mees.blend-d47f9b6736ce083865e1f16c01bc46f4.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/ANIM_publik_mees.blend"
|
||||
dest_files=["res://.godot/imported/ANIM_publik_mees.blend-d47f9b6736ce083865e1f16c01bc46f4.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b203q5pgrk5s3"
|
||||
valid=false
|
||||
path="res://.godot/imported/bull_v11.blend-0dd387f5e964c51fff069fa50a99986e.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/bull_v11.blend"
|
||||
dest_files=["res://.godot/imported/bull_v11.blend-0dd387f5e964c51fff069fa50a99986e.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://c6yhxdaba1nho"
|
||||
valid=false
|
||||
path="res://.godot/imported/matador_v01.blend-ca770df72393bcfc88aeadbf3f984fc9.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/matador_v01.blend"
|
||||
dest_files=["res://.godot/imported/matador_v01.blend-ca770df72393bcfc88aeadbf3f984fc9.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://cbkylf6ba2qmw"
|
||||
valid=false
|
||||
path="res://.godot/imported/matador_v02.blend-78c935c19487a89cf2e8e43e696513b9.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/matador_v02.blend"
|
||||
dest_files=["res://.godot/imported/matador_v02.blend-78c935c19487a89cf2e8e43e696513b9.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://cg23h1mns46i7"
|
||||
valid=false
|
||||
path="res://.godot/imported/matador_v03.blend-fcdb9cdf17fbb51f51c8fe59554f9d14.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/matador_v03.blend"
|
||||
dest_files=["res://.godot/imported/matador_v03.blend-fcdb9cdf17fbb51f51c8fe59554f9d14.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://ce8p5ywum87oj"
|
||||
valid=false
|
||||
path="res://.godot/imported/publik_mees_v01.blend-bd82e3b38f4d34ceacdfaddc95016c7b.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Blender/publik_mees_v01.blend"
|
||||
dest_files=["res://.godot/imported/publik_mees_v01.blend-bd82e3b38f4d34ceacdfaddc95016c7b.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
+42
-31
@@ -4,14 +4,14 @@ extends Camera3D
|
||||
@export var horizontal_distance: float = 28.0
|
||||
@export var horizontal_angle_deg: float = 45.0
|
||||
|
||||
# --- PERSPECTIVE ZOOM SETTINGS ---
|
||||
@export var fov_min: float = 15.0 # Maximum zoom in (narrow FOV)
|
||||
@export var fov_max: float = 60.0 # Maximum zoom out (wide FOV)
|
||||
@export var default_fov: float = 35.0
|
||||
# --- ORTHOGRAPHIC ZOOM SETTINGS ---
|
||||
@export var size_min: float = 5.0 # Maximum zoom in (small frame size)
|
||||
@export var size_max: float = 30.0 # Maximum zoom out (large frame size)
|
||||
@export var default_size: float = 15.0
|
||||
|
||||
# --- TILT-SHIFT DOF SETTINGS ---
|
||||
@export var focus_slice_thickness: float = 2.0 # Total thickness (in meters) of what stays sharp
|
||||
@export var blur_transition: float = 2.0 # How fast it transitions into full blur
|
||||
@export var focus_slice_thickness: float = 6.0
|
||||
@export var blur_transition: float = 15.0
|
||||
|
||||
const _FLASH_DURATION: float = 0.30
|
||||
|
||||
@@ -19,17 +19,17 @@ var _shake_amount: float = 0.0
|
||||
var _shake_decay: float = 0.0
|
||||
var _flash_timer: float = 0.0
|
||||
var _flash_rect: ColorRect = null
|
||||
var _target_fov: float = 0.0
|
||||
var _target_size: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_as_top_level(true)
|
||||
projection = PROJECTION_PERSPECTIVE # Changed to perspective
|
||||
_target_fov = default_fov
|
||||
fov = default_fov
|
||||
projection = Camera3D.PROJECTION_ORTHOGONAL # Switched to orthographic
|
||||
_target_size = default_size
|
||||
size = default_size
|
||||
|
||||
near = 0.1
|
||||
far = 150.0 # Tight far plane to ensure depth buffer precision for DoF
|
||||
far = 150.0
|
||||
|
||||
_setup_flash()
|
||||
|
||||
@@ -46,15 +46,15 @@ func _setup_flash() -> void:
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
# Zoom inputs now scale the Field of View (FOV)
|
||||
# Zoom inputs now scale the Orthographic Size property
|
||||
if event.is_action_pressed("zoom_in"):
|
||||
_target_fov = clamp(_target_fov / 1.2, fov_min, fov_max)
|
||||
_target_size = clamp(_target_size / 1.2, size_min, size_max)
|
||||
if event.is_action_pressed("zoom_out"):
|
||||
_target_fov = clamp(_target_fov * 1.2, fov_min, fov_max)
|
||||
_target_size = clamp(_target_size * 1.2, size_min, size_max)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
fov = lerpf(fov, _target_fov, delta * 10.0)
|
||||
size = lerpf(size, _target_size, delta * 10.0)
|
||||
|
||||
var angle_rad := deg_to_rad(horizontal_angle_deg)
|
||||
var offset := Vector3(
|
||||
@@ -67,7 +67,7 @@ func _process(delta: float) -> void:
|
||||
look_at(target.global_position, Vector3.UP)
|
||||
|
||||
# --- DYNAMIC TILT SHIFT CALCULATION ---
|
||||
_update_tilt_shift_dof(target.global_position)
|
||||
_update_ortho_tilt_shift_dof(target.global_position)
|
||||
|
||||
if _shake_amount > 0.005:
|
||||
global_position += Vector3(
|
||||
@@ -90,8 +90,7 @@ func trigger_hit(strength: float) -> void:
|
||||
_flash_timer = _FLASH_DURATION
|
||||
|
||||
|
||||
func _update_tilt_shift_dof(target_pos: Vector3) -> void:
|
||||
# Make sure the camera has a practical attributes resource assigned
|
||||
func _update_ortho_tilt_shift_dof(target_pos: Vector3) -> void:
|
||||
var cam_attr: CameraAttributesPractical = null
|
||||
|
||||
if "attributes" in self and self.attributes is CameraAttributesPractical:
|
||||
@@ -100,20 +99,32 @@ func _update_tilt_shift_dof(target_pos: Vector3) -> void:
|
||||
cam_attr = self.camera_attributes
|
||||
|
||||
if cam_attr != null:
|
||||
# 1. Find exact distance from camera lens to your target
|
||||
var target_distance := global_position.distance_to(target_pos)
|
||||
# 1. Project distance onto the camera's true forward forward axis
|
||||
var to_target := target_pos - global_position
|
||||
var forward_vector := -global_transform.basis.z
|
||||
var ortho_depth := to_target.dot(forward_vector)
|
||||
|
||||
# 2. Scale the focus depth based on FOV zoom level so the blur stays consistent
|
||||
var zoom_factor := default_fov / fov
|
||||
# 2. Extract the dynamic zoom multiplier
|
||||
var zoom_factor := size / default_size
|
||||
var dynamic_slice := focus_slice_thickness * zoom_factor
|
||||
var dynamic_transition := blur_transition * zoom_factor
|
||||
var half_slice := dynamic_slice * 0.5
|
||||
|
||||
# 3. Apply the sharp "slice" directly around the target distance
|
||||
cam_attr.dof_blur_far_distance = target_distance + (dynamic_slice * 0.5)
|
||||
cam_attr.dof_blur_near_distance = target_distance - (dynamic_slice * 0.5)
|
||||
# Base transition modified by the zoom state
|
||||
var base_transition := blur_transition * zoom_factor
|
||||
|
||||
# 3. Apply the focal zones
|
||||
cam_attr.dof_blur_far_distance = ortho_depth + half_slice
|
||||
cam_attr.dof_blur_near_distance = maxf(near + 0.1, ortho_depth - half_slice)
|
||||
|
||||
# 4. ASYMMETRICAL CORRECTION FOR GODOT 4.7 FORWARD+
|
||||
# Far transition needs a massive punch to actually manifest on screen
|
||||
cam_attr.dof_blur_far_transition = maxf(0.1, base_transition * 0.5)
|
||||
|
||||
# Near transition needs to be greatly expanded (larger number = gentler slope)
|
||||
# to stop it from snapping into massive instant blur
|
||||
cam_attr.dof_blur_near_transition = maxf(1.0, base_transition * 1.5)
|
||||
|
||||
# 5. Keep both enabled
|
||||
cam_attr.dof_blur_far_enabled = false
|
||||
cam_attr.dof_blur_near_enabled = false
|
||||
|
||||
# 4. Apply transitions and force execution
|
||||
cam_attr.dof_blur_far_transition = dynamic_transition
|
||||
cam_attr.dof_blur_near_transition = dynamic_transition
|
||||
cam_attr.dof_blur_far_enabled = true
|
||||
cam_attr.dof_blur_near_enabled = true
|
||||
|
||||
+3
-6
@@ -6,7 +6,7 @@
|
||||
[ext_resource type="Shader" uid="uid://d3xyyy5bh0ma" path="res://ps1_filter.gdshader" id="4_ps1shader"]
|
||||
[ext_resource type="PackedScene" uid="uid://cmxqocsdbgufr" path="res://Animations/mees_plaksutab.glb" id="5_m7jmp"]
|
||||
[ext_resource type="PackedScene" uid="uid://1y07gn65ktsi" path="res://Animations/ANIM_publik_mees.glb" id="7_xlvrw"]
|
||||
[ext_resource type="Script" uid="uid://dqjxlvnoa7vdw" path="res://Animations/anim_publik_mees.gd" id="8_73fnb"]
|
||||
[ext_resource type="Script" uid="uid://dr6phggarm73e" path="res://Animations/anim_publik_mees.gd" id="8_73fnb"]
|
||||
[ext_resource type="Script" uid="uid://di0jafakftp3n" path="res://publikum_controller.gd" id="9_pubctrl"]
|
||||
[ext_resource type="Script" uid="uid://xu6osmd62rj2" path="res://hud.gd" id="10_hud"]
|
||||
|
||||
@@ -56,7 +56,7 @@ shape = SubResource("BoxShape3D_ulcgi")
|
||||
|
||||
[node name="arena_placeholder_v01" parent="Node3D" unique_id=1341659233 instance=ExtResource("2_nxogm")]
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Node3D/arena_placeholder_v01/Wall/StaticBody3D" parent_id_path=PackedInt32Array(1341659233, 739843906) index="0" unique_id=1881819927]
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="Node3D/arena_placeholder_v01/Wall/StaticBody3D" parent_id_path=PackedInt32Array(1341659233, 1793167121) index="0" unique_id=1881819927]
|
||||
transform = Transform3D(0.9999999, 0, 0, 0, 0.9999999, 0, 0, 0, 0.9999999, -1.3237867, -1.2018226, -7.163421e-08)
|
||||
shape = SubResource("ConcavePolygonShape3D_b1ung")
|
||||
|
||||
@@ -68,7 +68,6 @@ script = ExtResource("10_hud")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1032421313]
|
||||
layer = 10
|
||||
visible = false
|
||||
|
||||
[node name="PS1Filter" type="ColorRect" parent="CanvasLayer" unique_id=1449116873]
|
||||
material = SubResource("ShaderMaterial_ps1")
|
||||
@@ -82,12 +81,12 @@ grow_vertical = 2
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="Lights" unique_id=818712731]
|
||||
transform = Transform3D(0.0153599195, 0.5682554, -0.82270896, 0.16280845, 0.810404, 0.5627957, 0.9865381, -0.1425885, -0.08006904, -4.08134, 0.3070748, 0.97087634)
|
||||
light_energy = 0.4
|
||||
light_indirect_energy = 0.767
|
||||
shadow_blur = 0.47
|
||||
|
||||
[node name="SpotLight3D2" type="SpotLight3D" parent="Lights" unique_id=918477294]
|
||||
transform = Transform3D(0.904133, 0.30962405, -0.2944087, 0.3084627, 0.0037425563, 0.9512291, 0.2956252, -0.95085174, -0.0921237, -5.954, 14.477, -4.756)
|
||||
visible = false
|
||||
light_energy = 13.695
|
||||
shadow_enabled = true
|
||||
distance_fade_enabled = true
|
||||
@@ -95,13 +94,11 @@ spot_range = 32.90586
|
||||
|
||||
[node name="SpotLight3D" type="SpotLight3D" parent="Lights" unique_id=422808558]
|
||||
transform = Transform3D(0.9763736, -9.445564e-09, 0.21608931, -0.20963383, 0.24260214, 0.9472053, -0.052423734, -0.9701259, 0.23687032, 4.0400305, 13.463301, 3.9410677)
|
||||
visible = false
|
||||
light_energy = 13.695
|
||||
shadow_enabled = true
|
||||
spot_range = 32.90586
|
||||
|
||||
[node name="PublikNode" type="Node3D" parent="." unique_id=1020007445]
|
||||
visible = false
|
||||
|
||||
[node name="publikum2" type="Node3D" parent="PublikNode" unique_id=813507078]
|
||||
transform = Transform3D(-0.91522944, 0, -0.4029331, 0, 1, 0, 0.4029331, 0, -0.91522944, 4.195425, 3.6553268, 13.885913)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user