Blender  V2.93
kernel_montecarlo.h
Go to the documentation of this file.
1 /*
2  * Parts adapted from Open Shading Language with this license:
3  *
4  * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
5  * All Rights Reserved.
6  *
7  * Modifications Copyright 2011, Blender Foundation.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are
11  * met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of Sony Pictures Imageworks nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef __KERNEL_MONTECARLO_CL__
34 #define __KERNEL_MONTECARLO_CL__
35 
37 
38 /* distribute uniform xy on [0,1] over unit disk [-1,1] */
39 ccl_device void to_unit_disk(float *x, float *y)
40 {
41  float phi = M_2PI_F * (*x);
42  float r = sqrtf(*y);
43 
44  *x = r * cosf(phi);
45  *y = r * sinf(phi);
46 }
47 
48 /* return an orthogonal tangent and bitangent given a normal and tangent that
49  * may not be exactly orthogonal */
51 {
52  *b = normalize(cross(N, T));
53  *a = cross(*b, N);
54 }
55 
56 /* sample direction with cosine weighted distributed in hemisphere */
58  const float3 N, float randu, float randv, float3 *omega_in, float *pdf)
59 {
60  to_unit_disk(&randu, &randv);
61  float costheta = sqrtf(max(1.0f - randu * randu - randv * randv, 0.0f));
62  float3 T, B;
63  make_orthonormals(N, &T, &B);
64  *omega_in = randu * T + randv * B + costheta * N;
65  *pdf = costheta * M_1_PI_F;
66 }
67 
68 /* sample direction uniformly distributed in hemisphere */
70  const float3 N, float randu, float randv, float3 *omega_in, float *pdf)
71 {
72  float z = randu;
73  float r = sqrtf(max(0.0f, 1.0f - z * z));
74  float phi = M_2PI_F * randv;
75  float x = r * cosf(phi);
76  float y = r * sinf(phi);
77 
78  float3 T, B;
79  make_orthonormals(N, &T, &B);
80  *omega_in = x * T + y * B + z * N;
81  *pdf = 0.5f * M_1_PI_F;
82 }
83 
84 /* sample direction uniformly distributed in cone */
86  const float3 N, float angle, float randu, float randv, float3 *omega_in, float *pdf)
87 {
88  float zMin = cosf(angle);
89  float z = zMin - zMin * randu + randu;
90  float r = safe_sqrtf(1.0f - sqr(z));
91  float phi = M_2PI_F * randv;
92  float x = r * cosf(phi);
93  float y = r * sinf(phi);
94 
95  float3 T, B;
96  make_orthonormals(N, &T, &B);
97  *omega_in = x * T + y * B + z * N;
98  *pdf = M_1_2PI_F / (1.0f - zMin);
99 }
100 
102 {
103  float zMin = cosf(angle);
104  float z = dot(N, D);
105  if (z > zMin) {
106  return M_1_2PI_F / (1.0f - zMin);
107  }
108  return 0.0f;
109 }
110 
111 /* sample uniform point on the surface of a sphere */
113 {
114  float z = 1.0f - 2.0f * u1;
115  float r = sqrtf(fmaxf(0.0f, 1.0f - z * z));
116  float phi = M_2PI_F * u2;
117  float x = r * cosf(phi);
118  float y = r * sinf(phi);
119 
120  return make_float3(x, y, z);
121 }
122 
123 ccl_device float balance_heuristic(float a, float b)
124 {
125  return (a) / (a + b);
126 }
127 
128 ccl_device float balance_heuristic_3(float a, float b, float c)
129 {
130  return (a) / (a + b + c);
131 }
132 
133 ccl_device float power_heuristic(float a, float b)
134 {
135  return (a * a) / (a * a + b * b);
136 }
137 
138 ccl_device float power_heuristic_3(float a, float b, float c)
139 {
140  return (a * a) / (a * a + b * b + c * c);
141 }
142 
143 ccl_device float max_heuristic(float a, float b)
144 {
145  return (a > b) ? 1.0f : 0.0f;
146 }
147 
148 /* distribute uniform xy on [0,1] over unit disk [-1,1], with concentric mapping
149  * to better preserve stratification for some RNG sequences */
151 {
152  float phi, r;
153  float a = 2.0f * u1 - 1.0f;
154  float b = 2.0f * u2 - 1.0f;
155 
156  if (a == 0.0f && b == 0.0f) {
157  return zero_float2();
158  }
159  else if (a * a > b * b) {
160  r = a;
161  phi = M_PI_4_F * (b / a);
162  }
163  else {
164  r = b;
165  phi = M_PI_2_F - M_PI_4_F * (a / b);
166  }
167 
168  return make_float2(r * cosf(phi), r * sinf(phi));
169 }
170 
171 /* sample point in unit polygon with given number of corners and rotation */
172 ccl_device float2 regular_polygon_sample(float corners, float rotation, float u, float v)
173 {
174  /* sample corner number and reuse u */
175  float corner = floorf(u * corners);
176  u = u * corners - corner;
177 
178  /* uniform sampled triangle weights */
179  u = sqrtf(u);
180  v = v * u;
181  u = 1.0f - u;
182 
183  /* point in triangle */
184  float angle = M_PI_F / corners;
185  float2 p = make_float2((u + v) * cosf(angle), (u - v) * sinf(angle));
186 
187  /* rotate */
188  rotation += corner * 2.0f * angle;
189 
190  float cr = cosf(rotation);
191  float sr = sinf(rotation);
192 
193  return make_float2(cr * p.x - sr * p.y, sr * p.x + cr * p.y);
194 }
195 
197 {
198  float3 R = 2 * dot(N, I) * N - I;
199 
200  /* Reflection rays may always be at least as shallow as the incoming ray. */
201  float threshold = min(0.9f * dot(Ng, I), 0.01f);
202  if (dot(Ng, R) >= threshold) {
203  return N;
204  }
205 
206  /* Form coordinate system with Ng as the Z axis and N inside the X-Z-plane.
207  * The X axis is found by normalizing the component of N that's orthogonal to Ng.
208  * The Y axis isn't actually needed.
209  */
210  float NdotNg = dot(N, Ng);
211  float3 X = normalize(N - NdotNg * Ng);
212 
213  /* Keep math expressions. */
214  /* clang-format off */
215  /* Calculate N.z and N.x in the local coordinate system.
216  *
217  * The goal of this computation is to find a N' that is rotated towards Ng just enough
218  * to lift R' above the threshold (here called t), therefore dot(R', Ng) = t.
219  *
220  * According to the standard reflection equation,
221  * this means that we want dot(2*dot(N', I)*N' - I, Ng) = t.
222  *
223  * Since the Z axis of our local coordinate system is Ng, dot(x, Ng) is just x.z, so we get
224  * 2*dot(N', I)*N'.z - I.z = t.
225  *
226  * The rotation is simple to express in the coordinate system we formed -
227  * since N lies in the X-Z-plane, we know that N' will also lie in the X-Z-plane,
228  * so N'.y = 0 and therefore dot(N', I) = N'.x*I.x + N'.z*I.z .
229  *
230  * Furthermore, we want N' to be normalized, so N'.x = sqrt(1 - N'.z^2).
231  *
232  * With these simplifications,
233  * we get the final equation 2*(sqrt(1 - N'.z^2)*I.x + N'.z*I.z)*N'.z - I.z = t.
234  *
235  * The only unknown here is N'.z, so we can solve for that.
236  *
237  * The equation has four solutions in general:
238  *
239  * N'.z = +-sqrt(0.5*(+-sqrt(I.x^2*(I.x^2 + I.z^2 - t^2)) + t*I.z + I.x^2 + I.z^2)/(I.x^2 + I.z^2))
240  * We can simplify this expression a bit by grouping terms:
241  *
242  * a = I.x^2 + I.z^2
243  * b = sqrt(I.x^2 * (a - t^2))
244  * c = I.z*t + a
245  * N'.z = +-sqrt(0.5*(+-b + c)/a)
246  *
247  * Two solutions can immediately be discarded because they're negative so N' would lie in the
248  * lower hemisphere.
249  */
250  /* clang-format on */
251 
252  float Ix = dot(I, X), Iz = dot(I, Ng);
253  float Ix2 = sqr(Ix), Iz2 = sqr(Iz);
254  float a = Ix2 + Iz2;
255 
256  float b = safe_sqrtf(Ix2 * (a - sqr(threshold)));
257  float c = Iz * threshold + a;
258 
259  /* Evaluate both solutions.
260  * In many cases one can be immediately discarded (if N'.z would be imaginary or larger than
261  * one), so check for that first. If no option is viable (might happen in extreme cases like N
262  * being in the wrong hemisphere), give up and return Ng. */
263  float fac = 0.5f / a;
264  float N1_z2 = fac * (b + c), N2_z2 = fac * (-b + c);
265  bool valid1 = (N1_z2 > 1e-5f) && (N1_z2 <= (1.0f + 1e-5f));
266  bool valid2 = (N2_z2 > 1e-5f) && (N2_z2 <= (1.0f + 1e-5f));
267 
268  float2 N_new;
269  if (valid1 && valid2) {
270  /* If both are possible, do the expensive reflection-based check. */
271  float2 N1 = make_float2(safe_sqrtf(1.0f - N1_z2), safe_sqrtf(N1_z2));
272  float2 N2 = make_float2(safe_sqrtf(1.0f - N2_z2), safe_sqrtf(N2_z2));
273 
274  float R1 = 2 * (N1.x * Ix + N1.y * Iz) * N1.y - Iz;
275  float R2 = 2 * (N2.x * Ix + N2.y * Iz) * N2.y - Iz;
276 
277  valid1 = (R1 >= 1e-5f);
278  valid2 = (R2 >= 1e-5f);
279  if (valid1 && valid2) {
280  /* If both solutions are valid, return the one with the shallower reflection since it will be
281  * closer to the input (if the original reflection wasn't shallow, we would not be in this
282  * part of the function). */
283  N_new = (R1 < R2) ? N1 : N2;
284  }
285  else {
286  /* If only one reflection is valid (= positive), pick that one. */
287  N_new = (R1 > R2) ? N1 : N2;
288  }
289  }
290  else if (valid1 || valid2) {
291  /* Only one solution passes the N'.z criterium, so pick that one. */
292  float Nz2 = valid1 ? N1_z2 : N2_z2;
293  N_new = make_float2(safe_sqrtf(1.0f - Nz2), safe_sqrtf(Nz2));
294  }
295  else {
296  return Ng;
297  }
298 
299  return N_new.x * X + N_new.y * Ng;
300 }
301 
303 
304 #endif /* __KERNEL_MONTECARLO_CL__ */
MINLINE float safe_sqrtf(float a)
_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 z
_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 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 u2
_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 u1
_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
#define X
Definition: GeomUtils.cpp:213
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
#define sinf(x)
#define cosf(x)
#define ccl_device
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define fmaxf(x, y)
#define make_float2(x, y)
#define floorf(x)
#define sqrtf(x)
#define make_float3(x, y, z)
ccl_device float power_heuristic_3(float a, float b, float c)
ccl_device float3 ensure_valid_reflection(float3 Ng, float3 I, float3 N)
ccl_device_inline void sample_cos_hemisphere(const float3 N, float randu, float randv, float3 *omega_in, float *pdf)
ccl_device float3 sample_uniform_sphere(float u1, float u2)
ccl_device_inline void sample_uniform_cone(const float3 N, float angle, float randu, float randv, float3 *omega_in, float *pdf)
ccl_device void make_orthonormals_tangent(const float3 N, const float3 T, float3 *a, float3 *b)
ccl_device float balance_heuristic(float a, float b)
ccl_device float2 regular_polygon_sample(float corners, float rotation, float u, float v)
ccl_device float2 concentric_sample_disk(float u1, float u2)
ccl_device float max_heuristic(float a, float b)
ccl_device float balance_heuristic_3(float a, float b, float c)
ccl_device_inline float pdf_uniform_cone(const float3 N, float3 D, float angle)
ccl_device_inline void sample_uniform_hemisphere(const float3 N, float randu, float randv, float3 *omega_in, float *pdf)
CCL_NAMESPACE_BEGIN ccl_device void to_unit_disk(float *x, float *y)
ccl_device float power_heuristic(float a, float b)
#define T
#define B
#define R
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
#define I
params N
#define min(a, b)
Definition: sort.c:51
float max
__forceinline avxf cross(const avxf &a, const avxf &b)
Definition: util_avxf.h:119
#define M_PI_2_F
Definition: util_math.h:46
ccl_device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b)
Definition: util_math.h:477
#define M_PI_4_F
Definition: util_math.h:49
ccl_device_inline float sqr(float a)
Definition: util_math.h:651
#define M_2PI_F
Definition: util_math.h:69
#define M_1_PI_F
Definition: util_math.h:52
#define M_1_2PI_F
Definition: util_math.h:58
#define M_PI_F
Definition: util_math.h:43
ccl_device_inline float2 normalize(const float2 &a)
ccl_device_inline float dot(const float2 &a, const float2 &b)
ccl_device_inline float2 zero_float2()
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)
Definition: voxel.c:29