Blender
V3.3
|
#include "DRW_render.h"
#include "BLI_rand.h"
#include "../eevee/eevee_lut.h"
#include "workbench_engine.h"
#include "workbench_private.h"
Go to the source code of this file.
Macros | |
#define | JITTER_TEX_SIZE 64 |
#define | CAVITY_MAX_SAMPLES 512 |
Functions | |
static float * | create_disk_samples (int num_samples, int num_iterations) |
static struct GPUTexture * | create_jitter_texture (int num_samples) |
BLI_INLINE int | workbench_cavity_total_sample_count (const WORKBENCH_PrivateData *wpd, const Scene *scene) |
void | workbench_cavity_data_update (WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd) |
void | workbench_cavity_samples_ubo_ensure (WORKBENCH_PrivateData *wpd) |
void | workbench_cavity_cache_init (WORKBENCH_Data *data) |
Cavity Effect:
We use Screen Space Ambient Occlusion (SSAO) to enhance geometric details of the surfaces. We also use a Curvature effect computed only using the surface normals.
This is done after the opaque pass. It only affects the opaque surfaces.
Definition in file workbench_effect_cavity.c.
#define CAVITY_MAX_SAMPLES 512 |
Definition at line 25 of file workbench_effect_cavity.c.
#define JITTER_TEX_SIZE 64 |
Definition at line 24 of file workbench_effect_cavity.c.
|
static |
Definition at line 28 of file workbench_effect_cavity.c.
References BLI_assert, BLI_hammersley_1d(), CAVITY_MAX_SAMPLES, cosf, float(), fmodf, M_PI, MEM_callocN, num_samples, r, and sinf.
Referenced by workbench_cavity_samples_ubo_ensure().
|
static |
Definition at line 52 of file workbench_effect_cavity.c.
References blue_noise, bsdf_split_sum_ggx, btdf_split_sum_ggx, CLAMP, cosf, DRW_TEX_WRAP, DRW_texture_create_2d(), GPU_RGBA16F, ltc_disk_integral, ltc_mag_ggx, ltc_mat_ggx, M_PI, num_samples, sinf, and UNUSED_VARS.
Referenced by workbench_cavity_samples_ubo_ensure().
void workbench_cavity_cache_init | ( | WORKBENCH_Data * | data | ) |
Definition at line 134 of file workbench_effect_cavity.c.
References CAVITY_ENABLED, WORKBENCH_ViewLayerData::cavity_jitter_tx, WORKBENCH_PassList::cavity_ps, WORKBENCH_ViewLayerData::cavity_sample_ubo, CURVATURE_ENABLED, data, DefaultTextureList::depth, DRW_PASS_CREATE, DRW_shgroup_call_procedural_triangles(), DRW_shgroup_create(), DRW_shgroup_uniform_block, DRW_shgroup_uniform_texture(), DRW_STATE_BLEND_MUL, DRW_STATE_WRITE_COLOR, DRW_viewport_texture_list_get(), WORKBENCH_PrivateData::normal_buffer_tx, NULL, WORKBENCH_PrivateData::object_id_tx, sh, SSAO_ENABLED, state, WORKBENCH_PrivateData::vldata, workbench_cavity_samples_ubo_ensure(), workbench_shader_cavity_get(), and WORKBENCH_PrivateData::world_ubo.
Referenced by workbench_cache_init().
void workbench_cavity_data_update | ( | WORKBENCH_PrivateData * | wpd, |
WORKBENCH_UBO_World * | wd | ||
) |
Definition at line 81 of file workbench_effect_cavity.c.
References WORKBENCH_UBO_World::cavity_attenuation, WORKBENCH_UBO_World::cavity_distance, CAVITY_ENABLED, WORKBENCH_UBO_World::cavity_jitter_scale, WORKBENCH_UBO_World::cavity_ridge_factor, View3DShading::cavity_ridge_factor, WORKBENCH_UBO_World::cavity_sample_count_inv, WORKBENCH_UBO_World::cavity_sample_end, WORKBENCH_UBO_World::cavity_sample_start, WORKBENCH_UBO_World::cavity_valley_factor, View3DShading::cavity_valley_factor, WORKBENCH_UBO_World::curvature_ridge, View3DShading::curvature_ridge_factor, WORKBENCH_UBO_World::curvature_valley, View3DShading::curvature_valley_factor, Scene::display, DRW_context_state_get(), SceneDisplay::matcap_ssao_attenuation, SceneDisplay::matcap_ssao_distance, SceneDisplay::matcap_ssao_samples, max_ff(), sample, scene, DRWContextState::scene, WORKBENCH_PrivateData::shading, square_f(), WORKBENCH_PrivateData::taa_sample, and workbench_cavity_total_sample_count().
Referenced by workbench_update_world_ubo().
void workbench_cavity_samples_ubo_ensure | ( | WORKBENCH_PrivateData * | wpd | ) |
Definition at line 109 of file workbench_effect_cavity.c.
References WORKBENCH_ViewLayerData::cavity_jitter_tx, CAVITY_MAX_SAMPLES, WORKBENCH_ViewLayerData::cavity_sample_count, WORKBENCH_ViewLayerData::cavity_sample_ubo, create_disk_samples(), create_jitter_texture(), Scene::display, DRW_context_state_get(), DRW_TEXTURE_FREE_SAFE, DRW_UBO_FREE_SAFE, GPU_uniformbuf_create_ex(), SceneDisplay::matcap_ssao_samples, max_ii(), MEM_freeN, NULL, scene, DRWContextState::scene, WORKBENCH_PrivateData::vldata, and workbench_cavity_total_sample_count().
Referenced by workbench_cavity_cache_init(), and workbench_dof_cache_init().
BLI_INLINE int workbench_cavity_total_sample_count | ( | const WORKBENCH_PrivateData * | wpd, |
const Scene * | scene | ||
) |
Definition at line 74 of file workbench_effect_cavity.c.
References CAVITY_MAX_SAMPLES, Scene::display, SceneDisplay::matcap_ssao_samples, max_ii(), min_ii(), scene, and WORKBENCH_PrivateData::taa_sample_len.
Referenced by workbench_cavity_data_update(), and workbench_cavity_samples_ubo_ensure().