Improvement: tooltips, defaults, and framerate independence
This commit is contained in:
parent
10795c4cae
commit
d6826a0950
6 changed files with 76 additions and 25 deletions
|
|
@ -33,11 +33,11 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://b62ieebpxbuin" path="res://Scenes/Section03/S3B1.tscn" id="16_m1vvn"]
|
[ext_resource type="PackedScene" uid="uid://b62ieebpxbuin" path="res://Scenes/Section03/S3B1.tscn" id="16_m1vvn"]
|
||||||
[ext_resource type="PackedScene" uid="uid://q5n4wbhxihjp" path="res://Scenes/Section03/S3B2.tscn" id="17_4e0xd"]
|
[ext_resource type="PackedScene" uid="uid://q5n4wbhxihjp" path="res://Scenes/Section03/S3B2.tscn" id="17_4e0xd"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ncj04jk76gn0" path="res://Scenes/Section02/Bistro_StringLights.tscn" id="17_j1o0m"]
|
[ext_resource type="PackedScene" uid="uid://ncj04jk76gn0" path="res://Scenes/Section02/Bistro_StringLights.tscn" id="17_j1o0m"]
|
||||||
[ext_resource type="RDShaderFile" uid="uid://qn4j1e6qpbjn" path="res://MyJumpFloodIteration/jump_flood_blur.glsl" id="17_lj2u4"]
|
[ext_resource type="RDShaderFile" uid="uid://b02ng0mepo13k" path="res://MyJumpFloodIteration/jump_flood_blur.glsl" id="17_lj2u4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://chlhxyb30n5bj" path="res://Scenes/Section03/S3B3.tscn" id="18_4ij38"]
|
[ext_resource type="PackedScene" uid="uid://chlhxyb30n5bj" path="res://Scenes/Section03/S3B3.tscn" id="18_4ij38"]
|
||||||
[ext_resource type="AudioStream" uid="uid://b6rc81y5wriln" path="res://Audio/day_bg.ogg" id="18_kwmnc"]
|
[ext_resource type="AudioStream" uid="uid://b6rc81y5wriln" path="res://Audio/day_bg.ogg" id="18_kwmnc"]
|
||||||
[ext_resource type="RDShaderFile" uid="uid://3fotynjh5y7g" path="res://MyJumpFloodIteration/jfp_backtracking_experimental.glsl" id="18_opepq"]
|
[ext_resource type="RDShaderFile" uid="uid://ei3ro3axdl8y" path="res://MyJumpFloodIteration/jfp_backtracking_experimental.glsl" id="18_opepq"]
|
||||||
[ext_resource type="RDShaderFile" uid="uid://b5t02et6687be" path="res://MyJumpFloodIteration/jump_flood_overlay.glsl" id="19_7g3lb"]
|
[ext_resource type="RDShaderFile" uid="uid://bc2dlayo43x06" path="res://MyJumpFloodIteration/jump_flood_overlay.glsl" id="19_7g3lb"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cou4bgmlcrc2" path="res://Scenes/Section03/S3B4.tscn" id="19_acyb5"]
|
[ext_resource type="PackedScene" uid="uid://cou4bgmlcrc2" path="res://Scenes/Section03/S3B4.tscn" id="19_acyb5"]
|
||||||
[ext_resource type="AudioStream" uid="uid://cngxal8rdb5mj" path="res://Audio/night_bg.ogg" id="19_ida67"]
|
[ext_resource type="AudioStream" uid="uid://cngxal8rdb5mj" path="res://Audio/night_bg.ogg" id="19_ida67"]
|
||||||
[ext_resource type="Script" path="res://MyJumpFloodIteration/jump_flood_blur.gd" id="20_0qnwf"]
|
[ext_resource type="Script" path="res://MyJumpFloodIteration/jump_flood_blur.gd" id="20_0qnwf"]
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
[ext_resource type="Script" path="res://Scripts/FoliageArea.gd" id="75_mt554"]
|
[ext_resource type="Script" path="res://Scripts/FoliageArea.gd" id="75_mt554"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dph2jwqw0jaw" path="res://Scenes/FoliageSound.tscn" id="76_oe8ap"]
|
[ext_resource type="PackedScene" uid="uid://dph2jwqw0jaw" path="res://Scenes/FoliageSound.tscn" id="76_oe8ap"]
|
||||||
|
|
||||||
[sub_resource type="CompositorEffect" id="CompositorEffect_tx25r"]
|
[sub_resource type="CompositorEffect" id="CompositorEffect_d3aqs"]
|
||||||
resource_local_to_scene = false
|
resource_local_to_scene = false
|
||||||
resource_name = ""
|
resource_name = ""
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
@ -97,12 +97,15 @@ overlay_shader_file = ExtResource("19_7g3lb")
|
||||||
construction_pass = ExtResource("18_opepq")
|
construction_pass = ExtResource("18_opepq")
|
||||||
perpen_error_threshold = 0.3
|
perpen_error_threshold = 0.3
|
||||||
sample_step_multiplier = 8.0
|
sample_step_multiplier = 8.0
|
||||||
backtracking_velocity_match_threshold = 0.5
|
backtracking_velocity_match_threshold = 0.49
|
||||||
backtracking_velocity_match_parallel_sensitivity = 1.0
|
backtracking_velocity_match_parallel_sensitivity = 0.5
|
||||||
backtracking_velcoity_match_perpendicular_sensitivity = 0.2
|
backtracking_velcoity_match_perpendicular_sensitivity = 0.1
|
||||||
|
JFA_pass_count = 3
|
||||||
|
framerate_independent = true
|
||||||
|
target_constant_framerate = 30.0
|
||||||
|
|
||||||
[sub_resource type="Compositor" id="Compositor_ak7ke"]
|
[sub_resource type="Compositor" id="Compositor_ak7ke"]
|
||||||
compositor_effects = Array[CompositorEffect]([SubResource("CompositorEffect_tx25r")])
|
compositor_effects = Array[CompositorEffect]([SubResource("CompositorEffect_d3aqs")])
|
||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_u4h6w"]
|
[sub_resource type="BoxMesh" id="BoxMesh_u4h6w"]
|
||||||
size = Vector3(42.825, 3, 85.35)
|
size = Vector3(42.825, 3, 85.35)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@ var all_fps : Array[int] = [
|
||||||
|
|
||||||
var fps_index : int = 0
|
var fps_index : int = 0
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var motion_blur_effect = compositor.compositor_effects[0]
|
||||||
|
|
||||||
|
iteration_count = motion_blur_effect.JFA_pass_count
|
||||||
|
$"../Control/VBoxContainer/HBoxContainer/iteration_count".text = str(iteration_count)
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
#if Input.is_action_just_pressed("SPACE"):
|
#if Input.is_action_just_pressed("SPACE"):
|
||||||
#compositor.compositor_effects[0].enabled = !compositor.compositor_effects[0].enabled
|
#compositor.compositor_effects[0].enabled = !compositor.compositor_effects[0].enabled
|
||||||
|
|
@ -27,14 +33,14 @@ func _input(event: InputEvent) -> void:
|
||||||
iteration_count -= 1
|
iteration_count -= 1
|
||||||
iteration_count = clamp(iteration_count, 1, 11)
|
iteration_count = clamp(iteration_count, 1, 11)
|
||||||
|
|
||||||
motion_blur_effect.iteration_count = iteration_count
|
motion_blur_effect.JFA_pass_count = iteration_count
|
||||||
$"../Control/VBoxContainer/HBoxContainer/iteration_count".text = str(iteration_count)
|
$"../Control/VBoxContainer/HBoxContainer/iteration_count".text = str(iteration_count)
|
||||||
|
|
||||||
if Input.is_action_just_pressed("right"):
|
if Input.is_action_just_pressed("right"):
|
||||||
iteration_count += 1
|
iteration_count += 1
|
||||||
iteration_count = clamp(iteration_count, 1, 11)
|
iteration_count = clamp(iteration_count, 1, 11)
|
||||||
|
|
||||||
motion_blur_effect.iteration_count = iteration_count
|
motion_blur_effect.JFA_pass_count = iteration_count
|
||||||
$"../Control/VBoxContainer/HBoxContainer/iteration_count".text = str(iteration_count)
|
$"../Control/VBoxContainer/HBoxContainer/iteration_count".text = str(iteration_count)
|
||||||
|
|
||||||
if Input.is_action_just_pressed("SPACE"):
|
if Input.is_action_just_pressed("SPACE"):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
importer="glsl"
|
importer="glsl"
|
||||||
type="RDShaderFile"
|
type="RDShaderFile"
|
||||||
uid="uid://3fotynjh5y7g"
|
uid="uid://ei3ro3axdl8y"
|
||||||
path="res://.godot/imported/jfp_backtracking_experimental.glsl-d67307f6899fed647164be410a7debc8.res"
|
path="res://.godot/imported/jfp_backtracking_experimental.glsl-d67307f6899fed647164be410a7debc8.res"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ class_name MotionBlurSphynxJumpFlood
|
||||||
# diminishing returns over 16
|
# diminishing returns over 16
|
||||||
@export_range(4, 64) var motion_blur_samples: int = 8
|
@export_range(4, 64) var motion_blur_samples: int = 8
|
||||||
# you really don't want this over 0.5, but you can if you want to try
|
# you really don't want this over 0.5, but you can if you want to try
|
||||||
@export_range(0, 0.5, 0.001, "or_greater") var motion_blur_intensity: float = 0.25
|
@export_range(0, 0.5, 0.001, "or_greater") var motion_blur_intensity: float = 1
|
||||||
@export_range(0, 1) var motion_blur_center_fade: float = 0.0
|
@export_range(0, 1) var motion_blur_center_fade: float = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24,12 +24,38 @@ class_name MotionBlurSphynxJumpFlood
|
||||||
construction_pass = value
|
construction_pass = value
|
||||||
_init()
|
_init()
|
||||||
|
|
||||||
@export var perpen_error_threshold : float = 0.5
|
## the portion of speed that is allowed for side bleed of velocities
|
||||||
@export var sample_step_multiplier : float = 4
|
## during the jfa dilation passes and before backtracking. Getting this a higher value
|
||||||
|
## would make it so that meshes at movement blur more reliably, but also bleed
|
||||||
|
## further perpendicularly to their velocity, thus wash elemets behind them out.
|
||||||
|
@export var perpen_error_threshold : float = 0.3
|
||||||
|
|
||||||
@export var backtracking_velocity_match_threshold : float = 0.2
|
## an initial step size that can increase the dilation radius proportionally, at the
|
||||||
@export var backtracking_velocity_match_parallel_sensitivity : float = 1;
|
## sacrifice of some quality in the final resolution of the dilation
|
||||||
@export var backtracking_velcoity_match_perpendicular_sensitivity : float = 0.2;
|
@export var sample_step_multiplier : float = 8
|
||||||
|
|
||||||
|
## how sensitive the backtracking for velocities be
|
||||||
|
@export var backtracking_velocity_match_threshold : float = 0.49
|
||||||
|
|
||||||
|
## how sensitively the backtracking should treat velocities that are a different
|
||||||
|
## length along that velocity
|
||||||
|
@export var backtracking_velocity_match_parallel_sensitivity : float = 0.5;
|
||||||
|
|
||||||
|
## how sensitively the backtracking should treat velcoities that have perpendicular
|
||||||
|
## offset to that velocity
|
||||||
|
@export var backtracking_velcoity_match_perpendicular_sensitivity : float = 0.1;
|
||||||
|
|
||||||
|
## the number of passes performed by the jump flood algorithm based dilation,
|
||||||
|
## each pass added doubles the maximum radius of dilation available
|
||||||
|
@export var JFA_pass_count : int = 3
|
||||||
|
|
||||||
|
## wether this motion blur stays the same intensity below
|
||||||
|
## target_constant_framerate
|
||||||
|
@export var framerate_independent : bool = true
|
||||||
|
|
||||||
|
## if framerate_independent is enabled, the blur would simulate
|
||||||
|
## sutter speeds at that framerate, and up.
|
||||||
|
@export var target_constant_framerate : float = 30
|
||||||
|
|
||||||
var rd: RenderingDevice
|
var rd: RenderingDevice
|
||||||
|
|
||||||
|
|
@ -55,8 +81,6 @@ var past_color : StringName = "past_color"
|
||||||
var velocity_3D : StringName = "velocity_3D"
|
var velocity_3D : StringName = "velocity_3D"
|
||||||
var velocity_curl : StringName = "velocity_curl"
|
var velocity_curl : StringName = "velocity_curl"
|
||||||
|
|
||||||
var iteration_count : int = 3
|
|
||||||
|
|
||||||
var draw_debug : float = 0
|
var draw_debug : float = 0
|
||||||
|
|
||||||
var freeze : bool = false
|
var freeze : bool = false
|
||||||
|
|
@ -114,7 +138,25 @@ func get_sampler_uniform(image: RID, binding: int) -> RDUniform:
|
||||||
uniform.add_id(image)
|
uniform.add_id(image)
|
||||||
return uniform
|
return uniform
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var temp_motion_blur_intensity : float
|
||||||
|
|
||||||
|
var previous_time : float = 0
|
||||||
|
|
||||||
func _render_callback(p_effect_callback_type, p_render_data):
|
func _render_callback(p_effect_callback_type, p_render_data):
|
||||||
|
var time : float = float(Time.get_ticks_msec()) / 1000
|
||||||
|
|
||||||
|
var delta_time : float = time - previous_time
|
||||||
|
|
||||||
|
previous_time = time
|
||||||
|
|
||||||
|
temp_motion_blur_intensity = motion_blur_intensity
|
||||||
|
|
||||||
|
if framerate_independent:
|
||||||
|
var capped_frame_time : float = min(1 / target_constant_framerate, delta_time)
|
||||||
|
temp_motion_blur_intensity = motion_blur_intensity * capped_frame_time / delta_time
|
||||||
|
|
||||||
if rd and p_effect_callback_type == CompositorEffect.EFFECT_CALLBACK_TYPE_POST_TRANSPARENT:
|
if rd and p_effect_callback_type == CompositorEffect.EFFECT_CALLBACK_TYPE_POST_TRANSPARENT:
|
||||||
var render_scene_buffers: RenderSceneBuffersRD = p_render_data.get_render_scene_buffers()
|
var render_scene_buffers: RenderSceneBuffersRD = p_render_data.get_render_scene_buffers()
|
||||||
var render_scene_data: RenderSceneDataRD = p_render_data.get_render_scene_data()
|
var render_scene_data: RenderSceneDataRD = p_render_data.get_render_scene_data()
|
||||||
|
|
@ -130,10 +172,10 @@ func _render_callback(p_effect_callback_type, p_render_data):
|
||||||
|
|
||||||
rd.draw_command_begin_label("Motion Blur", Color(1.0, 1.0, 1.0, 1.0))
|
rd.draw_command_begin_label("Motion Blur", Color(1.0, 1.0, 1.0, 1.0))
|
||||||
|
|
||||||
var last_iteration_index : int = iteration_count - 1;
|
var last_iteration_index : int = JFA_pass_count - 1;
|
||||||
|
|
||||||
var push_constant: PackedFloat32Array = [
|
var push_constant: PackedFloat32Array = [
|
||||||
motion_blur_samples, motion_blur_intensity,
|
motion_blur_samples, temp_motion_blur_intensity,
|
||||||
motion_blur_center_fade, draw_debug,
|
motion_blur_center_fade, draw_debug,
|
||||||
freeze,
|
freeze,
|
||||||
Engine.get_frames_drawn() % 8,
|
Engine.get_frames_drawn() % 8,
|
||||||
|
|
@ -169,7 +211,7 @@ func _render_callback(p_effect_callback_type, p_render_data):
|
||||||
rd.compute_list_bind_compute_pipeline(compute_list, construct_pipeline)
|
rd.compute_list_bind_compute_pipeline(compute_list, construct_pipeline)
|
||||||
rd.compute_list_bind_uniform_set(compute_list, tex_uniform_set, 0)
|
rd.compute_list_bind_uniform_set(compute_list, tex_uniform_set, 0)
|
||||||
|
|
||||||
for i in iteration_count:
|
for i in JFA_pass_count:
|
||||||
var jf_push_constants : PackedInt32Array = [
|
var jf_push_constants : PackedInt32Array = [
|
||||||
i,
|
i,
|
||||||
last_iteration_index,
|
last_iteration_index,
|
||||||
|
|
@ -180,7 +222,7 @@ func _render_callback(p_effect_callback_type, p_render_data):
|
||||||
var jf_float_push_constants_test : PackedFloat32Array = [
|
var jf_float_push_constants_test : PackedFloat32Array = [
|
||||||
perpen_error_threshold,
|
perpen_error_threshold,
|
||||||
sample_step_multiplier,
|
sample_step_multiplier,
|
||||||
motion_blur_intensity,
|
temp_motion_blur_intensity,
|
||||||
backtracking_velocity_match_threshold,
|
backtracking_velocity_match_threshold,
|
||||||
backtracking_velocity_match_parallel_sensitivity,
|
backtracking_velocity_match_parallel_sensitivity,
|
||||||
backtracking_velcoity_match_perpendicular_sensitivity,
|
backtracking_velcoity_match_perpendicular_sensitivity,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
importer="glsl"
|
importer="glsl"
|
||||||
type="RDShaderFile"
|
type="RDShaderFile"
|
||||||
uid="uid://qn4j1e6qpbjn"
|
uid="uid://b02ng0mepo13k"
|
||||||
path="res://.godot/imported/jump_flood_blur.glsl-df0c6b7cc65d8b0520871790f9075253.res"
|
path="res://.godot/imported/jump_flood_blur.glsl-df0c6b7cc65d8b0520871790f9075253.res"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
importer="glsl"
|
importer="glsl"
|
||||||
type="RDShaderFile"
|
type="RDShaderFile"
|
||||||
uid="uid://b5t02et6687be"
|
uid="uid://bc2dlayo43x06"
|
||||||
path="res://.godot/imported/jump_flood_overlay.glsl-764d3c488a9e9576eab825591e868325.res"
|
path="res://.godot/imported/jump_flood_overlay.glsl-764d3c488a9e9576eab825591e868325.res"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue