taa fixes

This commit is contained in:
luboslenco
2025-03-25 20:45:36 +01:00
parent d22ff37b1b
commit 5fcd0beabb
7 changed files with 35 additions and 12 deletions
Binary file not shown.
+6 -1
View File
@@ -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]
+1 -1
View File
@@ -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 ||
+2 -2
View File
@@ -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;
+5
View File
@@ -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;
+12 -8
View File
@@ -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();
}
+9
View File
@@ -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);