Blender V5.0
kernel/integrator/guiding.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#pragma once
6
7#include "kernel/globals.h"
8#include "kernel/types.h"
9
12
13/* FIXME: The below include could be guarded behind `ifdef WITH_CYCLES_DEBUG`, but Metal
14 * pre-processing is not expanding guarded include files properly. */
15#include "kernel/closure/bsdf.h"
16
17#include "util/color.h"
18
20
21/* Utilities. */
22
26 /* The relative IOR of the outgoing media and the incoming media. */
27 float eta{1.0f};
28 int label;
30 float bsdf_pdf{0.0f};
31 float guide_pdf{0.0f};
32 float ris_target{0.0f};
33 float ris_pdf{0.0f};
34 float ris_weight{0.0f};
35
38 float avg_bsdf_eval{0.0f};
40};
41
43 const ccl_private float guiding_sampling_prob)
44{
45#if defined(__PATH_GUIDING__)
46 const float pi_factor = 2.0f;
47 if (ris_sample->avg_bsdf_eval > 0.0f && ris_sample->bsdf_pdf > 1e-10f &&
48 ris_sample->guide_pdf > 0.0f)
49 {
50 ris_sample->ris_target = (ris_sample->avg_bsdf_eval *
51 ((((1.0f - guiding_sampling_prob) * (1.0f / (pi_factor * M_PI_F))) +
52 (guiding_sampling_prob * ris_sample->incoming_radiance_pdf))));
53 ris_sample->ris_pdf = (0.5f * (ris_sample->bsdf_pdf + ris_sample->guide_pdf));
54 ris_sample->ris_weight = ris_sample->ris_target / ris_sample->ris_pdf;
55 return true;
56 }
57 ris_sample->ris_target = 0.0f;
58 ris_sample->ris_pdf = 0.0f;
59 return false;
60#else
61 return false;
62#endif
63}
64
65#if defined(__PATH_GUIDING__)
66static pgl_vec3f guiding_vec3f(const float3 v)
67{
68 return {v.x, v.y, v.z};
69}
70
71ccl_device_forceinline pgl_point3f guiding_point3f(const float3 v)
72{
73 return {v.x, v.y, v.z};
74}
75#endif
76
77/* Path recording for guiding. */
78
79/* Record Surface Interactions */
80
81/* Records/Adds a new path segment with the current path vertex on a surface.
82 * If the path is not terminated this call is usually followed by a call of
83 * guiding_record_surface_bounce. */
86 const ccl_private ShaderData *sd)
87{
88#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
89 if (!kernel_data.integrator.train_guiding) {
90 return;
91 }
92
94
95 const pgl_vec3f zero = guiding_vec3f(zero_float3());
96 const pgl_vec3f one = guiding_vec3f(one_float3());
97
98 state->guiding.path_segment = kg->opgl_path_segment_storage->NextSegment();
99 openpgl::cpp::SetPosition(state->guiding.path_segment, guiding_point3f(sd->P));
100 openpgl::cpp::SetDirectionOut(state->guiding.path_segment, guiding_vec3f(sd->wi));
101 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, false);
102 openpgl::cpp::SetScatteredContribution(state->guiding.path_segment, zero);
103 openpgl::cpp::SetDirectContribution(state->guiding.path_segment, zero);
104 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, one);
105 openpgl::cpp::SetEta(state->guiding.path_segment, 1.0);
106#endif
107}
108
109/* Records the surface scattering event at the current vertex position of the segment. */
112 const Spectrum weight,
113 const float pdf,
114 const float3 N,
115 const float3 wo,
116 const float2 roughness,
117 const float eta)
118{
119#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
120 if (!kernel_data.integrator.train_guiding) {
121 return;
122 }
123
125
126 const float min_roughness = safe_sqrtf(fminf(roughness.x, roughness.y));
127 const bool is_delta = (min_roughness == 0.0f);
128 const float3 weight_rgb = spectrum_to_rgb(weight);
129 const float3 normal = clamp(N, -one_float3(), one_float3());
130
131 kernel_assert(state->guiding.path_segment != nullptr);
132
133 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, guiding_vec3f(one_float3()));
134 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, false);
135 openpgl::cpp::SetNormal(state->guiding.path_segment, guiding_vec3f(normal));
136 openpgl::cpp::SetDirectionIn(state->guiding.path_segment, guiding_vec3f(wo));
137 openpgl::cpp::SetPDFDirectionIn(state->guiding.path_segment, pdf);
138 openpgl::cpp::SetScatteringWeight(state->guiding.path_segment, guiding_vec3f(weight_rgb));
139 openpgl::cpp::SetIsDelta(state->guiding.path_segment, is_delta);
140 openpgl::cpp::SetEta(state->guiding.path_segment, eta);
141 openpgl::cpp::SetRoughness(state->guiding.path_segment, min_roughness);
142#endif
143}
144
145/* Records the emission at the current surface intersection (physical or virtual) */
148 const Spectrum Le,
149 const float mis_weight)
150{
151#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
152 if (!kernel_data.integrator.train_guiding) {
153 return;
154 }
155
157
158 const float3 Le_rgb = spectrum_to_rgb(Le);
159
160 openpgl::cpp::SetDirectContribution(state->guiding.path_segment, guiding_vec3f(Le_rgb));
161 openpgl::cpp::SetMiWeight(state->guiding.path_segment, mis_weight);
162#endif
163}
164
165/* Record BSSRDF Interactions */
166
167/* Records/Adds a new path segment where the vertex position is the point of entry
168 * of the sub surface scattering boundary.
169 * If the path is not terminated this call is usually followed by a call of
170 * guiding_record_bssrdf_weight and guiding_record_bssrdf_bounce. */
173 const float3 P,
174 const float3 wi)
175{
176#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
177 if (!kernel_data.integrator.train_guiding) {
178 return;
179 }
180
182
183 const pgl_vec3f zero = guiding_vec3f(zero_float3());
184 const pgl_vec3f one = guiding_vec3f(one_float3());
185
186 state->guiding.path_segment = kg->opgl_path_segment_storage->NextSegment();
187 openpgl::cpp::SetPosition(state->guiding.path_segment, guiding_point3f(P));
188 openpgl::cpp::SetDirectionOut(state->guiding.path_segment, guiding_vec3f(wi));
189 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, true);
190 openpgl::cpp::SetScatteredContribution(state->guiding.path_segment, zero);
191 openpgl::cpp::SetDirectContribution(state->guiding.path_segment, zero);
192 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, one);
193 openpgl::cpp::SetEta(state->guiding.path_segment, 1.0);
194#endif
195}
196
197/* Records the transmission of the path at the point of entry while passing
198 * the surface boundary. */
201 const Spectrum weight,
202 const Spectrum albedo)
203{
204#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
205 if (!kernel_data.integrator.train_guiding) {
206 return;
207 }
208
210
211 /* Note albedo left out here, will be included in guiding_record_bssrdf_bounce. */
212 const float3 weight_rgb = spectrum_to_rgb(safe_divide_color(weight, albedo));
213
214 kernel_assert(state->guiding.path_segment != nullptr);
215
216 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, guiding_vec3f(zero_float3()));
217 openpgl::cpp::SetScatteringWeight(state->guiding.path_segment, guiding_vec3f(weight_rgb));
218 openpgl::cpp::SetIsDelta(state->guiding.path_segment, false);
219 openpgl::cpp::SetEta(state->guiding.path_segment, 1.0f);
220 openpgl::cpp::SetRoughness(state->guiding.path_segment, 1.0f);
221#endif
222}
223
224/* Records the direction at the point of entry the path takes when sampling the SSS contribution.
225 * If not terminated this function is usually followed by a call of
226 * guiding_record_volume_transmission to record the transmittance between the point of entry and
227 * the point of exit. */
230 const float pdf,
231 const float3 N,
232 const float3 wo,
233 const Spectrum weight,
234 const Spectrum albedo)
235{
236#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
237 if (!kernel_data.integrator.train_guiding) {
238 return;
239 }
240
242
243 const float3 normal = clamp(N, -one_float3(), one_float3());
244 const float3 weight_rgb = spectrum_to_rgb(weight * albedo);
245
246 kernel_assert(state->guiding.path_segment != nullptr);
247
248 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, false);
249 openpgl::cpp::SetNormal(state->guiding.path_segment, guiding_vec3f(normal));
250 openpgl::cpp::SetDirectionIn(state->guiding.path_segment, guiding_vec3f(wo));
251 openpgl::cpp::SetPDFDirectionIn(state->guiding.path_segment, pdf);
252 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, guiding_vec3f(weight_rgb));
253#endif
254}
255
256/* Record Volume Interactions */
257
258/* Records/Adds a new path segment with the current path vertex being inside a volume.
259 * If the path is not terminated this call is usually followed by a call of
260 * guiding_record_volume_bounce. */
263 const float3 P,
264 const float3 I)
265{
266#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
267 if (!kernel_data.integrator.train_guiding) {
268 return;
269 }
270
272
273 const pgl_vec3f zero = guiding_vec3f(zero_float3());
274 const pgl_vec3f one = guiding_vec3f(one_float3());
275
276 state->guiding.path_segment = kg->opgl_path_segment_storage->NextSegment();
277
278 openpgl::cpp::SetPosition(state->guiding.path_segment, guiding_point3f(P));
279 openpgl::cpp::SetDirectionOut(state->guiding.path_segment, guiding_vec3f(I));
280 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, true);
281 openpgl::cpp::SetScatteredContribution(state->guiding.path_segment, zero);
282 openpgl::cpp::SetDirectContribution(state->guiding.path_segment, zero);
283 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, one);
284 openpgl::cpp::SetEta(state->guiding.path_segment, 1.0);
285#endif
286}
287
288/* Records the volume scattering event at the current vertex position of the segment. */
291 const Spectrum weight,
292 const float pdf,
293 const float3 wo,
294 const float roughness)
295{
296#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
297 if (!kernel_data.integrator.train_guiding) {
298 return;
299 }
300
302
303 const float3 weight_rgb = spectrum_to_rgb(weight);
304 const float3 normal = make_float3(0.0f, 0.0f, 1.0f);
305
306 kernel_assert(state->guiding.path_segment != nullptr);
307
308 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, true);
309 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, guiding_vec3f(one_float3()));
310 openpgl::cpp::SetNormal(state->guiding.path_segment, guiding_vec3f(normal));
311 openpgl::cpp::SetDirectionIn(state->guiding.path_segment, guiding_vec3f(wo));
312 openpgl::cpp::SetPDFDirectionIn(state->guiding.path_segment, pdf);
313 openpgl::cpp::SetScatteringWeight(state->guiding.path_segment, guiding_vec3f(weight_rgb));
314 openpgl::cpp::SetIsDelta(state->guiding.path_segment, false);
315 openpgl::cpp::SetEta(state->guiding.path_segment, 1.0f);
316 openpgl::cpp::SetRoughness(state->guiding.path_segment, roughness);
317#endif
318}
319
320/* Records the transmission (a.k.a. transmittance weight) between the current path segment
321 * and the next one, when the path is inside or passes a volume. */
324 const float3 transmittance_weight)
325{
326#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
327 if (!kernel_data.integrator.train_guiding) {
328 return;
329 }
330
332
333 if (state->guiding.path_segment) {
334 // TODO (sherholz): need to find a better way to avoid this check
335 if ((transmittance_weight[0] < 0.0f || !std::isfinite(transmittance_weight[0]) ||
336 std::isnan(transmittance_weight[0])) ||
337 (transmittance_weight[1] < 0.0f || !std::isfinite(transmittance_weight[1]) ||
338 std::isnan(transmittance_weight[1])) ||
339 (transmittance_weight[2] < 0.0f || !std::isfinite(transmittance_weight[2]) ||
340 std::isnan(transmittance_weight[2])))
341 {
342 }
343 else {
344 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment,
345 guiding_vec3f(transmittance_weight));
346 }
347 }
348#endif
349}
350
351/* Records the emission of a volume at the vertex of the current path segment. */
354 const Spectrum Le)
355{
356#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
357 if (!kernel_data.integrator.train_guiding) {
358 return;
359 }
360
362
363 if (state->guiding.path_segment) {
364 const float3 Le_rgb = spectrum_to_rgb(Le);
365
366 openpgl::cpp::SetDirectContribution(state->guiding.path_segment, guiding_vec3f(Le_rgb));
367 openpgl::cpp::SetMiWeight(state->guiding.path_segment, 1.0f);
368 }
369#endif
370}
371
372/* Record Light Interactions */
373
374/* Adds a pseudo path vertex/segment when intersecting a virtual light source.
375 * (e.g., area, sphere, or disk light). This call is often followed
376 * a call of guiding_record_surface_emission, if the intersected light source
377 * emits light in the direction of the path. */
380{
381#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
382 if (!kernel_data.integrator.train_guiding) {
383 return;
384 }
385
387
388 const pgl_vec3f zero = guiding_vec3f(zero_float3());
389 const pgl_vec3f one = guiding_vec3f(one_float3());
390 const float3 ray_P = INTEGRATOR_STATE(state, ray, P);
391 const float3 ray_D = INTEGRATOR_STATE(state, ray, D);
392 const float3 P = ray_P + isect->t * ray_D;
393
394 state->guiding.path_segment = kg->opgl_path_segment_storage->NextSegment();
395 openpgl::cpp::SetPosition(state->guiding.path_segment, guiding_point3f(P));
396 openpgl::cpp::SetDirectionOut(state->guiding.path_segment, guiding_vec3f(-ray_D));
397 openpgl::cpp::SetNormal(state->guiding.path_segment, guiding_vec3f(-ray_D));
398 openpgl::cpp::SetDirectionIn(state->guiding.path_segment, guiding_vec3f(ray_D));
399 openpgl::cpp::SetPDFDirectionIn(state->guiding.path_segment, 1.0f);
400 openpgl::cpp::SetVolumeScatter(state->guiding.path_segment, false);
401 openpgl::cpp::SetScatteredContribution(state->guiding.path_segment, zero);
402 openpgl::cpp::SetDirectContribution(state->guiding.path_segment, zero);
403 openpgl::cpp::SetTransmittanceWeight(state->guiding.path_segment, one);
404 openpgl::cpp::SetScatteringWeight(state->guiding.path_segment, one);
405 openpgl::cpp::SetEta(state->guiding.path_segment, 1.0f);
406#endif
407}
408
409/* Records/Adds a final path segment when the path leaves the scene and
410 * intersects with a background light (e.g., background color,
411 * distant light, or env map). The vertex for this segment is placed along
412 * the current ray far out the scene. */
415 const Spectrum L,
416 const float mis_weight)
417{
418#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
419 if (!kernel_data.integrator.train_guiding) {
420 return;
421 }
422
424
425 const float3 L_rgb = spectrum_to_rgb(L);
426 const float3 ray_P = INTEGRATOR_STATE(state, ray, P);
427 const float3 ray_D = INTEGRATOR_STATE(state, ray, D);
428 const float3 P = ray_P + (1e6f) * ray_D;
429 const float3 normal = make_float3(0.0f, 0.0f, 1.0f);
430
431 openpgl::cpp::PathSegment background_segment;
432 openpgl::cpp::SetPosition(&background_segment, guiding_vec3f(P));
433 openpgl::cpp::SetNormal(&background_segment, guiding_vec3f(normal));
434 openpgl::cpp::SetDirectionOut(&background_segment, guiding_vec3f(-ray_D));
435 openpgl::cpp::SetDirectContribution(&background_segment, guiding_vec3f(L_rgb));
436 openpgl::cpp::SetMiWeight(&background_segment, mis_weight);
437 kg->opgl_path_segment_storage->AddSegment(background_segment);
438#endif
439}
440
441/* Records direct lighting from either next event estimation or a dedicated BSDF
442 * sampled shadow ray. */
445{
446#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
447 if (!kernel_data.integrator.train_guiding) {
448 return;
449 }
450 if (state->shadow_path.path_segment) {
451 const Spectrum Lo = safe_divide_color(INTEGRATOR_STATE(state, shadow_path, throughput),
452 INTEGRATOR_STATE(state, shadow_path, unlit_throughput));
453
454 const float3 Lo_rgb = spectrum_to_rgb(Lo);
455
456 const float mis_weight = INTEGRATOR_STATE(state, shadow_path, guiding_mis_weight);
457
458 if (mis_weight == 0.0f) {
459 /* Scattered contribution of a next event estimation (i.e., a direct light estimate
460 * scattered at the current path vertex towards the previous vertex). */
461 openpgl::cpp::AddScatteredContribution(state->shadow_path.path_segment,
462 guiding_vec3f(Lo_rgb));
463 }
464 else {
465 /* Dedicated shadow ray for BSDF sampled ray direction.
466 * The mis weight was already folded into the throughput, so need to divide it out. */
467 openpgl::cpp::SetDirectContribution(state->shadow_path.path_segment,
468 guiding_vec3f(Lo_rgb / mis_weight));
469 openpgl::cpp::SetMiWeight(state->shadow_path.path_segment, mis_weight);
470 }
471 }
472#endif
473}
474
475/* Record Russian Roulette */
476/* Records the probability of continuing the path at the current path segment. */
478 KernelGlobals kg, IntegratorState state, const float continuation_probability)
479{
480#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
481 if (!kernel_data.integrator.train_guiding) {
482 return;
483 }
484
486
487 if (state->guiding.path_segment) {
488 openpgl::cpp::SetRussianRouletteProbability(state->guiding.path_segment,
489 continuation_probability);
490 }
491#endif
492}
493
494/* Path guiding debug render passes. */
495
496/* Write a set of path guiding related debug information (e.g., guiding probability at first
497 * bounce) into separate rendering passes. */
500 const ccl_private ShaderData *sd,
503{
504#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
505# ifdef WITH_CYCLES_DEBUG
506 if (!kernel_data.integrator.train_guiding) {
507 return;
508 }
509
510 if (INTEGRATOR_STATE(state, path, bounce) != 0) {
511 return;
512 }
513
515
516 if (kernel_data.film.pass_guiding_probability != PASS_UNUSED) {
517 float guiding_prob = state->guiding.surface_guiding_sampling_prob;
518 film_write_pass_float(buffer + kernel_data.film.pass_guiding_probability, guiding_prob);
519 }
520
521 if (kernel_data.film.pass_guiding_avg_roughness != PASS_UNUSED) {
522 float avg_roughness = 0.0f;
523 float sum_sample_weight = 0.0f;
524 for (int i = 0; i < sd->num_closure; i++) {
525 const ccl_private ShaderClosure *sc = &sd->closure[i];
526
527 if (!CLOSURE_IS_BSDF_OR_BSSRDF(sc->type)) {
528 continue;
529 }
530 avg_roughness += sc->sample_weight * bsdf_get_specular_roughness_squared(sc);
531 sum_sample_weight += sc->sample_weight;
532 }
533
534 avg_roughness = avg_roughness > 0.0f ? avg_roughness / sum_sample_weight : 0.0f;
535
536 film_write_pass_float(buffer + kernel_data.film.pass_guiding_avg_roughness, avg_roughness);
537 }
538# else
539 (void)kg;
540 (void)state;
541 (void)sd;
542 (void)render_buffer;
543# endif
544#endif
545}
546
547/* Guided BSDFs */
548
550 const float3 P,
551 const float3 N,
552 ccl_private float &rand)
553{
554#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
555 if (guiding_ssd->Init(guiding_guiding_field, guiding_point3f(P), rand)) {
556 guiding_ssd->ApplyCosineProduct(guiding_point3f(N));
557 return true;
558 }
559#endif
560 return false;
561}
562
564 const float2 rand_bsdf,
566{
567#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
568 pgl_vec3f pgl_wo;
569 const pgl_point2f rand = {rand_bsdf.x, rand_bsdf.y};
570 const float pdf = guiding_ssd->SamplePDF(rand, pgl_wo);
571 *wo = make_float3(pgl_wo.x, pgl_wo.y, pgl_wo.z);
572 return pdf;
573#else
574 return 0.0f;
575#endif
576}
577
579{
580#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
581 return guiding_ssd->PDF(guiding_vec3f(wo));
582#else
583 return 0.0f;
584#endif
585}
586
588 const float3 wo)
589{
590#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
591 return guiding_ssd->IncomingRadiancePDF(guiding_vec3f(wo));
592#else
593 return 0.0f;
594#endif
595}
596
597/* Guided Volume Phases */
598
600 KernelGlobals kg, const float3 P, const float3 D, const float g, ccl_private float &rand)
601{
602#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
603 /* we do not need to guide almost delta phase functions */
604 if (fabsf(g) >= 0.99f) {
605 return false;
606 }
607
608 if (guiding_vsd->Init(guiding_guiding_field, guiding_point3f(P), rand)) {
609 guiding_vsd->ApplySingleLobeHenyeyGreensteinProduct(guiding_vec3f(D), g);
610 return true;
611 }
612#endif
613
614 return false;
615}
616
618 const float2 rand_phase,
620{
621#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
622 pgl_vec3f pgl_wo;
623 const pgl_point2f rand = {rand_phase.x, rand_phase.y};
624 const float pdf = guiding_vsd->SamplePDF(rand, pgl_wo);
625 *wo = make_float3(pgl_wo.x, pgl_wo.y, pgl_wo.z);
626 return pdf;
627#else
628 return 0.0f;
629#endif
630}
631
633{
634#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
635 return guiding_vsd->PDF(guiding_vec3f(wo));
636#else
637 return 0.0f;
638#endif
639}
640
#define D
MINLINE float safe_sqrtf(float a)
ATTR_WARN_UNUSED_RESULT const BMVert * v
CCL_NAMESPACE_BEGIN ccl_device_inline float bsdf_get_specular_roughness_squared(const ccl_private ShaderClosure *sc)
Definition bsdf.h:29
ccl_device_inline Spectrum safe_divide_color(Spectrum a, Spectrum b, const float fallback=0.0f)
Definition color.h:388
#define kernel_assert(cond)
#define kernel_data
#define PASS_UNUSED
#define ccl_restrict
#define ccl_device_forceinline
#define zero_spectrum
#define ccl_private
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_global
#define CLOSURE_IS_BSDF_OR_BSSRDF(type)
#define CCL_NAMESPACE_END
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
#define assert(assertion)
constexpr T clamp(T, U, U) RET
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int ccl_global float * render_buffer
ccl_device_forceinline void guiding_write_debug_passes(KernelGlobals kg, IntegratorState state, const ccl_private ShaderData *sd, ccl_global float *ccl_restrict render_buffer)
ccl_device_forceinline void guiding_record_background(KernelGlobals kg, IntegratorState state, const Spectrum L, const float mis_weight)
ccl_device_forceinline void guiding_record_volume_segment(KernelGlobals kg, IntegratorState state, const float3 P, const float3 I)
ccl_device_forceinline bool guiding_bsdf_init(KernelGlobals kg, const float3 P, const float3 N, ccl_private float &rand)
ccl_device_forceinline float guiding_surface_incoming_radiance_pdf(KernelGlobals kg, const float3 wo)
ccl_device_forceinline void guiding_record_light_surface_segment(KernelGlobals kg, IntegratorState state, const ccl_private Intersection *ccl_restrict isect)
ccl_device_forceinline void guiding_record_surface_emission(KernelGlobals kg, IntegratorState state, const Spectrum Le, const float mis_weight)
ccl_device_forceinline bool guiding_phase_init(KernelGlobals kg, const float3 P, const float3 D, const float g, ccl_private float &rand)
ccl_device_forceinline float guiding_bsdf_pdf(KernelGlobals kg, const float3 wo)
ccl_device_forceinline float guiding_phase_pdf(KernelGlobals kg, const float3 wo)
ccl_device_forceinline void guiding_record_volume_emission(KernelGlobals kg, IntegratorState state, const Spectrum Le)
ccl_device_forceinline void guiding_record_bssrdf_bounce(KernelGlobals kg, IntegratorState state, const float pdf, const float3 N, const float3 wo, const Spectrum weight, const Spectrum albedo)
ccl_device_forceinline void guiding_record_surface_bounce(KernelGlobals kg, IntegratorState state, const Spectrum weight, const float pdf, const float3 N, const float3 wo, const float2 roughness, const float eta)
ccl_device_forceinline void guiding_record_direct_light(KernelGlobals kg, IntegratorShadowState state)
ccl_device_forceinline void guiding_record_volume_bounce(KernelGlobals kg, IntegratorState state, const Spectrum weight, const float pdf, const float3 wo, const float roughness)
ccl_device_forceinline float guiding_bsdf_sample(KernelGlobals kg, const float2 rand_bsdf, ccl_private float3 *wo)
ccl_device_forceinline bool calculate_ris_target(ccl_private GuidingRISSample *ris_sample, const ccl_private float guiding_sampling_prob)
ccl_device_forceinline void guiding_record_continuation_probability(KernelGlobals kg, IntegratorState state, const float continuation_probability)
ccl_device_forceinline void guiding_record_volume_transmission(KernelGlobals kg, IntegratorState state, const float3 transmittance_weight)
ccl_device_forceinline void guiding_record_surface_segment(KernelGlobals kg, IntegratorState state, const ccl_private ShaderData *sd)
ccl_device_forceinline float guiding_phase_sample(KernelGlobals kg, const float2 rand_phase, ccl_private float3 *wo)
ccl_device_forceinline void guiding_record_bssrdf_segment(KernelGlobals kg, IntegratorState state, const float3 P, const float3 wi)
ccl_device_forceinline void guiding_record_bssrdf_weight(KernelGlobals kg, IntegratorState state, const Spectrum weight, const Spectrum albedo)
@ PATH_RAY_SHADOW_CATCHER_PASS
ccl_device_inline float3 spectrum_to_rgb(Spectrum s)
ccl_device_inline float3 one_float3()
Definition math_float3.h:26
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
Definition math_float3.h:17
static ulong state[N]
#define N
#define L
#define I
#define fabsf
#define fminf
#define M_PI_F
IntegratorShadowStateCPU * IntegratorShadowState
Definition state.h:230
#define INTEGRATOR_STATE(state, nested_struct, member)
Definition state.h:235
IntegratorStateCPU * IntegratorState
Definition state.h:228
float x
float y
i
Definition text_draw.cc:230
float3 Spectrum
uint8_t flag
Definition wm_window.cc:145
ccl_device_inline void film_write_pass_float(ccl_global float *ccl_restrict buffer, const float value)
Definition write.h:58
CCL_NAMESPACE_BEGIN ccl_device_forceinline ccl_global float * film_pass_pixel_render_buffer(KernelGlobals kg, ConstIntegratorState state, ccl_global float *ccl_restrict render_buffer)
Definition write.h:24