39 .compositor_domain_priority(0);
113 const bool is_circle = node_storage(
bnode()).bktype == 0;
114 const int2 kernel_size =
int2(maximum_defocus_radius * 2 + 1);
115 const int sides = is_circle ? 3 : node_storage(
bnode()).bktype;
116 const float rotation = node_storage(
bnode()).rotation;
117 const float roundness = is_circle ? 1.0f : 0.0f;
119 context(), kernel_size, sides, rotation, roundness, 0.0f, 0.0f);
135 output.allocate_texture(domain);
136 output.bind_as_image(shader,
"output_img");
151 if (node_storage(
bnode()).no_zbuf) {
181 return output_radius;
219 return eroded_radius;
225 if (node_storage(
bnode()).no_zbuf) {
226 return node_storage(
bnode()).maxblur;
231 const float radius = (maximum_diameter / 2.0f) * pixels_per_meter;
249 return math::abs((distance_to_image_of_focus / (f_stop * focal_length)) -
250 (focal_length / f_stop));
262 return (focal_length * focus_distance) / (focus_distance - focal_length);
278 if (!camera_object) {
293 return default_value;
296 switch (
camera->sensor_fit) {
309 return default_value;
325 return reinterpret_cast<Camera *
>(camera_object->
data);
353 ntype.
declare = file_ns::cmp_node_defocus_declare;
354 ntype.
draw_buttons = file_ns::node_composit_buts_defocus;
355 ntype.
initfunc = file_ns::node_composit_init_defocus;
Camera data-block and utility functions.
float BKE_camera_object_dof_distance(const struct Object *ob)
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_OP_FILTER
#define DEFAULT_SENSOR_WIDTH
Object is a sort of wrapper for general info.
void GPU_shader_uniform_1i(GPUShader *sh, const char *name, int value)
void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value)
void GPU_shader_bind(GPUShader *shader)
void GPU_shader_uniform_1b(GPUShader *sh, const char *name, bool value)
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiTemplateID(uiLayout *layout, const bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter=UI_TEMPLATE_ID_FILTER_ALL, bool live_icon=false, const char *text=nullptr)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
struct GPUShader GPUShader
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
ColorGeometry4f default_value
NodeOperation(Context &context, DNode node)
float compute_maximum_defocus_radius()
float compute_distance_to_image_of_focus()
const Scene * get_scene()
float compute_focus_distance()
float compute_pixels_per_meter()
float compute_maximum_diameter_of_circle_of_confusion()
const Camera * get_camera()
const Object * get_camera_object()
Result compute_defocus_radius()
Result compute_defocus_radius_from_depth()
Result compute_defocus_radius_from_scale()
Result & get(Context &context, int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
StaticCacheManager & cache_manager()
virtual const Scene & get_scene() const =0
GPUShader * get_shader(const char *info_name, ResultPrecision precision)
Result create_result(ResultType type, ResultPrecision precision)
NodeOperation(Context &context, DNode node)
const bNode & bnode() const
Result & get_input(StringRef identifier) const
Result & get_result(StringRef identifier)
Context & context() const
virtual Domain compute_domain()
void bind_as_image(GPUShader *shader, const char *image_name, bool read=false) const
void pass_through(Result &target)
void unbind_as_texture() const
const Domain & domain() const
void unbind_as_image() const
bool is_single_value() const
void allocate_texture(Domain domain, bool from_pool=true)
void bind_as_texture(GPUShader *shader, const char *texture_name) const
BokehKernelContainer bokeh_kernels
local_group_size(16, 16) .push_constant(Type b
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr)
static void cmp_node_defocus_declare(NodeDeclarationBuilder &b)
static void node_composit_init_defocus(bNodeTree *, bNode *node)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
void morphological_blur(Context &context, Result &input, Result &output, float2 radius, MorphologicalBlurOperation operation=MorphologicalBlurOperation::Erode, int filter_type=R_FILTER_GAUSS)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void register_node_type_cmp_defocus()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare