44 return get_static_cache().
get();
48 get_static_cache().release();
59 return prepass_[int(geometry_type)][int(pipeline_type)][int(lighting_type)][int(shader_type)]
66 bool curvature =
false,
69 return resolve_[int(lighting_type)][cavity][curvature][shadow].get();
74 return shadow_[depth_pass][manifold][cap].get();
79 return volume_[smoke][interpolation][coba][slice].get();
88 "workbench_shadow_visibility_compute_dynamic_pass_type"};
123 static uint32_t pack_data(
float metallic,
float roughness,
float alpha);
125 bool is_transparent();
128inline bool Material::is_transparent()
130 uint32_t full_alpha_ref = 0x00ff0000;
131 return (
packed_data & full_alpha_ref) != full_alpha_ref;
134inline uint32_t Material::pack_data(
float metallic,
float roughness,
float alpha)
137 roughness =
sqrtf(roughness);
141 return (packed_alpha << 16u) | (packed_roughness << 8u) | packed_metallic;
219 static const int max_samples_ = 512;
224 int sample_count_ = 0;
225 bool curvature_enabled_ =
false;
226 bool cavity_enabled_ =
false;
233 void load_samples_buf(
int ssao_samples);
276 void load_jitter_tx(
int total_samples);
281 struct TextureSubPassKey {
293 return this->texture ==
rhs.texture && this->sampler_state ==
rhs.sampler_state &&
294 this->geom_type ==
rhs.geom_type;
306 bool is_empty_ =
false;
352 bool is_empty()
const;
368 bool is_empty()
const;
382 bool is_empty()
const;
385#define DEBUG_SHADOW_VOLUME 0
389 enum PassType { PASS = 0, FAIL, FORCED_FAIL, MAX };
391 class ShadowView :
public View {
392 bool force_fail_method_ =
false;
395 ShadowPass::PassType current_pass_type_ = PASS;
401 ShadowView() :
View(
"ShadowPass.View") {};
403 void setup(
View &
view,
float3 light_direction,
bool force_fail_method);
404 bool debug_object_culling(
Object *ob);
405 void set_mode(PassType type);
411 bool debug_freeze)
override;
420 PassMain pass_ps_ = {
"Shadow.Pass"};
421 PassMain fail_ps_ = {
"Shadow.Fail"};
424 PassMain forced_fail_ps_ = {
"Shadow.ForcedFail"};
428 PassMain::Sub *&get_pass_ptr(PassType type,
bool manifold,
bool cap =
false);
440 const bool has_transp_mat);
446 bool force_fail_method);
457 Texture dummy_shadow_tx_ = {
"Volume.Dummy Shadow Tx"};
458 Texture dummy_volume_tx_ = {
"Volume.Dummy Volume Tx"};
459 Texture dummy_coba_tx_ = {
"Volume.Dummy Coba Tx"};
481 void draw_slice_ps(
Manager &manager,
488 void draw_volume_ps(
Manager &manager,
499 bool enabled_ =
false;
512 static const int kernel_radius_ = 3;
513 static const int samples_len_ = (kernel_radius_ * 2 + 1) * (kernel_radius_ * 2 + 1);
515 bool enabled_ =
false;
530 PassSimple down_ps_ = {
"Workbench.DoF.DownSample"};
531 PassSimple down2_ps_ = {
"Workbench.DoF.DownSample2"};
532 PassSimple down3_ps_ = {
"Workbench.DoF.DownSample3"};
534 PassSimple blur2_ps_ = {
"Workbench.DoF.Blur2"};
535 PassSimple resolve_ps_ = {
"Workbench.DoF.Resolve"};
537 float aperture_size_ = 0;
539 float invsensor_size_ = 0;
553 void setup_samples();
558 bool enabled_ =
false;
560 float weight_accum_ = 0;
562 float weights_[9] = {0};
564 float weights_sum_ = 0;
566 Texture sample0_depth_tx_ = {
"sample0_depth_tx"};
567 Texture sample0_depth_in_front_tx_ = {
"sample0_depth_in_front_tx"};
569 Texture taa_accumulation_tx_ = {
"taa_accumulation_tx"};
570 Texture smaa_search_tx_ = {
"smaa_search_tx"};
571 Texture smaa_area_tx_ = {
"smaa_area_tx"};
575 Framebuffer taa_accumulation_fb_ = {
"taa_accumulation_fb"};
578 Framebuffer smaa_resolve_fb_ = {
"smaa_resolve_fb"};
579 Framebuffer overlay_depth_fb_ = {
"overlay_depth_fb"};
582 float smaa_mix_factor_ = 0;
584 PassSimple taa_accumulation_ps_ = {
"TAA.Accumulation"};
585 PassSimple smaa_edge_detect_ps_ = {
"SMAA.EdgeDetect"};
586 PassSimple smaa_aa_weight_ps_ = {
"SMAA.BlendWeights"};
587 PassSimple smaa_resolve_ps_ = {
"SMAA.Resolve"};
588 PassSimple overlay_depth_ps_ = {
"Overlay Depth"};
@ V3D_SHADING_SINGLE_COLOR
static void View(GHOST_IWindow *window, bool stereo, int eye=0)
#define GPU_BATCH_DISCARD_SAFE(batch)
bool operator==(const AssetWeakReference &a, const AssetWeakReference &b)
unsigned long long int uint64_t
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, gpu::Texture *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)
MeshPass gbuffer_in_front_ps_
TextureFromPool gbuffer_material_tx
gpu::Texture * deferred_ps_stencil_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
gpu::Shader * resolve_get(eLightingType lighting_type, bool cavity=false, bool curvature=false, bool shadow=false)
StaticShader taa_accumulation
gpu::Shader * prepass_get(eGeometryType geometry_type, ePipelineType pipeline_type, eLightingType lighting_type, eShaderType shader_type, bool clip)
StaticShader transparent_resolve
StaticShader shadow_visibility_static
gpu::Shader * volume_get(bool smoke, int interpolation, bool coba, bool slice)
gpu::Shader * shadow_get(bool depth_pass, bool manifold, bool cap=false)
StaticShader smaa_resolve
StaticShader dof_downsample
StaticShader smaa_edge_detect
StaticShader shadow_visibility_dynamic
StaticShader overlay_depth
static ShaderCache & get()
void object_sync(SceneState &scene_state, ObjectRef &ob_ref, ResourceHandleRange handle, const bool has_transp_mat)
void draw(Manager &manager, View &view, SceneResources &resources, gpu::Texture &depth_stencil_tx, bool force_fail_method)
TextureFromPool accumulation_tx
MeshPass accumulation_in_front_ps_
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
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
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
uint64_t get_default_hash(const T &v, const Args &...args)
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)
Material(::Material &mat)
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
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