15 input_image_ =
nullptr;
16 input_mask_ =
nullptr;
17 red_channel_enabled_ =
true;
18 green_channel_enabled_ =
true;
19 blue_channel_enabled_ =
true;
32 return fallback_value;
42 float input_image_color[4];
47 float level = (input_image_color[0] + input_image_color[1] + input_image_color[2]) / 3.0f;
55 float value = input_mask[0];
56 value =
MIN2(1.0f, value);
57 const float mvalue = 1.0f - value;
59 float level_shadows = 0.0;
60 float level_midtones = 0.0;
61 float level_highlights = 0.0;
63 #define MARGIN_DIV (0.5f / MARGIN)
64 if (level < data_->startmidtones -
MARGIN) {
67 else if (level < data_->startmidtones +
MARGIN) {
69 level_shadows = 1.0f - level_midtones;
71 else if (level < data_->endmidtones -
MARGIN) {
72 level_midtones = 1.0f;
74 else if (level < data_->endmidtones +
MARGIN) {
76 level_midtones = 1.0f - level_highlights;
79 level_highlights = 1.0f;
96 float invgamma = 1.0f / gamma;
99 r = input_image_color[0];
100 g = input_image_color[1];
101 b = input_image_color[2];
107 r = 0.5f + ((
r - 0.5f) * contrast);
108 g = 0.5f + ((
g - 0.5f) * contrast);
109 b = 0.5f + ((
b - 0.5f) * contrast);
117 r = mvalue * input_image_color[0] + value *
r;
118 g = mvalue * input_image_color[1] + value *
g;
119 b = mvalue * input_image_color[2] + value *
b;
121 if (red_channel_enabled_) {
125 output[0] = input_image_color[0];
127 if (green_channel_enabled_) {
131 output[1] = input_image_color[1];
133 if (blue_channel_enabled_) {
137 output[2] = input_image_color[2];
139 output[3] = input_image_color[3];
145 const float *in_color = p.
ins[0];
146 const float *in_mask = p.
ins[1];
148 const float level = (in_color[0] + in_color[1] + in_color[2]) / 3.0f;
149 float level_shadows = 0.0f;
150 float level_midtones = 0.0f;
151 float level_highlights = 0.0f;
152 constexpr
float MARGIN = 0.10f;
154 if (level < data_->startmidtones -
MARGIN) {
155 level_shadows = 1.0f;
157 else if (level < data_->startmidtones +
MARGIN) {
159 level_shadows = 1.0f - level_midtones;
161 else if (level < data_->endmidtones -
MARGIN) {
162 level_midtones = 1.0f;
164 else if (level < data_->endmidtones +
MARGIN) {
166 level_midtones = 1.0f - level_highlights;
169 level_highlights = 1.0f;
189 const float inv_gamma = 1.0f / gamma;
192 float r = luma +
saturation * (in_color[0] - luma);
193 float g = luma +
saturation * (in_color[1] - luma);
194 float b = luma +
saturation * (in_color[2] - luma);
196 r = 0.5f + (
r - 0.5f) * contrast;
197 g = 0.5f + (
g - 0.5f) * contrast;
198 b = 0.5f + (
b - 0.5f) * contrast;
206 const float value =
MIN2(1.0f, in_mask[0]);
207 const float value_ = 1.0f - value;
208 r = value_ * in_color[0] + value *
r;
209 g = value_ * in_color[1] + value *
g;
210 b = value_ * in_color[2] + value *
b;
212 p.
out[0] = red_channel_enabled_ ?
r : in_color[0];
213 p.
out[1] = green_channel_enabled_ ?
g : in_color[1];
214 p.
out[2] = blue_channel_enabled_ ?
b : in_color[2];
215 p.
out[3] = in_color[3];
221 input_image_ =
nullptr;
222 input_mask_ =
nullptr;
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
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 Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise 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 and object coordinate space Combine Create a color from its saturation
ColorCorrectionOperation()
void deinit_execution() override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
void update_memory_buffer_row(PixelCursor &p) override
void init_execution() override
void add_output_socket(DataType datatype)
SocketReader * get_input_socket_reader(unsigned int index)
NodeOperationFlags flags_
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
ccl_global KernelShaderEvalInput ccl_global float * output
BLI_INLINE float color_correct_powf_safe(const float x, const float y, const float fallback_value)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
ColorCorrectionData shadows
ColorCorrectionData midtones
ColorCorrectionData master
ColorCorrectionData highlights
Array< const float * > ins