43 return get_static_cache().
get();
47 get_static_cache().release();
58 return prepass_[int(geometry_type)][int(pipeline_type)][int(lighting_type)][int(shader_type)]
65 bool curvature =
false,
68 return resolve_[int(lighting_type)][cavity][curvature][shadow].get();
71 GPUShader *
shadow_get(
bool depth_pass,
bool manifold,
bool cap =
false)
73 return shadow_[depth_pass][manifold][cap].get();
76 GPUShader *
volume_get(
bool smoke,
int interpolation,
bool coba,
bool slice)
78 return volume_[smoke][interpolation][coba][slice].get();
87 "workbench_shadow_visibility_compute_dynamic_pass_type"};
118 static uint32_t
pack_data(
float metallic,
float roughness,
float alpha);
198 static const int max_samples_ = 512;
203 int sample_count_ = 0;
204 bool curvature_enabled_ =
false;
205 bool cavity_enabled_ =
false;
212 void load_samples_buf(
int ssao_samples);
260 using TextureSubPassKey = std::pair<GPUTexture *, eGeometryType>;
270 bool is_empty_ =
false;
349#define DEBUG_SHADOW_VOLUME 0
353 enum PassType { PASS = 0, FAIL, FORCED_FAIL, MAX };
355 class ShadowView :
public View {
356 bool force_fail_method_ =
false;
359 ShadowPass::PassType current_pass_type_ = PASS;
365 ShadowView() :
View(
"ShadowPass.View"){};
367 void setup(
View &
view,
float3 light_direction,
bool force_fail_method);
368 bool debug_object_culling(
Object *ob);
369 void set_mode(PassType type);
375 bool debug_freeze)
override;
384 PassMain pass_ps_ = {
"Shadow.Pass"};
385 PassMain fail_ps_ = {
"Shadow.Fail"};
388 PassMain forced_fail_ps_ = {
"Shadow.ForcedFail"};
392 PassMain::Sub *&get_pass_ptr(PassType type,
bool manifold,
bool cap =
false);
404 const bool has_transp_mat);
408 GPUTexture &depth_stencil_tx,
410 bool force_fail_method);
421 Texture dummy_shadow_tx_ = {
"Volume.Dummy Shadow Tx"};
422 Texture dummy_volume_tx_ = {
"Volume.Dummy Volume Tx"};
423 Texture dummy_coba_tx_ = {
"Volume.Dummy Coba Tx"};
425 GPUTexture *stencil_tx_ =
nullptr;
445 void draw_slice_ps(
Manager &manager,
452 void draw_volume_ps(
Manager &manager,
463 bool enabled_ =
false;
476 static const int kernel_radius_ = 3;
477 static const int samples_len_ = (kernel_radius_ * 2 + 1) * (kernel_radius_ * 2 + 1);
479 bool enabled_ =
false;
494 PassSimple down_ps_ = {
"Workbench.DoF.DownSample"};
495 PassSimple down2_ps_ = {
"Workbench.DoF.DownSample2"};
497 PassSimple blur2_ps_ = {
"Workbench.DoF.Blur2"};
498 PassSimple resolve_ps_ = {
"Workbench.DoF.Resolve"};
500 float aperture_size_ = 0;
502 float invsensor_size_ = 0;
516 void setup_samples();
521 bool enabled_ =
false;
523 float weight_accum_ = 0;
525 float weights_[9] = {0};
527 float weights_sum_ = 0;
529 Texture sample0_depth_tx_ = {
"sample0_depth_tx"};
530 Texture sample0_depth_in_front_tx_ = {
"sample0_depth_in_front_tx"};
532 Texture taa_accumulation_tx_ = {
"taa_accumulation_tx"};
533 Texture smaa_search_tx_ = {
"smaa_search_tx"};
534 Texture smaa_area_tx_ = {
"smaa_area_tx"};
538 Framebuffer taa_accumulation_fb_ = {
"taa_accumulation_fb"};
541 Framebuffer smaa_resolve_fb_ = {
"smaa_resolve_fb"};
542 Framebuffer overlay_depth_fb_ = {
"overlay_depth_fb"};
545 float smaa_mix_factor_ = 0;
547 PassSimple taa_accumulation_ps_ = {
"TAA.Accumulation"};
548 PassSimple smaa_edge_detect_ps_ = {
"SMAA.EdgeDetect"};
549 PassSimple smaa_aa_weight_ps_ = {
"SMAA.BlendWeights"};
550 PassSimple smaa_resolve_ps_ = {
"SMAA.Resolve"};
551 PassSimple overlay_depth_ps_ = {
"Overlay Depth"};
567 GPUTexture *depth_in_front_tx);
@ V3D_SHADING_SINGLE_COLOR
#define GPU_BATCH_DISCARD_SAFE(batch)
View(const char *name, int view_len=1, bool procedural=false)
virtual VisibilityBuf & get_visibility_buffer()
detail::PassBase< command::DrawMultiBuf > Sub
void setup_view(View &view, const SceneState &scene_state)
void draw(const DRWContext *draw_ctx, Manager &manager, View &view, const SceneState &scene_state, SceneResources &resources, GPUTexture *depth_in_front_tx)
void sync(const SceneState &scene_state, SceneResources &resources)
void setup_resolve_pass(PassSimple &pass, SceneResources &resources)
void sync(SceneResources &resources, const DRWContext *draw_ctx)
void draw(Manager &manager, View &view, SceneResources &resources, int2 resolution)
MeshPass(const char *name)
void init_pass(SceneResources &resources, DRWState state, int clip_planes)
void init_subpasses(ePipelineType pipeline, eLightingType lighting, bool clip)
void sync(const SceneState &scene_state, SceneResources &resources)
GPUTexture * deferred_ps_stencil_tx
MeshPass gbuffer_in_front_ps_
TextureFromPool gbuffer_material_tx
Texture shadow_depth_stencil_tx
Framebuffer gbuffer_in_front_fb
TextureFromPool gbuffer_normal_tx
void draw(Manager &manager, SceneResources &resources)
void sync(SceneResources &resources)
StaticShader smaa_aa_weight
GPUShader * volume_get(bool smoke, int interpolation, bool coba, bool slice)
StaticShader taa_accumulation
StaticShader transparent_resolve
GPUShader * resolve_get(eLightingType lighting_type, bool cavity=false, bool curvature=false, bool shadow=false)
GPUShader * shadow_get(bool depth_pass, bool manifold, bool cap=false)
StaticShader shadow_visibility_static
StaticShader smaa_resolve
StaticShader dof_downsample
StaticShader smaa_edge_detect
GPUShader * prepass_get(eGeometryType geometry_type, ePipelineType pipeline_type, eLightingType lighting_type, eShaderType shader_type, bool clip)
StaticShader shadow_visibility_dynamic
StaticShader overlay_depth
static ShaderCache & get()
void draw(Manager &manager, View &view, SceneResources &resources, GPUTexture &depth_stencil_tx, bool force_fail_method)
void object_sync(SceneState &scene_state, ObjectRef &ob_ref, ResourceHandle handle, const bool has_transp_mat)
void sync(const SceneState &scene_state, SceneResources &resources)
TextureFromPool accumulation_tx
MeshPass accumulation_in_front_ps_
void sync(const SceneState &scene_state, SceneResources &resources)
MeshPass accumulation_ps_
Framebuffer transparent_fb
TextureFromPool reveal_tx
void sync(SceneResources &resources)
void object_sync_volume(Manager &manager, SceneResources &resources, const SceneState &scene_state, ObjectRef &ob_ref, float3 color)
void draw(Manager &manager, View &view, SceneResources &resources)
void object_sync_modifier(Manager &manager, SceneResources &resources, const SceneState &scene_state, ObjectRef &ob_ref, ModifierData *md)
IMETHOD void random(Vector &a)
addDelta operator for displacement rotational velocity.
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
StorageArrayBuffer< ObjectBounds, 128 > ObjectBoundsBuf
StorageArrayBuffer< ObjectInfos, 128 > ObjectInfosBuf
StorageArrayBuffer< uint, 4, true > VisibilityBuf
gpu::StaticShader StaticShader
ImageGPUTextures get_material_texture(GPUSamplerState &sampler_state)
static constexpr int geometry_type_len
static constexpr int lighting_type_len
static constexpr int shader_type_len
static constexpr int pipeline_type_len
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
static constexpr GPUSamplerState default_sampler()
static MatBase identity()
GPUSamplerState sampler_state
MaterialTexture()=default
static uint32_t pack_data(float metallic, float roughness, float alpha)
bool use_per_material_batches
MaterialTexture image_paint_override
eV3DShadingColorType color_type
bool show_missing_texture
ObjectState(const DRWContext *draw_ctx, const SceneState &scene_state, const SceneResources &resources, Object *ob)
static const int jitter_tx_size
UniformBuffer< WorldData > world_buf
Framebuffer clear_depth_only_fb
void load_jitter_tx(int total_samples)
MaterialTexture missing_texture
StorageVectorBuffer< Material > material_buf
TextureRef depth_in_front_tx
gpu::Batch * volume_cube_batch
Texture dummy_tile_array_tx
TextureFromPool object_id_tx
Framebuffer clear_in_front_fb
Texture dummy_tile_data_tx
UniformArrayBuffer< float4, 6 > clip_planes_buf
StringRefNull current_matcap
eLightingType lighting_type
bool reset_taa_next_sample
Material material_attribute_color
float4x4 view_projection_matrix
Vector< float4 > clip_planes
Material material_override
eContextObjectMode object_mode