diff --git a/base/assets/shader_datas.arm b/base/assets/shader_datas.arm index ed1fb531..1b0d07d5 100644 Binary files a/base/assets/shader_datas.arm and b/base/assets/shader_datas.arm differ diff --git a/base/shaders/taa_pass.kong b/base/shaders/taa_pass.kong index 988382b7..6b7e31f5 100644 --- a/base/shaders/taa_pass.kong +++ b/base/shaders/taa_pass.kong @@ -11,6 +11,11 @@ const tex2: tex2d; #[set(everything)] const tex2_sampler: sampler; +#[set(everything)] +const constants: { + taa_blend: float; +}; + struct vert_in { pos: float2; } @@ -31,7 +36,7 @@ fun taa_pass_vert(input: vert_in): vert_out { fun taa_pass_frag(input: vert_out): float4 { var current: float4 = sample_lod(tex, tex_sampler, input.tex, 0.0); var previous: float4 = sample_lod(tex2, tex2_sampler, input.tex, 0.0); - return float4(lerp(current.rgb, previous.rgb, 0.833), 1.0); + return float4(lerp(current.rgb, previous.rgb, constants.taa_blend), 1.0); } #[pipe] diff --git a/base/sources/ts/base.ts b/base/sources/ts/base.ts index 3cbda24e..a36c1838 100644 --- a/base/sources/ts/base.ts +++ b/base/sources/ts/base.ts @@ -450,7 +450,7 @@ function base_update() { ///if arm_windows let is_picker: bool = context_is_picker(); let decal: bool = context_is_decal(); - ui_always_redraw_window = !context_raw.cache_draws || + ui_always_redraw_window = //!context_raw.cache_draws || ui_menu_show || ui_box_show || base_is_dragging || diff --git a/base/sources/ts/context.ts b/base/sources/ts/context.ts index 3d7efc77..173350d1 100644 --- a/base/sources/ts/context.ts +++ b/base/sources/ts/context.ts @@ -143,7 +143,7 @@ type context_t = { decal_x?: f32; decal_y?: f32; - cache_draws?: bool; + // cache_draws?: bool; write_icon_on_export?: bool; text_tool_image?: iron_gpu_texture_t; @@ -369,7 +369,7 @@ function context_create(): context_t { c.decal_preview = false; c.decal_x = 0.0; c.decal_y = 0.0; - c.cache_draws = false; + // c.cache_draws = false; c.write_icon_on_export = false; ///if arm_physics c.particle_hit_x = 0.0; diff --git a/base/sources/ts/iron/camera_object.ts b/base/sources/ts/iron/camera_object.ts index 85409175..dfc674bd 100644 --- a/base/sources/ts/iron/camera_object.ts +++ b/base/sources/ts/iron/camera_object.ts @@ -72,6 +72,11 @@ function camera_object_proj_jitter(raw: camera_object_t) { raw.p = mat4_clone(raw.no_jitter_p); let i: i32 = raw.frame % 6; + + if (context_raw.ddirty > 1 || context_raw.pdirty > 0) { + i = raw.frame % 2; + } + let x: f32 = 0.0; let y: f32 = 0.0; diff --git a/base/sources/ts/render_path_base.ts b/base/sources/ts/render_path_base.ts index c5dced28..f1b09bde 100644 --- a/base/sources/ts/render_path_base.ts +++ b/base/sources/ts/render_path_base.ts @@ -108,11 +108,14 @@ function render_path_base_is_cached(): bool { if (mx != render_path_base_last_x || my != render_path_base_last_y || mouse_locked) { context_raw.ddirty = 0; } - ///if (arm_metal || arm_android) + if (context_raw.ddirty > -6) { - ///else - if (context_raw.ddirty > -2) { - ///end + // Accumulate taa frames + context_raw.ddirty--; + return false; + } + + if (context_raw.ddirty > -12) { render_path_set_target(""); render_path_bind_target("last", "tex"); if (render_path_base_ssaa4()) { @@ -122,11 +125,11 @@ function render_path_base_is_cached(): bool { render_path_draw_shader("shader_datas/copy_pass/copy_pass"); } render_path_paint_commands_cursor(); - if (context_raw.ddirty <= 0) { - context_raw.ddirty--; - } + context_raw.ddirty--; } + render_path_base_end(); + return true; } return false; @@ -252,7 +255,8 @@ function render_path_base_init_ssao() { function render_path_base_draw_ssao() { let ssao: bool = config_raw.rp_ssao != false && context_raw.camera_type == camera_type_t.PERSPECTIVE; - if (ssao && context_raw.ddirty > 0 && render_path_base_taa_frame > 0) { + // if (ssao && context_raw.ddirty > 0 && render_path_base_taa_frame > 0) { + if (ssao && render_path_base_taa_frame > 0) { if (map_get(render_path_render_targets, "singlea") == null) { render_path_base_init_ssao(); } diff --git a/base/sources/ts/uniforms_ext.ts b/base/sources/ts/uniforms_ext.ts index 99482573..5834b82b 100644 --- a/base/sources/ts/uniforms_ext.ts +++ b/base/sources/ts/uniforms_ext.ts @@ -127,6 +127,15 @@ function uniforms_ext_f32_link(object: object_t, mat: material_data_t, link: str else if (link == "_picker_height") { return context_raw.picked_color.height; } + else if (link == "_taa_blend") { + if (render_path_base_taa_frame == 0) { + return 0.0; + } + if (context_raw.ddirty > 1 || context_raw.pdirty > 0) { + return 0.5; + } + return 0.833; + } if (parser_material_script_links != null) { let keys: string[] = map_keys(parser_material_script_links);