Blender V5.3
subsurface_random_walk.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "kernel/bvh/bvh.h"
6
8
11
12#include "util/color.h"
13
15
16#ifdef __SUBSURFACE__
17
18/* Random walk subsurface scattering.
19 *
20 * "Practical and Controllable Subsurface Scattering for Production Path
21 * Tracing". Matt Jen-Yuan Chiang, Peter Kutz, Brent Burley. SIGGRAPH 2016. */
22
23/* Support for anisotropy from:
24 * "Path Traced Subsurface Scattering using Anisotropic Phase Functions
25 * and Non-Exponential Free Flights".
26 * Magnus Wrenninge, Ryusuke Villemin, Christophe Hery.
27 * https://graphics.pixar.com/library/PathTracedSubsurface/ */
28
29ccl_device void subsurface_random_walk_remap(const float albedo,
30 const float d,
31 const float g,
32 ccl_private float *sigma_t,
33 ccl_private float *alpha)
34{
35 /* Compute attenuation and scattering coefficients from albedo. */
36 const float g2 = g * g;
37 const float g3 = g2 * g;
38 const float g4 = g3 * g;
39 const float g5 = g4 * g;
40 const float g6 = g5 * g;
41 const float g7 = g6 * g;
42
43 const float A = 1.8260523782f + -1.28451056436f * g + -1.79904629312f * g2 +
44 9.19393289202f * g3 + -22.8215585862f * g4 + 32.0234874259f * g5 +
45 -23.6264803333f * g6 + 7.21067002658f * g7;
46 const float B = 4.98511194385f +
47 0.127355959438f *
48 expf(31.1491581433f * g + -201.847017512f * g2 + 841.576016723f * g3 +
49 -2018.09288505f * g4 + 2731.71560286f * g5 + -1935.41424244f * g6 +
50 559.009054474f * g7);
51 const float C = 1.09686102424f + -0.394704063468f * g + 1.05258115941f * g2 +
52 -8.83963712726f * g3 + 28.8643230661f * g4 + -46.8802913581f * g5 +
53 38.5402837518f * g6 + -12.7181042538f * g7;
54 const float D = 0.496310210422f + 0.360146581622f * g + -2.15139309747f * g2 +
55 17.8896899217f * g3 + -55.2984010333f * g4 + 82.065982243f * g5 +
56 -58.5106008578f * g6 + 15.8478295021f * g7;
57 const float E = 4.23190299701f +
58 0.00310603949088f *
59 expf(76.7316253952f * g + -594.356773233f * g2 + 2448.8834203f * g3 +
60 -5576.68528998f * g4 + 7116.60171912f * g5 + -4763.54467887f * g6 +
61 1303.5318055f * g7);
62 const float F = 2.40602999408f + -2.51814844609f * g + 9.18494908356f * g2 +
63 -79.2191708682f * g3 + 259.082868209f * g4 + -403.613804597f * g5 +
64 302.85712436f * g6 + -87.4370473567f * g7;
65
66 const float blend = powf(albedo, 0.25f);
67
68 *alpha = (1.0f - blend) * A * powf(atanf(B * albedo), C) +
69 blend * D * powf(atanf(E * albedo), F);
70 *alpha = clamp(*alpha, 0.0f, 0.999999f); // because of numerical precision
71
72 const float sigma_t_prime = 1.0f / fmaxf(d, 1e-16f);
73 *sigma_t = sigma_t_prime / (1.0f - g);
74}
75
76/* Mapping from subsurface color and anisotropy to single scatter albedo, taken from
77 * "A Hitchhiker's Guide to Multiple Scattering" by Eugene d'Eon, v0.3.2 Eq (53.7),
78 * https://eugenedeon.com/hitchhikers
79 */
80ccl_device void subsurface_random_walk_remap(const Spectrum color,
81 const Spectrum radius,
82 const float g,
83 ccl_private Spectrum *sigma_t,
84 ccl_private Spectrum *alpha)
85{
86 const Spectrum s_sq = sqr(4.20863f * color -
87 sqrt(9.59217f + 41.6808f * color + 17.7126f * sqr(color)) + 4.09712f);
88 *alpha = safe_divide(1.0f - s_sq, 1.0f - g * s_sq);
89
90 /* Clamp to avoid numerical issues. */
91 *alpha = clamp(*alpha, zero_spectrum(), make_spectrum(0.999999f));
92
93 *sigma_t = reciprocal(max(radius, make_spectrum(1e-16f)));
94}
95
96ccl_device void subsurface_random_walk_coefficients(const Spectrum albedo,
97 const Spectrum radius,
98 const float anisotropy,
99 const bool van_de_hulst,
100 ccl_private Spectrum *sigma_t,
101 ccl_private Spectrum *alpha,
102 ccl_private Spectrum *throughput)
103{
104 if (van_de_hulst) {
105 subsurface_random_walk_remap(albedo, radius, anisotropy, sigma_t, alpha);
106 }
107 else {
109 subsurface_random_walk_remap(GET_SPECTRUM_CHANNEL(albedo, i),
110 GET_SPECTRUM_CHANNEL(radius, i),
111 anisotropy,
112 &GET_SPECTRUM_CHANNEL(*sigma_t, i),
113 &GET_SPECTRUM_CHANNEL(*alpha, i));
114 }
115 }
116
117 /* Throughput already contains closure weight at this point, which includes the
118 * albedo, as well as closure mixing and Fresnel weights. Divide out the albedo
119 * which will be added through scattering. */
120 *throughput = safe_divide_color(*throughput, albedo);
121
122 /* With low albedo values (like 0.025) we get diffusion_length 1.0 and
123 * infinite phase functions. To avoid a sharp discontinuity as we go from
124 * such values to 0.0, increase alpha and reduce the throughput to compensate. */
125 const float min_alpha = 0.2f;
127 if (GET_SPECTRUM_CHANNEL(*alpha, i) < min_alpha) {
128 GET_SPECTRUM_CHANNEL(*throughput, i) *= GET_SPECTRUM_CHANNEL(*alpha, i) / min_alpha;
129 GET_SPECTRUM_CHANNEL(*alpha, i) = min_alpha;
130 }
131 }
132}
133
134/* References for Dwivedi sampling:
135 *
136 * [1] "A Zero-variance-based Sampling Scheme for Monte Carlo Subsurface Scattering"
137 * by Jaroslav Křivánek and Eugene d'Eon (SIGGRAPH 2014)
138 * https://cgg.mff.cuni.cz/~jaroslav/papers/2014-zerovar/
139 *
140 * [2] "Improving the Dwivedi Sampling Scheme"
141 * by Johannes Meng, Johannes Hanika, and Carsten Dachsbacher (EGSR 2016)
142 * https://cg.ivd.kit.edu/1951.php
143 *
144 * [3] "Zero-Variance Theory for Efficient Subsurface Scattering"
145 * by Eugene d'Eon and Jaroslav Křivánek (SIGGRAPH 2020)
146 * https://iliyan.com/publications/RenderingCourse2020
147 */
148
149ccl_device_forceinline float eval_phase_dwivedi(const float v,
150 const float phase_log,
151 const float cos_theta)
152{
153 /* Eq. 9 from [2] using precomputed log((v + 1) / (v - 1)) */
154 return 1.0f / ((v - cos_theta) * phase_log);
155}
156
157ccl_device_forceinline float sample_phase_dwivedi(const float v,
158 const float phase_log,
159 const float rand)
160{
161 /* Based on Eq. 10 from [2]: `v - (v + 1) * pow((v - 1) / (v + 1), rand)`
162 * Since we're already pre-computing `phase_log = log((v + 1) / (v - 1))` for the evaluation,
163 * we can implement the power function like this. */
164 return v - (v + 1.0f) * expf(-rand * phase_log);
165}
166
167ccl_device_forceinline float diffusion_length_dwivedi(const float alpha)
168{
169 /* Eq. 67 from [3] */
170 return 1.0f / sqrtf(1.0f - powf(alpha, 2.44294f - 0.0215813f * alpha + 0.578637f / alpha));
171}
172
173ccl_device_forceinline float3 direction_from_cosine(const float3 D,
174 const float cos_theta,
175 const float randv)
176{
177 const float phi = M_2PI_F * randv;
179
180 float3 T;
181 float3 B;
182 make_orthonormals(D, &T, &B);
183 return to_global(dir, T, B, D);
184}
185
186ccl_device_forceinline Spectrum subsurface_random_walk_pdf(Spectrum sigma_t,
187 const float t,
188 bool hit,
189 ccl_private Spectrum *transmittance)
190{
191 const Spectrum T = volume_color_transmittance(sigma_t, t);
192 if (transmittance) {
193 *transmittance = T;
194 }
195 return hit ? T : sigma_t * T;
196}
197
198/* Define the below variable to get the similarity code active,
199 * and the value represents the cutoff level */
200# define SUBSURFACE_RANDOM_WALK_SIMILARITY_LEVEL 9
201
202ccl_device_inline bool subsurface_random_walk(KernelGlobals kg,
204 RNGState rng_state,
205 ccl_private Ray &ray,
207{
208 const float3 P = INTEGRATOR_STATE(state, ray, P);
209 const float3 D = INTEGRATOR_STATE(state, ray, D);
210 const float ray_dP = INTEGRATOR_STATE(state, ray, dP);
211 const float time = INTEGRATOR_STATE(state, ray, time);
212 const float3 N = INTEGRATOR_STATE(state, subsurface, N);
213 const int object = INTEGRATOR_STATE(state, isect, object);
214 const int prim = INTEGRATOR_STATE(state, isect, prim);
215
216 /* Setup ray. */
217 ray.P = P;
218 ray.D = D;
219 ray.tmin = 0.0f;
220 ray.tmax = FLT_MAX;
221 ray.time = time;
222 ray.dP = ray_dP;
223 ray.dD = differential_zero_compact();
224 ray.self.object = object;
225 ray.self.prim = prim;
226 ray.self.light_object = OBJECT_NONE;
227 ray.self.light_prim = PRIM_NONE;
228
229 /* Convert subsurface to volume coefficients.
230 * The single-scattering albedo is named alpha to avoid confusion with the surface albedo. */
231 const Spectrum albedo = INTEGRATOR_STATE(state, subsurface, albedo);
232 const Spectrum radius = INTEGRATOR_STATE(state, subsurface, radius);
233 float anisotropy = INTEGRATOR_STATE(state, subsurface, anisotropy);
234
235 bool van_de_hulst;
236 if (anisotropy >= 1.0f) {
237 /* Legacy random walk was mapped from (-1, 1) to (1, 3) when stored in integrator state.
238 * Remap to the original value. */
239 anisotropy -= 2.0f;
240 /* Legacy mapping doesn't support negative range, use Van de Hulst instead. */
241 van_de_hulst = anisotropy < 0.0f;
242 }
243 else {
244 /* Use Van de Hulst mapping for the new random walk model. */
245 van_de_hulst = true;
246 }
247
248 Spectrum sigma_t;
249 Spectrum alpha;
250 Spectrum throughput = INTEGRATOR_STATE(state, path, throughput);
251 subsurface_random_walk_coefficients(
252 albedo, radius, anisotropy, van_de_hulst, &sigma_t, &alpha, &throughput);
253 const Spectrum sigma_s = sigma_t * alpha;
254
255 /* Theoretically it should be better to use the exact alpha for the channel we're sampling at
256 * each bounce, but in practice there doesn't seem to be a noticeable difference in exchange
257 * for making the code significantly more complex and slower (if direction sampling depends on
258 * the sampled channel, we need to compute its PDF per-channel and consider it for MIS later on).
259 *
260 * Since the strength of the guided sampling increases as alpha gets lower, using a value that
261 * is too low results in fireflies while one that's too high just gives a bit more noise.
262 * Therefore, the code here uses the highest of the three albedos to be safe. */
263 const float diffusion_length = diffusion_length_dwivedi(reduce_max(alpha));
264
265 if (diffusion_length == 1.0f) {
266 /* With specific values of alpha the length might become 1, which in asymptotic makes phase to
267 * be infinite. After first bounce it will cause throughput to be 0. Do early output, avoiding
268 * numerical issues and extra unneeded work. */
269 return false;
270 }
271
272 /* Precompute term for phase sampling. */
273 const float phase_log = logf((diffusion_length + 1.0f) / (diffusion_length - 1.0f));
274
275 /* Modify state for RNGs, decorrelated from other paths. */
276 path_state_rng_scramble(&rng_state, 0xdeadbeef);
277
278 /* Random walk until we hit the surface again. */
279 bool hit = false;
280 bool have_opposite_interface = false;
281 float opposite_distance = 0.0f;
282
283 /* TODO: Disable for `alpha > 0.999` or so? */
284 /* Our heuristic, a compromise between guiding and classic. */
285 const float guided_fraction = 1.0f - fmaxf(0.5f, powf(fabsf(anisotropy), 0.125f));
286
287# ifdef SUBSURFACE_RANDOM_WALK_SIMILARITY_LEVEL
288 const Spectrum sigma_s_star = sigma_s * (1.0f - anisotropy);
289 const Spectrum sigma_t_star = sigma_t - sigma_s + sigma_s_star;
290 const Spectrum sigma_t_org = sigma_t;
291 const Spectrum sigma_s_org = sigma_s;
292 const float anisotropy_org = anisotropy;
293 const float guided_fraction_org = guided_fraction;
294# endif
295
296 for (int bounce = 0; bounce < BSSRDF_MAX_BOUNCES; bounce++) {
297 /* Advance random number offset. */
298 rng_state.rng_offset += PRNG_BOUNCE_NUM;
299
300# ifdef SUBSURFACE_RANDOM_WALK_SIMILARITY_LEVEL
301 // shadow with local variables according to depth
302 float anisotropy;
303 float guided_fraction;
304 Spectrum sigma_s;
305 Spectrum sigma_t;
306 if (bounce <= SUBSURFACE_RANDOM_WALK_SIMILARITY_LEVEL) {
307 anisotropy = anisotropy_org;
308 guided_fraction = guided_fraction_org;
309 sigma_t = sigma_t_org;
310 sigma_s = sigma_s_org;
311 }
312 else {
313 anisotropy = 0.0f;
314 guided_fraction = 0.75f; // back to isotropic heuristic from Blender
315 sigma_t = sigma_t_star;
316 sigma_s = sigma_s_star;
317 }
318# endif
319
320 /* Sample color channel, use MIS with balance heuristic. */
321 float rchannel = path_state_rng_1D(kg, &rng_state, PRNG_SUBSURFACE_COLOR_CHANNEL);
322 Spectrum channel_pdf;
323 const int channel = volume_sample_channel(alpha, throughput, &rchannel, &channel_pdf);
324 float sample_sigma_t = volume_channel_get(sigma_t, channel);
325 const float randt = path_state_rng_1D(kg, &rng_state, PRNG_SUBSURFACE_SCATTER_DISTANCE);
326
327 /* We need the result of the ray-cast to compute the full guided PDF, so just remember the
328 * relevant terms to avoid recomputing them later. */
329 float backward_fraction = 0.0f;
330 float forward_pdf_factor = 0.0f;
331 float forward_stretching = 1.0f;
332 float backward_pdf_factor = 0.0f;
333 float backward_stretching = 1.0f;
334
335 /* For the initial ray, we already know the direction, so just do classic distance sampling. */
336 if (bounce > 0) {
337 /* Decide whether we should use guided or classic sampling. */
338 const bool guided = (path_state_rng_1D(kg, &rng_state, PRNG_SUBSURFACE_GUIDE_STRATEGY) <
339 guided_fraction);
340
341 /* Determine if we want to sample away from the incoming interface.
342 * This only happens if we found a nearby opposite interface, and the probability for it
343 * depends on how close we are to it already.
344 * This probability term comes from the recorded presentation of [3]. */
345 bool guide_backward = false;
346 if (have_opposite_interface) {
347 /* Compute distance of the random walk between the tangent plane at the starting point
348 * and the assumed opposite interface (the parallel plane that contains the point we
349 * found in our ray query for the opposite side). */
350 const float x = clamp(dot(ray.P - P, -N), 0.0f, opposite_distance);
351 backward_fraction = 1.0f /
352 (1.0f + expf((opposite_distance - 2.0f * x) / diffusion_length));
353 guide_backward = path_state_rng_1D(kg, &rng_state, PRNG_SUBSURFACE_GUIDE_DIRECTION) <
354 backward_fraction;
355 }
356
357 /* Sample scattering direction. */
358 const float2 rand_scatter = path_state_rng_2D(kg, &rng_state, PRNG_SUBSURFACE_BSDF);
359 float cos_theta;
360 float hg_pdf;
361 if (guided) {
362 cos_theta = sample_phase_dwivedi(diffusion_length, phase_log, rand_scatter.x);
363 /* The backwards guiding distribution is just mirrored along `sd->N`, so swapping the
364 * sign here is enough to sample from that instead. */
365 if (guide_backward) {
367 }
368 const float3 newD = direction_from_cosine(N, cos_theta, rand_scatter.y);
369 hg_pdf = phase_henyey_greenstein(dot(ray.D, newD), anisotropy);
370 ray.D = newD;
371 }
372 else {
374 ray.D, anisotropy, rand_scatter, &hg_pdf);
375 cos_theta = dot(newD, N);
376 ray.D = newD;
377 }
378
379 /* Compute PDF factor caused by phase sampling (as the ratio of guided / classic).
380 * Since phase sampling is channel-independent, we can get away with applying a factor
381 * to the guided PDF, which implicitly means pulling out the classic PDF term and letting
382 * it cancel with an equivalent term in the numerator of the full estimator.
383 * For the backward PDF, we again reuse the same probability distribution with a sign swap.
384 */
385 forward_pdf_factor = M_1_2PI_F * eval_phase_dwivedi(diffusion_length, phase_log, cos_theta) /
386 hg_pdf;
387 backward_pdf_factor = M_1_2PI_F *
388 eval_phase_dwivedi(diffusion_length, phase_log, -cos_theta) / hg_pdf;
389
390 /* Prepare distance sampling.
391 * For the backwards case, this also needs the sign swapped since now directions against
392 * `sd->N` (and therefore with negative cos_theta) are preferred. */
393 forward_stretching = (1.0f - cos_theta / diffusion_length);
394 backward_stretching = (1.0f + cos_theta / diffusion_length);
395 if (guided) {
396 sample_sigma_t *= guide_backward ? backward_stretching : forward_stretching;
397 }
398 }
399
400 /* Sample distance along ray. */
401 float t = -logf(1.0f - randt) / sample_sigma_t;
402
403 /* On the first bounce, we use the ray-cast to check if the opposite side is nearby.
404 * If yes, we will later use backwards guided sampling in order to have a decent
405 * chance of connecting to it.
406 * TODO: Maybe use less than 10 times the mean free path? */
407 if (bounce == 0) {
408 ray.tmax = max(t, 10.0f / (reduce_min(sigma_t)));
409 }
410 else {
411 ray.tmax = t;
412 /* After the first bounce the object can intersect the same surface again */
413 ray.self.object = OBJECT_NONE;
414 ray.self.prim = PRIM_NONE;
415 }
416 scene_intersect_local<true>(kg, &ray, &ss_isect, object, nullptr, 1);
417 hit = (ss_isect.num_hits > 0);
418
419 if (hit) {
420 ray.tmax = ss_isect.hits[0].t;
421 }
422
423 if (bounce == 0) {
424 /* Check if we hit the opposite side. */
425 if (hit) {
426 have_opposite_interface = true;
427 opposite_distance = dot(ray.P + ray.tmax * ray.D - P, -N);
428 }
429 /* Apart from the opposite side check, we were supposed to only trace up to distance t,
430 * so check if there would have been a hit in that case. */
431 hit = ray.tmax < t;
432 }
433
434 /* Use the distance to the exit point for the throughput update if we found one. */
435 if (hit) {
436 t = ray.tmax;
437 }
438
439 /* Advance to new scatter location. */
440 ray.P += t * ray.D;
441
442 Spectrum transmittance;
443 Spectrum pdf = subsurface_random_walk_pdf(sigma_t, t, hit, &transmittance);
444 if (bounce > 0) {
445 /* Compute PDF just like we do for classic sampling, but with the stretched sigma_t. */
446 Spectrum guided_pdf = subsurface_random_walk_pdf(
447 forward_stretching * sigma_t, t, hit, nullptr);
448
449 if (have_opposite_interface) {
450 /* First step of MIS: Depending on geometry we might have two methods for guided
451 * sampling, so perform MIS between them. */
452 const Spectrum back_pdf = subsurface_random_walk_pdf(
453 backward_stretching * sigma_t, t, hit, nullptr);
454 guided_pdf = mix(
455 guided_pdf * forward_pdf_factor, back_pdf * backward_pdf_factor, backward_fraction);
456 }
457 else {
458 /* Just include phase sampling factor otherwise. */
459 guided_pdf *= forward_pdf_factor;
460 }
461
462 /* Now we apply the MIS balance heuristic between the classic and guided sampling. */
463 pdf = mix(pdf, guided_pdf, guided_fraction);
464 }
465
466 /* Finally, we're applying MIS again to combine the three color channels.
467 * Altogether, the MIS computation combines up to nine different estimators:
468 * {classic, guided, backward_guided} x {r, g, b} */
469 throughput *= (hit ? transmittance : sigma_s * transmittance) / dot(channel_pdf, pdf);
470
471 if (hit) {
472 /* If we hit the surface, we are done. */
473 break;
474 }
475 if (reduce_max(throughput) < VOLUME_THROUGHPUT_EPSILON) {
476 /* Avoid unnecessary work and precision issue when throughput gets really small. */
477 break;
478 }
479 }
480
481 if (hit) {
482 kernel_assert(isfinite_safe(throughput));
483
484 /* TODO(lukas): Which PDF should we report here? Entry bounce? The random walk? Just 1.0? */
486 kg,
487 state,
488 1.0f,
489 N,
490 D,
491 safe_divide_color(throughput, INTEGRATOR_STATE(state, path, throughput)),
492 albedo);
493
494 INTEGRATOR_STATE_WRITE(state, path, throughput) = throughput;
495 }
496
497 return hit;
498}
499
500#endif /* __SUBSURFACE__ */
501
#define D
#define C
Definition RandGen.cpp:29
#define A
ccl_device_inline float cos_theta(const float3 w)
btScalar max
ccl_device_inline Spectrum safe_divide_color(Spectrum a, Spectrum b, const float fallback=0.0f)
Definition color.h:376
ccl_device float3 spherical_cos_to_direction(const float cos_theta, const float phi)
#define kernel_assert(cond)
#define ccl_device_forceinline
#define PRIM_NONE
#define zero_spectrum
#define OBJECT_NONE
#define make_spectrum(f)
#define ccl_private
#define ccl_device_inline
#define BSSRDF_MAX_BOUNCES
#define FOREACH_SPECTRUM_CHANNEL(counter)
#define M_1_2PI_F
#define GET_SPECTRUM_CHANNEL(v, i)
#define logf(x)
#define expf(x)
#define powf(x, y)
#define CCL_NAMESPACE_END
ccl_device_forceinline float differential_zero_compact()
#define FLT_MAX
float dot(VecOp< float, D >, VecOp< float, D >) RET
#define sqrt
constexpr T clamp(T, U, U) RET
float safe_divide(float a, float b)
float reduce_min(float2 a)
float reduce_max(float2 a)
#define VOLUME_THROUGHPUT_EPSILON
ccl_device Spectrum volume_color_transmittance(Spectrum sigma, const float t)
ccl_device int volume_sample_channel(Spectrum albedo, Spectrum throughput, ccl_private float *rand, ccl_private Spectrum *pdf)
ccl_device float volume_channel_get(Spectrum value, const int channel)
const int state
ccl_device_forceinline void guiding_record_bssrdf_bounce(ccl_attr_maybe_unused KernelGlobals kg, ccl_attr_maybe_unused IntegratorState state, ccl_attr_maybe_unused const float pdf, ccl_attr_maybe_unused const float3 N, ccl_attr_maybe_unused const float3 wo, ccl_attr_maybe_unused const Spectrum weight, ccl_attr_maybe_unused const Spectrum albedo)
@ PRNG_SUBSURFACE_COLOR_CHANNEL
@ PRNG_BOUNCE_NUM
@ PRNG_SUBSURFACE_BSDF
@ PRNG_SUBSURFACE_GUIDE_STRATEGY
@ PRNG_SUBSURFACE_SCATTER_DISTANCE
@ PRNG_SUBSURFACE_GUIDE_DIRECTION
ccl_device_inline bool isfinite_safe(const float f)
Definition math_base.h:362
ccl_device_inline float3 reciprocal(const float3 a)
Definition math_float3.h:36
ccl_device_inline void make_orthonormals(const float3 N, ccl_private float3 *a, ccl_private float3 *b)
#define N
#define T
#define B
#define F
std::string time(const std::tm &date_time, TimeFormat format=TimeFormat::H24)
ATTR_WARN_UNUSED_RESULT const BMVert * v
ccl_device_inline float path_state_rng_1D(KernelGlobals kg, const ccl_private RNGState *rng_state, const int dimension)
Definition path_state.h:361
ccl_device_inline void path_state_rng_scramble(ccl_private RNGState *rng_state, const int seed)
Definition path_state.h:353
ccl_device_inline float2 path_state_rng_2D(KernelGlobals kg, const ccl_private RNGState *rng_state, const int dimension)
Definition path_state.h:369
#define mix
#define sqr
#define fabsf
#define sqrtf
#define ccl_device
#define M_2PI_F
#define atanf
#define fmaxf
#define INTEGRATOR_STATE_WRITE(state, nested_struct, member)
Definition state.h:235
#define INTEGRATOR_STATE(state, nested_struct, member)
Definition state.h:234
IntegratorStateCPU * IntegratorState
Definition state.h:227
uint rng_offset
Definition path_state.h:333
float x
float y
CCL_NAMESPACE_BEGIN ccl_device_inline T to_global(const float2 p, const T X, const T Y)
Definition transform.h:21
float3 Spectrum
ccl_device float3 phase_henyey_greenstein_sample(const float3 D, const float g, const float2 rand, ccl_private float *pdf)
Definition volume_util.h:36
ccl_device float phase_henyey_greenstein(const float cos_theta, const float g)
Definition volume_util.h:27