Added and tuned the new iteration
This commit is contained in:
parent
aa28ae3bb7
commit
fc7a04c3d1
6 changed files with 39 additions and 24 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://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="RDShaderFile" uid="uid://6w0vfx2mbbjw" path="res://MyJumpFloodIteration/jump_flood_blur.glsl" id="17_lj2u4"]
|
||||
[ext_resource type="RDShaderFile" uid="uid://qn4j1e6qpbjn" 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="AudioStream" uid="uid://b6rc81y5wriln" path="res://Audio/day_bg.ogg" id="18_kwmnc"]
|
||||
[ext_resource type="RDShaderFile" uid="uid://cqih3avqecivn" path="res://MyJumpFloodIteration/jfp_backtracking_experimental.glsl" id="18_opepq"]
|
||||
[ext_resource type="RDShaderFile" uid="uid://h4ddgpouwqj1" path="res://MyJumpFloodIteration/jump_flood_overlay.glsl" id="19_7g3lb"]
|
||||
[ext_resource type="RDShaderFile" uid="uid://3fotynjh5y7g" 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="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="Script" path="res://MyJumpFloodIteration/jump_flood_blur.gd" id="20_0qnwf"]
|
||||
|
|
@ -81,12 +81,12 @@
|
|||
[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"]
|
||||
|
||||
[sub_resource type="CompositorEffect" id="CompositorEffect_vhhvl"]
|
||||
[sub_resource type="CompositorEffect" id="CompositorEffect_tx25r"]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
enabled = true
|
||||
effect_callback_type = 4
|
||||
needs_motion_vectors = true
|
||||
needs_motion_vectors = false
|
||||
needs_normal_roughness = false
|
||||
script = ExtResource("20_0qnwf")
|
||||
motion_blur_samples = 8
|
||||
|
|
@ -97,9 +97,12 @@ overlay_shader_file = ExtResource("19_7g3lb")
|
|||
construction_pass = ExtResource("18_opepq")
|
||||
perpen_error_threshold = 0.3
|
||||
sample_step_multiplier = 8.0
|
||||
backtracking_velocity_match_threshold = 0.5
|
||||
backtracking_velocity_match_parallel_sensitivity = 1.0
|
||||
backtracking_velcoity_match_perpendicular_sensitivity = 0.2
|
||||
|
||||
[sub_resource type="Compositor" id="Compositor_ak7ke"]
|
||||
compositor_effects = Array[CompositorEffect]([SubResource("CompositorEffect_vhhvl")])
|
||||
compositor_effects = Array[CompositorEffect]([SubResource("CompositorEffect_tx25r")])
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_u4h6w"]
|
||||
size = Vector3(42.825, 3, 85.35)
|
||||
|
|
|
|||
|
|
@ -15,12 +15,16 @@ layout(push_constant, std430) uniform Params
|
|||
{
|
||||
int iteration_index;
|
||||
int last_iteration_index;
|
||||
int nan2;
|
||||
int nan3;
|
||||
int nan1;
|
||||
int nan2;
|
||||
float perpen_error_thresh;
|
||||
float sample_step_multiplier;
|
||||
float motion_blur_intensity;
|
||||
float nan5;
|
||||
float velocity_match_threshold;
|
||||
float parallel_sensitivity;
|
||||
float perpendicular_sensitivity;
|
||||
float nan3;
|
||||
float nan4;
|
||||
} params;
|
||||
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
|
|
@ -74,11 +78,14 @@ void set_value(bool a, ivec2 uvi, vec4 value, ivec2 render_size)
|
|||
|
||||
// Motion similarity
|
||||
// ----------------------------------------------------------
|
||||
float get_motion_difference(vec2 V, vec2 V2, float power)
|
||||
float get_motion_difference(vec2 V, vec2 V2, float parallel_sensitivity, float perpendicular_sensitivity)
|
||||
{
|
||||
vec2 VO = V - V2;
|
||||
float difference = length(VO) / length(V) / 4 + abs(dot(VO, V) / max(FLT_MIN, dot(V, V)));
|
||||
return pow(clamp(difference, 0, 1), power);
|
||||
double parallel = abs(dot(VO, V) / max(DBL_MIN, dot(V, V)));
|
||||
vec2 perpen_V = vec2(V.y, -V.x);
|
||||
double perpendicular = abs(dot(VO, perpen_V) / max(DBL_MIN, dot(V, V)));
|
||||
float difference = float(parallel) * parallel_sensitivity + float(perpendicular) * perpendicular_sensitivity;
|
||||
return clamp(difference, 0, 1);
|
||||
}
|
||||
// ----------------------------------------------------------
|
||||
|
||||
|
|
@ -131,8 +138,6 @@ vec4 get_backtracked_sample(vec2 uvn, vec2 chosen_uv, vec2 chosen_velocity, vec4
|
|||
|
||||
int step_count = 16;
|
||||
|
||||
float velocity_match_threshold = 0.2;
|
||||
|
||||
float smallest_step = 1 / max(render_size.x, render_size.y);
|
||||
|
||||
float max_dilation_radius = pow(2, params.last_iteration_index) * params.sample_step_multiplier * smallest_step / (length(chosen_velocity) * params.motion_blur_intensity);
|
||||
|
|
@ -157,7 +162,7 @@ vec4 get_backtracked_sample(vec2 uvn, vec2 chosen_uv, vec2 chosen_velocity, vec4
|
|||
|
||||
vec2 velocity_test = textureLod(velocity_sampler, new_sample, 0.0).xy;
|
||||
|
||||
if(get_motion_difference(chosen_velocity, velocity_test, 1) <= velocity_match_threshold)
|
||||
if(get_motion_difference(chosen_velocity, velocity_test, params.parallel_sensitivity, params.perpendicular_sensitivity) <= params.velocity_match_threshold)
|
||||
{
|
||||
chosen_uv = new_sample;
|
||||
best_sample_fitness.x = velocity_multiplier;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="glsl"
|
||||
type="RDShaderFile"
|
||||
uid="uid://cqih3avqecivn"
|
||||
uid="uid://3fotynjh5y7g"
|
||||
path="res://.godot/imported/jfp_backtracking_experimental.glsl-d67307f6899fed647164be410a7debc8.res"
|
||||
|
||||
[deps]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
@tool
|
||||
extends CompositorEffect
|
||||
class_name MotionBlurSphynxJumpFlood
|
||||
|
||||
|
|
@ -28,6 +27,10 @@ class_name MotionBlurSphynxJumpFlood
|
|||
@export var perpen_error_threshold : float = 0.5
|
||||
@export var sample_step_multiplier : float = 4
|
||||
|
||||
@export var backtracking_velocity_match_threshold : float = 0.2
|
||||
@export var backtracking_velocity_match_parallel_sensitivity : float = 1;
|
||||
@export var backtracking_velcoity_match_perpendicular_sensitivity : float = 0.2;
|
||||
|
||||
var rd: RenderingDevice
|
||||
|
||||
var linear_sampler: RID
|
||||
|
|
@ -162,7 +165,9 @@ func _render_callback(p_effect_callback_type, p_render_data):
|
|||
get_image_uniform(buffer_b_image, 3),
|
||||
])
|
||||
|
||||
|
||||
compute_list = rd.compute_list_begin()
|
||||
rd.compute_list_bind_compute_pipeline(compute_list, construct_pipeline)
|
||||
rd.compute_list_bind_uniform_set(compute_list, tex_uniform_set, 0)
|
||||
|
||||
for i in iteration_count:
|
||||
var jf_push_constants : PackedInt32Array = [
|
||||
|
|
@ -176,18 +181,20 @@ func _render_callback(p_effect_callback_type, p_render_data):
|
|||
perpen_error_threshold,
|
||||
sample_step_multiplier,
|
||||
motion_blur_intensity,
|
||||
backtracking_velocity_match_threshold,
|
||||
backtracking_velocity_match_parallel_sensitivity,
|
||||
backtracking_velcoity_match_perpendicular_sensitivity,
|
||||
0,
|
||||
0
|
||||
]
|
||||
|
||||
var jf_byte_array = jf_push_constants.to_byte_array()
|
||||
jf_byte_array.append_array(jf_float_push_constants_test.to_byte_array())
|
||||
|
||||
compute_list = rd.compute_list_begin()
|
||||
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_set_push_constant(compute_list, jf_byte_array, jf_byte_array.size())
|
||||
rd.compute_list_dispatch(compute_list, x_groups, y_groups, 1)
|
||||
rd.compute_list_end()
|
||||
|
||||
rd.compute_list_end()
|
||||
|
||||
rd.draw_command_end_label()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="glsl"
|
||||
type="RDShaderFile"
|
||||
uid="uid://6w0vfx2mbbjw"
|
||||
uid="uid://qn4j1e6qpbjn"
|
||||
path="res://.godot/imported/jump_flood_blur.glsl-df0c6b7cc65d8b0520871790f9075253.res"
|
||||
|
||||
[deps]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="glsl"
|
||||
type="RDShaderFile"
|
||||
uid="uid://h4ddgpouwqj1"
|
||||
uid="uid://b5t02et6687be"
|
||||
path="res://.godot/imported/jump_flood_overlay.glsl-764d3c488a9e9576eab825591e868325.res"
|
||||
|
||||
[deps]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue