feat(rendering): add cinematic post processing

This commit is contained in:
Josh Creek
2026-08-07 22:54:01 +01:00
parent 0a7eb0b742
commit 8fa40769a8
5 changed files with 91 additions and 3 deletions
+19 -1
View File
@@ -36,6 +36,7 @@ var target: Ship:
var ball_cam_enabled := true
@onready var camera: Camera3D = $Camera3D
@onready var post_material: ShaderMaterial = $PostProcess/PostFX.material as ShaderMaterial
var _ball: Node3D
# Smoothed horizontal direction from ball to ship; the ball-cam orbits along
@@ -43,6 +44,7 @@ var _ball: Node3D
# raw position (which whips when ball and ship are close together).
var _orbit_dir := Vector3.BACK
var _turbo_blend := 0.0
var _speed_blend := 0.0
var _effective_distance := 8.0
var _shake_strength := 0.0
var _shake_noise := FastNoiseLite.new()
@@ -175,11 +177,17 @@ func _update_speed_feel(delta: float) -> void:
var feel_t := 1.0 - exp(-feel_smoothing * delta)
var turbo_target := 1.0 if target.is_turbo_active() else 0.0
_turbo_blend = lerpf(_turbo_blend, turbo_target, feel_t)
var target_fov := base_fov + target.get_speed_ratio() * speed_fov_add + _turbo_blend * turbo_fov_kick
_speed_blend = lerpf(_speed_blend, target.get_speed_ratio(), feel_t)
var target_fov := base_fov + _speed_blend * speed_fov_add + _turbo_blend * turbo_fov_kick
camera.fov = lerpf(camera.fov, target_fov, feel_t)
_effective_distance = lerpf(
_effective_distance, camera_distance + _turbo_blend * turbo_distance_kick, feel_t
)
post_material.set_shader_parameter(
"motion_blur_amount", _speed_blend * _speed_blend * 0.006 + _turbo_blend * 0.006
)
post_material.set_shader_parameter("chromatic_aberration", _turbo_blend * 0.007)
post_material.set_shader_parameter("vignette_strength", 0.22 + _turbo_blend * 0.16)
func _on_target_ball_contact(intensity: float, _world_position: Vector3) -> void:
@@ -224,7 +232,17 @@ func begin_goal_cut(goal_position: Vector3) -> void:
camera.global_position = _goal_cut_position
camera.fov = 58.0
camera.look_at(_goal_cut_look_at, Vector3.UP)
# A hard, stationary cinematic camera must not inherit the scoring frame's
# ship-speed smear or turbo chroma. Keep only a deliberate cinematic edge.
post_material.set_shader_parameter("motion_blur_amount", 0.0)
post_material.set_shader_parameter("chromatic_aberration", 0.0)
post_material.set_shader_parameter("vignette_strength", 0.3)
func end_goal_cut() -> void:
_goal_cut_active = false
_speed_blend = 0.0
_turbo_blend = 0.0
post_material.set_shader_parameter("motion_blur_amount", 0.0)
post_material.set_shader_parameter("chromatic_aberration", 0.0)
post_material.set_shader_parameter("vignette_strength", 0.22)