Blender V5.0
blender::ed::sculpt_paint::auto_mask::Cache Struct Reference

#include <sculpt_automask.hh>

Public Types

enum class  OcclusionValue : int8_t { Unknown = 0 , Visible = 1 , Occluded = 2 }

Public Member Functions

void calc_cavity_factor (const Depsgraph &depsgraph, const Object &object, const IndexMask &node_mask)

Public Attributes

Settings settings
Array< floatfactor
Array< OcclusionValueocclusion
Array< floatcavity_factor

Detailed Description

Definition at line 49 of file sculpt_automask.hh.

Member Enumeration Documentation

◆ OcclusionValue

Enumerator
Unknown 
Visible 
Occluded 

Definition at line 55 of file sculpt_automask.hh.

Member Function Documentation

◆ calc_cavity_factor()

void blender::ed::sculpt_paint::auto_mask::Cache::calc_cavity_factor ( const Depsgraph & depsgraph,
const Object & object,
const IndexMask & node_mask )

Calculates the cavity factor for a set of nodes.

Has no effect on an individual node level if the factor for a vertex has already been calculated. This data is best calculated outside of any loops that affect the stroke's position, as the curvature calculation is sensitive to small changes, meaning processing inside the normal brush update step may result in odd artifacts from ordering of position updates.

Note
Should be called prior to any call that may use the cavity mode.

Definition at line 1745 of file sculpt_automasking.cc.

References BKE_subdiv_ccg_key_top_level(), BLI_assert, BM_elem_index_get, blender::bke::pbvh::BMesh, BRUSH_AUTOMASKING_CAVITY_ALL, calc_cavity_factor(), blender::ed::sculpt_paint::auto_mask::calc_cavity_factor_bmesh(), blender::ed::sculpt_paint::auto_mask::calc_cavity_factor_grids(), blender::ed::sculpt_paint::auto_mask::calc_cavity_factor_mesh(), cavity_factor, depsgraph, blender::index_mask::IndexMask::foreach_index(), SubdivCCG::grid_area, blender::bke::ccg::grid_range(), blender::bke::pbvh::Grids, i, blender::bke::pbvh::Mesh, blender::bke::pbvh::Tree::nodes(), blender::bke::object::pbvh_get(), settings, SculptSession::subdiv_ccg, blender::bke::pbvh::Tree::type(), and verts.

Referenced by calc_cavity_factor(), and blender::ed::sculpt_paint::do_brush_action().

Member Data Documentation

◆ cavity_factor

◆ factor

Array<float> blender::ed::sculpt_paint::auto_mask::Cache::factor

◆ occlusion

Array<OcclusionValue> blender::ed::sculpt_paint::auto_mask::Cache::occlusion

Cached occlusion values for each vertex. Since calculating the occlusion is so expensive, it's only calculated at the beginning of a stroke and stored for later.

Todo
Ideally the "unknown" state would be stored per node rather than per vertex, with a lock-protected Map<const bke::pbvh::Node , BitVector<>> for example. Currently complications with face domain auto-masking prevent this though. This array can't be a bitmap because it's written to from multiple threads at the same time.

Definition at line 69 of file sculpt_automask.hh.

Referenced by blender::ed::sculpt_paint::auto_mask::calc_view_occlusion_factor().

◆ settings


The documentation for this struct was generated from the following files: