base: taa fixes
This commit is contained in:
+7
-10
@@ -1076,22 +1076,15 @@ void camera_object_remove(camera_object_t *raw) {
|
|||||||
object_remove_super(raw->base);
|
object_remove_super(raw->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
void camera_object_render_frame(camera_object_t *raw) {
|
|
||||||
camera_object_proj_jitter(raw);
|
|
||||||
camera_object_build_mat(raw);
|
|
||||||
render_path_render_frame();
|
|
||||||
}
|
|
||||||
|
|
||||||
void camera_object_proj_jitter(camera_object_t *raw) {
|
void camera_object_proj_jitter(camera_object_t *raw) {
|
||||||
i32 w = render_path_current_w;
|
i32 w = render_path_current_w;
|
||||||
i32 h = render_path_current_h;
|
i32 h = render_path_current_h;
|
||||||
raw->p = raw->no_jitter_p;
|
raw->p = raw->no_jitter_p;
|
||||||
i32 i = raw->frame % 2;
|
i32 i = raw->frame % 2;
|
||||||
f32 x = i == 0 ? -0.5 : 0.5;
|
f32 x = i == 0 ? -0.5 : 0.5;
|
||||||
f32 y = i == 0 ? -0.5 : 0.5;
|
f32 y = i == 0 ? 0.5 : -0.5;
|
||||||
raw->p.m20 += x / w;
|
raw->p.m20 += x / w;
|
||||||
raw->p.m21 += y / h;
|
raw->p.m21 += y / h;
|
||||||
raw->frame++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void camera_object_build_mat(camera_object_t *raw) {
|
void camera_object_build_mat(camera_object_t *raw) {
|
||||||
@@ -2224,7 +2217,11 @@ void scene_render_frame(void) {
|
|||||||
transform_update(e->transform);
|
transform_update(e->transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
camera_object_render_frame(scene_camera);
|
|
||||||
|
camera_object_proj_jitter(scene_camera);
|
||||||
|
camera_object_build_mat(scene_camera);
|
||||||
|
render_path_render_frame();
|
||||||
|
scene_camera->frame++;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_t *scene_add_object(object_t *parent) {
|
object_t *scene_add_object(object_t *parent) {
|
||||||
|
|||||||
@@ -380,7 +380,6 @@ extern vec4_t _camera_object_sphere_center;
|
|||||||
camera_object_t *camera_object_create(camera_data_t *data);
|
camera_object_t *camera_object_create(camera_data_t *data);
|
||||||
void camera_object_build_proj(camera_object_t *raw, f32 screen_aspect);
|
void camera_object_build_proj(camera_object_t *raw, f32 screen_aspect);
|
||||||
void camera_object_remove(camera_object_t *raw);
|
void camera_object_remove(camera_object_t *raw);
|
||||||
void camera_object_render_frame(camera_object_t *raw);
|
|
||||||
void camera_object_proj_jitter(camera_object_t *raw);
|
void camera_object_proj_jitter(camera_object_t *raw);
|
||||||
void camera_object_build_mat(camera_object_t *raw);
|
void camera_object_build_mat(camera_object_t *raw);
|
||||||
vec4_t camera_object_right(camera_object_t *raw);
|
vec4_t camera_object_right(camera_object_t *raw);
|
||||||
|
|||||||
@@ -1441,7 +1441,6 @@ void minic_register_builtins() {
|
|||||||
R(camera_object_create, "p(p)");
|
R(camera_object_create, "p(p)");
|
||||||
R(camera_object_build_proj, "v(p,f)");
|
R(camera_object_build_proj, "v(p,f)");
|
||||||
R(camera_object_remove, "v(p)");
|
R(camera_object_remove, "v(p)");
|
||||||
R(camera_object_render_frame, "v(p)");
|
|
||||||
R(camera_object_proj_jitter, "v(p)");
|
R(camera_object_proj_jitter, "v(p)");
|
||||||
R(camera_object_build_mat, "v(p)");
|
R(camera_object_build_mat, "v(p)");
|
||||||
R(camera_object_sphere_in_frustum, "i(p,p,f,f,f,f)");
|
R(camera_object_sphere_in_frustum, "i(p,p,f,f,f,f)");
|
||||||
|
|||||||
@@ -1850,7 +1850,7 @@ void base_resize() {
|
|||||||
cam->data->ortho->buffer[3] = 2 * (sys_h() / (float)sys_w());
|
cam->data->ortho->buffer[3] = 2 * (sys_h() / (float)sys_w());
|
||||||
}
|
}
|
||||||
camera_object_build_proj(cam, -1.0);
|
camera_object_build_proj(cam, -1.0);
|
||||||
render_path_base_taa_frame = 0;
|
scene_camera->frame = 0;
|
||||||
|
|
||||||
if (g_context->camera_type == CAMERA_TYPE_ORTHOGRAPHIC) {
|
if (g_context->camera_type == CAMERA_TYPE_ORTHOGRAPHIC) {
|
||||||
viewport_update_camera_type(g_context->camera_type);
|
viewport_update_camera_type(g_context->camera_type);
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ i32 ui_menu_h = 0;
|
|||||||
bool ui_menu_keep_open = false;
|
bool ui_menu_keep_open = false;
|
||||||
void (*ui_menu_commands)(void) = NULL;
|
void (*ui_menu_commands)(void) = NULL;
|
||||||
bool ui_menu_show_first = true;
|
bool ui_menu_show_first = true;
|
||||||
i32 render_path_base_taa_frame = 0;
|
|
||||||
i32 render_path_base_bloom_current_mip = 0;
|
i32 render_path_base_bloom_current_mip = 0;
|
||||||
f32 render_path_base_bloom_sample_scale;
|
f32 render_path_base_bloom_sample_scale;
|
||||||
bool render_path_base_buf_swapped = false;
|
bool render_path_base_buf_swapped = false;
|
||||||
|
|||||||
@@ -68,15 +68,16 @@ void render_path_base_begin() {
|
|||||||
bool skip_taa = g_context->split_view || g_context->viewport_mode == VIEWPORT_MODE_PATH_TRACE || g_context->camera_type == CAMERA_TYPE_ORTHOGRAPHIC ||
|
bool skip_taa = g_context->split_view || g_context->viewport_mode == VIEWPORT_MODE_PATH_TRACE || g_context->camera_type == CAMERA_TYPE_ORTHOGRAPHIC ||
|
||||||
((g_context->tool == TOOL_TYPE_CLONE || g_context->tool == TOOL_TYPE_BLUR || g_context->tool == TOOL_TYPE_SMUDGE) && g_context->pdirty > 0);
|
((g_context->tool == TOOL_TYPE_CLONE || g_context->tool == TOOL_TYPE_BLUR || g_context->tool == TOOL_TYPE_SMUDGE) && g_context->pdirty > 0);
|
||||||
|
|
||||||
if (g_config->brush_live) {
|
if (skip_taa || g_config->brush_live) {
|
||||||
render_path_base_taa_frame = 0;
|
scene_camera->frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
scene_camera->frame = skip_taa ? 0 : render_path_base_taa_frame;
|
|
||||||
camera_object_proj_jitter(scene_camera);
|
camera_object_proj_jitter(scene_camera);
|
||||||
|
|
||||||
if (skip_taa) {
|
if (skip_taa) {
|
||||||
scene_camera->p = scene_camera->no_jitter_p;
|
scene_camera->p = scene_camera->no_jitter_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
camera_object_build_mat(scene_camera);
|
camera_object_build_mat(scene_camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +90,6 @@ void render_path_base_end() {
|
|||||||
g_context->foreground_event = false;
|
g_context->foreground_event = false;
|
||||||
g_context->pdirty = 0;
|
g_context->pdirty = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
render_path_base_taa_frame++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool render_path_base_ssaa4() {
|
bool render_path_base_ssaa4() {
|
||||||
@@ -344,16 +343,16 @@ void render_path_base_draw_taa(char *bufa, char *bufb) {
|
|||||||
render_path_draw_shader("Scene/copy_pass/copy_pass");
|
render_path_draw_shader("Scene/copy_pass/copy_pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
render_path_base_swap_buf(bufb);
|
render_path_base_swap_buf(bufa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_path_base_swap_buf(char *bufb) {
|
void render_path_base_swap_buf(char *bufa) {
|
||||||
// Swap buf and last targets
|
// Swap buf and last targets
|
||||||
render_target_t *last_target = any_map_get(render_path_render_targets, "last");
|
render_target_t *last_target = any_map_get(render_path_render_targets, "last");
|
||||||
last_target->name = string_copy(bufb);
|
last_target->name = string_copy(bufa);
|
||||||
render_target_t *buf_target = any_map_get(render_path_render_targets, bufb);
|
render_target_t *buf_target = any_map_get(render_path_render_targets, bufa);
|
||||||
buf_target->name = "last";
|
buf_target->name = "last";
|
||||||
any_map_set(render_path_render_targets, bufb, last_target);
|
any_map_set(render_path_render_targets, bufa, last_target);
|
||||||
any_map_set(render_path_render_targets, "last", buf_target);
|
any_map_set(render_path_render_targets, "last", buf_target);
|
||||||
render_path_base_buf_swapped = !render_path_base_buf_swapped;
|
render_path_base_buf_swapped = !render_path_base_buf_swapped;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ f32 uniforms_ext_f32_link(object_t *object, material_data_t *mat, char *link) {
|
|||||||
return g_context->picked_color->height;
|
return g_context->picked_color->height;
|
||||||
}
|
}
|
||||||
else if (string_equals(link, "_taa_blend")) {
|
else if (string_equals(link, "_taa_blend")) {
|
||||||
return render_path_base_taa_frame == 0 ? 0.0 : 0.5;
|
return scene_camera->frame == 0 ? 0.0 : 0.5;
|
||||||
}
|
}
|
||||||
if (parser_material_script_links != NULL) {
|
if (parser_material_script_links != NULL) {
|
||||||
string_array_t *keys = map_keys(parser_material_script_links);
|
string_array_t *keys = map_keys(parser_material_script_links);
|
||||||
|
|||||||
Reference in New Issue
Block a user