Blender
V3.3
|
#include "ED_screen.h"
#include "BLI_jitter_2d.h"
#include "smaa_textures.h"
#include "workbench_private.h"
Go to the source code of this file.
Functions | |
static void | workbench_taa_jitter_init_order (float(*table)[2], int num) |
static void | workbench_taa_jitter_init (void) |
int | workbench_antialiasing_sample_count_get (WORKBENCH_PrivateData *wpd) |
void | workbench_antialiasing_view_updated (WORKBENCH_Data *vedata) |
static bool | workbench_in_front_history_needed (WORKBENCH_Data *vedata) |
void | workbench_antialiasing_engine_init (WORKBENCH_Data *vedata) |
static float | filter_blackman_harris (float x, const float width) |
static void | workbench_antialiasing_weights_get (const float offset[2], float r_weights[9], float *r_weight_sum) |
void | workbench_antialiasing_cache_init (WORKBENCH_Data *vedata) |
bool | workbench_antialiasing_setup (WORKBENCH_Data *vedata) |
void | workbench_antialiasing_draw_pass (WORKBENCH_Data *vedata) |
Variables | |
struct { | |
bool init | |
float jitter_5 [5][2] | |
float jitter_8 [8][2] | |
float jitter_11 [11][2] | |
float jitter_16 [16][2] | |
float jitter_32 [32][2] | |
} | e_data = {false} |
Anti-Aliasing:
We use SMAA (Smart Morphological Anti-Aliasing) as a fast antialiasing solution.
If the viewport stays static, the engine ask for multiple redraw and will progressively converge to a much more accurate image without aliasing. We call this one TAA (Temporal Anti-Aliasing).
This is done using an accumulation buffer and a final pass that will output the final color to the scene buffer. We softly blend between SMAA and TAA to avoid really harsh transitions.
Definition in file workbench_effect_antialiasing.c.
Definition at line 259 of file workbench_effect_antialiasing.c.
References clamp_f(), cosf, M_PI, width, and x.
Referenced by workbench_antialiasing_weights_get().
void workbench_antialiasing_cache_init | ( | WORKBENCH_Data * | vedata | ) |
Definition at line 290 of file workbench_effect_antialiasing.c.
References WORKBENCH_PassList::aa_accum_ps, WORKBENCH_PassList::aa_accum_replace_ps, WORKBENCH_PassList::aa_edge_ps, WORKBENCH_PassList::aa_resolve_ps, WORKBENCH_PassList::aa_weight_ps, DefaultTextureList::color, DRW_PASS_CREATE, DRW_PASS_INSTANCE_CREATE, DRW_shgroup_call_procedural_triangles(), DRW_shgroup_clear_framebuffer(), DRW_shgroup_create(), DRW_shgroup_uniform_float(), DRW_shgroup_uniform_texture(), DRW_shgroup_uniform_texture_ex(), DRW_shgroup_uniform_vec4_copy(), DRW_STATE_BLEND_ADD_FULL, DRW_STATE_WRITE_COLOR, DRW_viewport_invert_size_get(), DRW_viewport_size_get(), DRW_viewport_texture_list_get(), GPU_COLOR_BIT, GPU_SAMPLER_DEFAULT, WORKBENCH_TextureList::history_buffer_tx, NULL, WORKBENCH_Data::psl, sh, size(), WORKBENCH_TextureList::smaa_area_tx, WORKBENCH_PrivateData::smaa_edge_tx, WORKBENCH_PrivateData::smaa_mix_factor, WORKBENCH_TextureList::smaa_search_tx, WORKBENCH_PrivateData::smaa_weight_tx, WORKBENCH_Data::stl, WORKBENCH_PrivateData::taa_sample_len, WORKBENCH_PrivateData::taa_weight_accum, WORKBENCH_PrivateData::taa_weights, WORKBENCH_Data::txl, workbench_shader_antialiasing_accumulation_get(), workbench_shader_antialiasing_get(), and WORKBENCH_StorageList::wpd.
Referenced by workbench_cache_init().
void workbench_antialiasing_draw_pass | ( | WORKBENCH_Data * | vedata | ) |
We always do SMAA on top of TAA accumulation, unless the number of samples of TAA is already high. This ensure a smoother transition. If TAA accumulation is finished, we only blit the result.
Definition at line 422 of file workbench_effect_antialiasing.c.
References WORKBENCH_PassList::aa_accum_ps, WORKBENCH_PassList::aa_accum_replace_ps, WORKBENCH_PassList::aa_edge_ps, WORKBENCH_PassList::aa_resolve_ps, WORKBENCH_PassList::aa_weight_ps, WORKBENCH_FramebufferList::antialiasing_fb, clamp_f(), DefaultFramebufferList::default_fb, DefaultTextureList::depth, WORKBENCH_TextureList::depth_buffer_in_front_tx, WORKBENCH_TextureList::depth_buffer_tx, DefaultTextureList::depth_in_front, DRW_draw_pass(), DRW_state_is_image_render(), DRW_viewport_framebuffer_list_get(), DRW_viewport_request_redraw(), DRW_viewport_texture_list_get(), WORKBENCH_Data::fbl, GPU_framebuffer_bind(), GPU_texture_copy(), WORKBENCH_PrivateData::is_playback, WORKBENCH_Data::psl, WORKBENCH_FramebufferList::smaa_edge_fb, WORKBENCH_PrivateData::smaa_mix_factor, WORKBENCH_FramebufferList::smaa_weight_fb, WORKBENCH_Data::stl, WORKBENCH_PrivateData::taa_sample, WORKBENCH_PrivateData::taa_sample_len, WORKBENCH_PrivateData::taa_weight_accum, WORKBENCH_PrivateData::taa_weights_sum, WORKBENCH_Data::txl, WORKBENCH_PrivateData::valid_history, workbench_in_front_history_needed(), and WORKBENCH_StorageList::wpd.
Referenced by workbench_draw_sample().
void workbench_antialiasing_engine_init | ( | WORKBENCH_Data * | vedata | ) |
Definition at line 146 of file workbench_effect_antialiasing.c.
References WORKBENCH_FramebufferList::antialiasing_fb, WORKBENCH_FramebufferList::antialiasing_in_front_fb, AREATEX_HEIGHT, AREATEX_WIDTH, areaTexBytes, copy_m4_m4(), WORKBENCH_TextureList::depth_buffer_in_front_tx, WORKBENCH_TextureList::depth_buffer_tx, DRW_TEX_FILTER, DRW_texture_ensure_fullscreen_2d(), DRW_TEXTURE_FREE_SAFE, DRW_texture_pool_query_fullscreen(), DRW_view_persmat_get(), equals_m4m4(), WORKBENCH_Data::fbl, GPU_DATA_UBYTE, GPU_DEPTH24_STENCIL8, GPU_R8, GPU_RG8, GPU_RGBA16F, GPU_RGBA8, GPU_texture_create_2d(), GPU_texture_filter_mode(), GPU_texture_update(), WORKBENCH_TextureList::history_buffer_tx, WORKBENCH_PrivateData::is_navigating, WORKBENCH_PrivateData::is_playback, WORKBENCH_PrivateData::last_mat, NULL, WORKBENCH_PrivateData::reset_next_sample, SEARCHTEX_HEIGHT, SEARCHTEX_WIDTH, searchTexBytes, WORKBENCH_TextureList::smaa_area_tx, WORKBENCH_FramebufferList::smaa_edge_fb, WORKBENCH_PrivateData::smaa_edge_tx, WORKBENCH_TextureList::smaa_search_tx, WORKBENCH_FramebufferList::smaa_weight_fb, WORKBENCH_PrivateData::smaa_weight_tx, WORKBENCH_Data::stl, WORKBENCH_PrivateData::taa_sample, WORKBENCH_PrivateData::taa_sample_len, WORKBENCH_PrivateData::taa_sample_len_previous, WORKBENCH_Data::txl, WORKBENCH_PrivateData::valid_history, WORKBENCH_PrivateData::view, WORKBENCH_PrivateData::view_updated, workbench_in_front_history_needed(), workbench_taa_jitter_init(), and WORKBENCH_StorageList::wpd.
Referenced by workbench_engine_init().
int workbench_antialiasing_sample_count_get | ( | WORKBENCH_PrivateData * | wpd | ) |
Definition at line 98 of file workbench_effect_antialiasing.c.
References Scene::display, DRW_context_state_get(), DRW_state_is_image_render(), WORKBENCH_PrivateData::is_navigating, WORKBENCH_PrivateData::is_playback, min_ii(), WORKBENCH_PrivateData::preferences, SceneDisplay::render_aa, scene, DRWContextState::scene, DRWContextState::v3d, SceneDisplay::viewport_aa, and UserDef::viewport_aa.
Referenced by workbench_private_data_init().
bool workbench_antialiasing_setup | ( | WORKBENCH_Data * | vedata | ) |
Return true if render is not cached.
Definition at line 359 of file workbench_effect_antialiasing.c.
References DRW_view_create_sub(), DRW_view_default_get(), DRW_view_persmat_get(), DRW_view_set_active(), DRW_view_update_sub(), DRW_view_viewmat_get(), DRW_view_winmat_get(), DRW_viewport_size_get(), e_data, min_ii(), WORKBENCH_Data::stl, WORKBENCH_PrivateData::taa_sample, WORKBENCH_PrivateData::taa_sample_len, WORKBENCH_PrivateData::taa_weights, WORKBENCH_PrivateData::taa_weights_sum, WORKBENCH_PrivateData::view, window_translate_m4(), workbench_antialiasing_weights_get(), and WORKBENCH_StorageList::wpd.
Referenced by workbench_draw_sample().
void workbench_antialiasing_view_updated | ( | WORKBENCH_Data * | vedata | ) |
Definition at line 118 of file workbench_effect_antialiasing.c.
References WORKBENCH_Data::stl, WORKBENCH_PrivateData::view_updated, and WORKBENCH_StorageList::wpd.
Referenced by workbench_view_update().
|
static |
Definition at line 269 of file workbench_effect_antialiasing.c.
References filter_blackman_harris(), len_v2(), offset, r, sub_v2_v2(), x, and y.
Referenced by workbench_antialiasing_setup().
|
static |
Definition at line 129 of file workbench_effect_antialiasing.c.
References DRW_context_state_get(), View3D::flag2, WORKBENCH_PrivateData::is_playback, WORKBENCH_Data::stl, DRWContextState::v3d, V3D_HIDE_OVERLAYS, and WORKBENCH_StorageList::wpd.
Referenced by workbench_antialiasing_draw_pass(), and workbench_antialiasing_engine_init().
Definition at line 86 of file workbench_effect_antialiasing.c.
References e_data, and workbench_taa_jitter_init_order().
Referenced by workbench_antialiasing_engine_init().
Definition at line 36 of file workbench_effect_antialiasing.c.
References BLI_jitter_init(), copy_v2_v2(), fmodf, square_f(), sub_v2_v2(), and swap_v2_v2().
Referenced by workbench_taa_jitter_init().
struct { ... } e_data |
Referenced by workbench_antialiasing_setup(), and workbench_taa_jitter_init().
bool init |
Definition at line 28 of file workbench_effect_antialiasing.c.
Referenced by GHOST_ContextCGL::activateDrawingContext(), blender::gpu::MTLFrameBuffer::bake_render_pass_descriptor(), BKE_mesh_minmax(), btConeTwistConstraint(), btGeneric6DofSpringConstraint(), btSymMatrix< T >::btSymMatrix(), Buffer_new(), blender::bke::calculate_type_counts(), Freestyle::Canvas::Canvas(), deformVerts(), ED_area_type_hud_ensure(), blender::ed::sculpt_paint::find_curves_brush_position(), blender::gpu::MTLContext::generate_sampler_from_state(), GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(), GHOST_DisplayManagerCocoa::getDisplaySetting(), GHOST_DisplayManagerCocoa::getNumDisplays(), GHOST_ContextCGL::getSwapInterval(), ghost_fatal_error_dialog(), gpencil_add_new_points(), gpencil_convert_spline(), gpencil_erase_processed_area(), heapsimple_down(), load_tex(), load_tex_cursor(), blender::bounds::min_max(), blender::bounds::min_max_with_radii(), blender::gpu::MTLFrameBuffer::MTLFrameBuffer(), osx_user_locale(), pygpu_buffer__tp_new(), GHOST_ContextCGL::releaseDrawingContext(), blender::gpu::MTLBackend::render_begin(), btSymMatrix< T >::resize(), GHOST_ContextCGL::setSwapInterval(), snap_object_data_editmesh_get(), snap_object_data_mesh_get(), GHOST_ContextCGL::swapBuffers(), GHOST_ContextCGL::updateDrawingContext(), WM_tooltip_immediate_init(), WM_tooltip_timer_init(), and WM_tooltip_timer_init_ex().
float jitter_11[11][2] |
Definition at line 31 of file workbench_effect_antialiasing.c.
float jitter_16[16][2] |
Definition at line 32 of file workbench_effect_antialiasing.c.
float jitter_32[32][2] |
Definition at line 33 of file workbench_effect_antialiasing.c.
float jitter_5[5][2] |
Definition at line 29 of file workbench_effect_antialiasing.c.
float jitter_8[8][2] |
Definition at line 30 of file workbench_effect_antialiasing.c.