36 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
37 .compositor_domain_priority(0);
114 const float gamma = node_storage(
bnode()).gamma;
115 const float inverse_gamma = gamma != 0.0f ? 1.0f / gamma : 0.0f;
143 return geometric_mean != 0.0 ? node_storage(
bnode()).key / geometric_mean : 0.0f;
164 return node_storage(
bnode()).offset;
187 float luminance_coefficients[3];
226 return sum_color(
context(), input) / (input.domain().size.x * input.domain().size.y);
238 float luminance_coefficients[3];
242 return sum / (input.domain().size.x * input.domain().size.y);
248 return std::exp(-node_storage(
bnode()).f);
255 if (node_storage(
bnode()).m != 0.0f) {
256 return node_storage(
bnode()).m;
263 if (log_maximum_luminance == log_minimum_luminance) {
268 const float dynamic_range = log_maximum_luminance - log_minimum_luminance;
269 const float luminance_key = (log_maximum_luminance - average_log_luminance) / (dynamic_range);
271 return 0.3f + 0.7f * std::pow(luminance_key, 1.4f);
278 float luminance_coefficients[3];
281 context(), input_image, luminance_coefficients);
288 float luminance_coefficients[3];
291 return std::log(
math::max(maximum, 1e-5f));
296 float luminance_coefficients[3];
299 return std::log(
math::max(minimum, 1e-5f));
304 return node_storage(
bnode()).c;
309 return node_storage(
bnode()).a;
332 ntype.
declare = file_ns::cmp_node_tonemap_declare;
333 ntype.
draw_buttons = file_ns::node_composit_buts_tonemap;
334 ntype.
initfunc = file_ns::node_composit_init_tonemap;
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_OP_COLOR
#define BLI_assert_unreachable()
@ CMP_NODE_TONE_MAP_PHOTORECEPTOR
@ CMP_NODE_TONE_MAP_SIMPLE
void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value)
void GPU_shader_uniform_3fv(GPUShader *sh, const char *name, const float data[3])
void GPU_shader_bind(GPUShader *shader)
void GPU_shader_uniform_4fv(GPUShader *sh, const char *name, const float data[4])
BLI_INLINE void IMB_colormanagement_get_luminance_coefficients(float r_rgb[3])
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 T sum(const btAlignedObjectArray< T > &items)
float compute_luminance_scale()
void execute_photoreceptor()
float compute_log_minimum_luminance()
float compute_luminance_scale_blend_factor()
float4 compute_average_color()
float compute_geometric_mean_of_luminance()
float4 compute_global_adaptation_level()
CMPNodeToneMapType get_type()
float get_chromatic_adaptation()
float get_light_adaptation()
float compute_average_luminance()
float compute_log_maximum_luminance()
float compute_intensity()
float compute_average_log_luminance()
GPUShader * get_shader(const char *info_name, 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
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 interpolate(const T &a, const T &b, const FactorT &t)
T max(const T &a, const T &b)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void node_composit_init_tonemap(bNodeTree *, bNode *node)
static void node_composit_buts_tonemap(uiLayout *layout, bContext *, PointerRNA *ptr)
static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b)
float sum_log_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients)
float4 sum_color(Context &context, GPUTexture *texture)
float sum_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients)
float maximum_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients)
float minimum_luminance(Context &context, GPUTexture *texture, float3 luminance_coefficients)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
VecBase< float, 4 > float4
void register_node_type_cmp_tonemap()
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)
int RNA_enum_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