Blender  V3.3
util/color.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __UTIL_COLOR_H__
5 #define __UTIL_COLOR_H__
6 
7 #include "util/math.h"
8 #include "util/types.h"
9 
10 #if !defined(__KERNEL_GPU__) && defined(__KERNEL_SSE2__)
11 # include "util/simd.h"
12 #endif
13 
15 
17 {
18  return ((val <= 0.0f) ? 0 :
19  ((val > (1.0f - 0.5f / 255.0f)) ? 255 : (uchar)((255.0f * val) + 0.5f)));
20 }
21 
23 {
24  uchar r, g, b;
25 
26  r = float_to_byte(c.x);
27  g = float_to_byte(c.y);
28  b = float_to_byte(c.z);
29 
30  return make_uchar4(r, g, b, 0);
31 }
32 
34 {
35  uchar r, g, b, a;
36 
37  r = float_to_byte(c.x);
38  g = float_to_byte(c.y);
39  b = float_to_byte(c.z);
40  a = float_to_byte(c.w);
41 
42  return make_uchar4(r, g, b, a);
43 }
44 
46 {
47  return make_float3(c.x * (1.0f / 255.0f), c.y * (1.0f / 255.0f), c.z * (1.0f / 255.0f));
48 }
49 
51 {
52  return make_float4(
53  c.x * (1.0f / 255.0f), c.y * (1.0f / 255.0f), c.z * (1.0f / 255.0f), c.w * (1.0f / 255.0f));
54 }
55 
57 {
58  if (c < 0.04045f)
59  return (c < 0.0f) ? 0.0f : c * (1.0f / 12.92f);
60  else
61  return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f);
62 }
63 
65 {
66  if (c < 0.0031308f)
67  return (c < 0.0f) ? 0.0f : c * 12.92f;
68  else
69  return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;
70 }
71 
73 {
74  float cmax, cmin, h, s, v, cdelta;
75  float3 c;
76 
77  cmax = fmaxf(rgb.x, fmaxf(rgb.y, rgb.z));
78  cmin = min(rgb.x, min(rgb.y, rgb.z));
79  cdelta = cmax - cmin;
80 
81  v = cmax;
82 
83  if (cmax != 0.0f) {
84  s = cdelta / cmax;
85  }
86  else {
87  s = 0.0f;
88  h = 0.0f;
89  }
90 
91  if (s != 0.0f) {
92  float3 cmax3 = make_float3(cmax, cmax, cmax);
93  c = (cmax3 - rgb) / cdelta;
94 
95  if (rgb.x == cmax)
96  h = c.z - c.y;
97  else if (rgb.y == cmax)
98  h = 2.0f + c.x - c.z;
99  else
100  h = 4.0f + c.y - c.x;
101 
102  h /= 6.0f;
103 
104  if (h < 0.0f)
105  h += 1.0f;
106  }
107  else {
108  h = 0.0f;
109  }
110 
111  return make_float3(h, s, v);
112 }
113 
115 {
116  float i, f, p, q, t, h, s, v;
117  float3 rgb;
118 
119  h = hsv.x;
120  s = hsv.y;
121  v = hsv.z;
122 
123  if (s != 0.0f) {
124  if (h == 1.0f)
125  h = 0.0f;
126 
127  h *= 6.0f;
128  i = floorf(h);
129  f = h - i;
130  rgb = make_float3(f, f, f);
131  p = v * (1.0f - s);
132  q = v * (1.0f - (s * f));
133  t = v * (1.0f - (s * (1.0f - f)));
134 
135  if (i == 0.0f)
136  rgb = make_float3(v, t, p);
137  else if (i == 1.0f)
138  rgb = make_float3(q, v, p);
139  else if (i == 2.0f)
140  rgb = make_float3(p, v, t);
141  else if (i == 3.0f)
142  rgb = make_float3(p, q, v);
143  else if (i == 4.0f)
144  rgb = make_float3(t, p, v);
145  else
146  rgb = make_float3(v, p, q);
147  }
148  else {
149  rgb = make_float3(v, v, v);
150  }
151 
152  return rgb;
153 }
154 
156 {
157  float cmax, cmin, h, s, l;
158 
159  cmax = fmaxf(rgb.x, fmaxf(rgb.y, rgb.z));
160  cmin = min(rgb.x, min(rgb.y, rgb.z));
161  l = min(1.0f, (cmax + cmin) / 2.0f);
162 
163  if (cmax == cmin) {
164  h = s = 0.0f; /* achromatic */
165  }
166  else {
167  float cdelta = cmax - cmin;
168  s = l > 0.5f ? cdelta / (2.0f - cmax - cmin) : cdelta / (cmax + cmin);
169  if (cmax == rgb.x) {
170  h = (rgb.y - rgb.z) / cdelta + (rgb.y < rgb.z ? 6.0f : 0.0f);
171  }
172  else if (cmax == rgb.y) {
173  h = (rgb.z - rgb.x) / cdelta + 2.0f;
174  }
175  else {
176  h = (rgb.x - rgb.y) / cdelta + 4.0f;
177  }
178  }
179  h /= 6.0f;
180 
181  return make_float3(h, s, l);
182 }
183 
185 {
186  float nr, ng, nb, chroma, h, s, l;
187 
188  h = hsl.x;
189  s = hsl.y;
190  l = hsl.z;
191 
192  nr = fabsf(h * 6.0f - 3.0f) - 1.0f;
193  ng = 2.0f - fabsf(h * 6.0f - 2.0f);
194  nb = 2.0f - fabsf(h * 6.0f - 4.0f);
195 
196  nr = clamp(nr, 0.0f, 1.0f);
197  nb = clamp(nb, 0.0f, 1.0f);
198  ng = clamp(ng, 0.0f, 1.0f);
199 
200  chroma = (1.0f - fabsf(2.0f * l - 1.0f)) * s;
201 
202  return make_float3((nr - 0.5f) * chroma + l, (ng - 0.5f) * chroma + l, (nb - 0.5f) * chroma + l);
203 }
204 
205 ccl_device float3 xyY_to_xyz(float x, float y, float Y)
206 {
207  float X, Z;
208 
209  if (y != 0.0f)
210  X = (x / y) * Y;
211  else
212  X = 0.0f;
213 
214  if (y != 0.0f && Y != 0.0f)
215  Z = (1.0f - x - y) / y * Y;
216  else
217  Z = 0.0f;
218 
219  return make_float3(X, Y, Z);
220 }
221 
222 #ifdef __KERNEL_SSE2__
223 /*
224  * Calculate initial guess for arg^exp based on float representation
225  * This method gives a constant bias,
226  * which can be easily compensated by multiplication with bias_coeff.
227  * Gives better results for exponents near 1 (e. g. 4/5).
228  * exp = exponent, encoded as uint32_t
229  * e2coeff = 2^(127/exponent - 127) * bias_coeff^(1/exponent), encoded as uint32_t
230  */
231 template<unsigned exp, unsigned e2coeff> ccl_device_inline ssef fastpow(const ssef &arg)
232 {
233  ssef ret;
234  ret = arg * cast(ssei(e2coeff));
235  ret = ssef(cast(ret));
236  ret = ret * cast(ssei(exp));
237  ret = cast(ssei(ret));
238  return ret;
239 }
240 
241 /* Improve x ^ 1.0f/5.0f solution with Newton-Raphson method */
242 ccl_device_inline ssef improve_5throot_solution(const ssef &old_result, const ssef &x)
243 {
244  ssef approx2 = old_result * old_result;
245  ssef approx4 = approx2 * approx2;
246  ssef t = x / approx4;
247  ssef summ = madd(ssef(4.0f), old_result, t);
248  return summ * ssef(1.0f / 5.0f);
249 }
250 
251 /* Calculate powf(x, 2.4). Working domain: 1e-10 < x < 1e+10 */
252 ccl_device_inline ssef fastpow24(const ssef &arg)
253 {
254  /* max, avg and |avg| errors were calculated in gcc without FMA instructions
255  * The final precision should be better than powf in glibc */
256 
257  /* Calculate x^4/5, coefficient 0.994 was constructed manually to minimize avg error */
258  /* 0x3F4CCCCD = 4/5 */
259  /* 0x4F55A7FB = 2^(127/(4/5) - 127) * 0.994^(1/(4/5)) */
260  ssef x = fastpow<0x3F4CCCCD, 0x4F55A7FB>(arg); // error max = 0.17 avg = 0.0018 |avg| = 0.05
261  ssef arg2 = arg * arg;
262  ssef arg4 = arg2 * arg2;
263 
264  /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
265  x = improve_5throot_solution(x, arg4);
266  /* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
267  x = improve_5throot_solution(x, arg4);
268  /* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
269  x = improve_5throot_solution(x, arg4);
270 
271  return x * (x * x);
272 }
273 
274 ccl_device ssef color_srgb_to_linear(const ssef &c)
275 {
276  sseb cmp = c < ssef(0.04045f);
277  ssef lt = max(c * ssef(1.0f / 12.92f), ssef(0.0f));
278  ssef gtebase = (c + ssef(0.055f)) * ssef(1.0f / 1.055f); /* fma */
279  ssef gte = fastpow24(gtebase);
280  return select(cmp, lt, gte);
281 }
282 #endif /* __KERNEL_SSE2__ */
283 
285 {
286  return make_float3(
288 }
289 
291 {
292  return make_float3(
294 }
295 
297 {
298  return make_float4(
300 }
301 
303 {
304 #ifdef __KERNEL_SSE2__
305  ssef r_ssef;
306  float4 &r = (float4 &)r_ssef;
307  r = c;
308  r_ssef = color_srgb_to_linear(r_ssef);
309  r.w = c.w;
310  return r;
311 #else
312  return make_float4(
314 #endif
315 }
316 
318 {
319  color += one_float3();
320  if (variance) {
321  *variance *= sqr(one_float3() / color);
322  }
323  return log(color);
324 }
325 
327 {
328  return exp(color) - one_float3();
329 }
330 
332 
333 #endif /* __UTIL_COLOR_H__ */
unsigned char uchar
Definition: BLI_sys_types.h:70
_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
_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 t
float float4[4]
#define Z
Definition: GeomUtils.cpp:201
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 and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its X
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 and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its Y
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
Definition: avxf.h:321
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define ccl_device
Definition: cuda/compat.h:32
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_inline
Definition: cuda/compat.h:34
#define powf(x, y)
Definition: cuda/compat.h:103
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_device_inline float3 one_float3()
Definition: math_float3.h:89
ccl_device_inline float3 exp(float3 v)
Definition: math_float3.h:392
ccl_device_inline float3 log(float3 v)
Definition: math_float3.h:397
#define fmaxf(x, y)
Definition: metal/compat.h:228
#define floorf(x)
Definition: metal/compat.h:224
#define make_uchar4(x, y, z, w)
Definition: metal/compat.h:209
#define make_float4(x, y, z, w)
Definition: metal/compat.h:205
#define fabsf(x)
Definition: metal/compat.h:219
#define make_float3(x, y, z)
Definition: metal/compat.h:204
U * cast(T *in)
Definition: Cast.h:13
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
T clamp(const T &a, const T &min, const T &max)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)
return ret
#define min(a, b)
Definition: sort.c:35
float z
float y
float x
float max
ccl_device float3 hsl_to_rgb(float3 hsl)
Definition: util/color.h:184
ccl_device float color_linear_to_srgb(float c)
Definition: util/color.h:64
ccl_device float3 color_highlight_compress(float3 color, ccl_private float3 *variance)
Definition: util/color.h:317
ccl_device float3 xyY_to_xyz(float x, float y, float Y)
Definition: util/color.h:205
ccl_device_inline float4 color_uchar4_to_float4(uchar4 c)
Definition: util/color.h:50
ccl_device uchar4 color_float4_to_uchar4(float4 c)
Definition: util/color.h:33
ccl_device float3 color_srgb_to_linear_v3(float3 c)
Definition: util/color.h:284
ccl_device float4 color_linear_to_srgb_v4(float4 c)
Definition: util/color.h:296
ccl_device float3 rgb_to_hsv(float3 rgb)
Definition: util/color.h:72
ccl_device float3 color_highlight_uncompress(float3 color)
Definition: util/color.h:326
ccl_device float4 color_srgb_to_linear_v4(float4 c)
Definition: util/color.h:302
ccl_device float3 color_linear_to_srgb_v3(float3 c)
Definition: util/color.h:290
ccl_device float3 hsv_to_rgb(float3 hsv)
Definition: util/color.h:114
ccl_device float color_srgb_to_linear(float c)
Definition: util/color.h:56
ccl_device float3 rgb_to_hsl(float3 rgb)
Definition: util/color.h:155
ccl_device_inline float3 color_byte_to_float(uchar4 c)
Definition: util/color.h:45
ccl_device uchar4 color_float_to_byte(float3 c)
Definition: util/color.h:22
CCL_NAMESPACE_BEGIN ccl_device uchar float_to_byte(float val)
Definition: util/color.h:16
ccl_device_inline float sqr(float a)
Definition: util/math.h:746