Blender V5.3
volume_shader.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/* Volume shader evaluation and sampling. */
6
7#pragma once
8
10
13
14#ifdef __SVM__
15# include "kernel/svm/svm.h"
16#endif
17#ifdef __OSL__
18# include "kernel/osl/osl.h"
19#endif
20
22
25
27
28#ifdef __VOLUME__
29
30/* Merging */
31
32ccl_device_inline void volume_shader_merge_closures(ccl_private ShaderData *sd)
33{
34 /* Merge identical closures to save closure space with stacked volumes. */
35 for (int i = 0; i < sd->num_closure; i++) {
36 ccl_private ShaderClosure *sci = &sd->closure[i];
37
38 if (!CLOSURE_IS_VOLUME_SCATTER(sci->type)) {
39 continue;
40 }
41
42 for (int j = i + 1; j < sd->num_closure; j++) {
43 ccl_private ShaderClosure *scj = &sd->closure[j];
44 if (!volume_phase_equal(sci, scj)) {
45 continue;
46 }
47
48 sci->weight += scj->weight;
49 sci->sample_weight += scj->sample_weight;
50
51 const int size = sd->num_closure - (j + 1);
52 if (size > 0) {
53 for (int k = 0; k < size; k++) {
54 scj[k] = scj[k + 1];
55 }
56 }
57
58 sd->num_closure--;
59 kernel_assert(sd->num_closure >= 0);
60 j--;
61 }
62 }
63}
64
66 phases,
67 const ccl_private ShaderData *ccl_restrict sd)
68{
69 phases->num_closure = 0;
70
71 for (int i = 0; i < sd->num_closure; i++) {
72 const ccl_private ShaderClosure *from_sc = &sd->closure[i];
73 if (CLOSURE_IS_VOLUME_SCATTER(from_sc->type)) {
74 /* ShaderVolumeClosure is a subset of ShaderClosure, so this is fine for all volume scatter
75 * closures. */
76 phases->closure[phases->num_closure++] = *((const ccl_private ShaderVolumeClosure *)from_sc);
77 if (phases->num_closure >= MAX_VOLUME_CLOSURE) {
78 break;
79 }
80 }
81 }
82}
83
84/* Guiding */
85
86# if defined(__PATH_GUIDING__)
87ccl_device_inline void volume_shader_prepare_guiding(KernelGlobals kg,
89 float rand_phase_guiding,
90 const float3 P,
91 const float3 D,
93{
94 /* Have any phase functions to guide? */
95 const int num_phases = phases->num_closure;
96 if (!kernel_data.integrator.use_volume_guiding || num_phases == 0) {
97 INTEGRATOR_STATE_WRITE(state, guiding, use_volume_guiding) = false;
98 return;
99 }
100
101 const float volume_guiding_probability = kernel_data.integrator.volume_guiding_probability;
102
103 /* If we have more than one phase function we select one random based on its
104 * sample weight to calculate the product distribution for guiding. */
105 int phase_id = 0;
106 float phase_weight = 1.0f;
107
108 if (num_phases > 1) {
109 /* Pick a phase closure based on sample weights. */
110 float sum = 0.0f;
111
112 for (phase_id = 0; phase_id < num_phases; phase_id++) {
113 const ccl_private ShaderVolumeClosure *svc = &phases->closure[phase_id];
114 sum += svc->sample_weight;
115 }
116
117 const float r = rand_phase_guiding * sum;
118 float partial_sum = 0.0f;
119
120 for (phase_id = 0; phase_id < num_phases; phase_id++) {
121 const ccl_private ShaderVolumeClosure *svc = &phases->closure[phase_id];
122 const float next_sum = partial_sum + svc->sample_weight;
123
124 if (r <= next_sum) {
125 /* Rescale to reuse. */
126 rand_phase_guiding = (r - partial_sum) / svc->sample_weight;
127 phase_weight = svc->sample_weight / sum;
128 break;
129 }
130
131 partial_sum = next_sum;
132 }
133
134 /* Adjust the sample weight of the component used for guiding. */
135 phases->closure[phase_id].sample_weight *= volume_guiding_probability;
136 }
137
138 /* Init guiding for selected phase function. */
139 const ccl_private ShaderVolumeClosure *svc = &phases->closure[phase_id];
140 const float phase_g = volume_phase_get_g(svc);
141 if (!guiding_phase_init(kg, P, D, phase_g, rand_phase_guiding)) {
142 INTEGRATOR_STATE_WRITE(state, guiding, use_volume_guiding) = false;
143 return;
144 }
145
146 INTEGRATOR_STATE_WRITE(state, guiding, use_volume_guiding) = true;
147 INTEGRATOR_STATE_WRITE(state, guiding, sample_volume_guiding_rand) = rand_phase_guiding;
149 state, guiding, volume_guiding_sampling_prob) = volume_guiding_probability * phase_weight;
150
151 kernel_assert(INTEGRATOR_STATE(state, guiding, volume_guiding_sampling_prob) > 0.0f &&
152 INTEGRATOR_STATE(state, guiding, volume_guiding_sampling_prob) <= 1.0f);
153}
154# endif
155
156/* Phase Evaluation & Sampling */
157
158/* Randomly sample a volume phase function proportional to ShaderClosure.sample_weight. */
159/* TODO: this isn't quite correct, we don't weight anisotropy properly depending on color channels,
160 * even if this is perhaps not a common case */
161const ccl_device_inline ccl_private ShaderVolumeClosure *volume_shader_phase_pick(
162 const ccl_private ShaderVolumePhases *phases, ccl_private float2 *rand_phase)
163{
164 int sampled = 0;
165
166 if (phases->num_closure > 1) {
167 /* Pick a phase closure based on sample weights. */
168 /* For reservoir sampling, always accept the first in the stream. */
169 float sum = phases->closure[0].sample_weight;
170
171 for (int i = 1; i < phases->num_closure; i++) {
172 const float sample_weight = phases->closure[i].sample_weight;
173 sum += sample_weight;
174 const float thresh = sample_weight / sum;
175
176 /* Rescale random number to reuse for volume phase direction sample. */
177 if (rand_phase->x < thresh) {
178 sampled = i;
179 rand_phase->x /= thresh;
180 }
181 else {
182 rand_phase->x = (rand_phase->x - thresh) / (1.0f - thresh);
183 }
184 }
185 }
186
187 return &phases->closure[sampled];
188}
189
190ccl_device_inline float _volume_shader_phase_eval_mis(
191 const ccl_private ShaderData *sd,
192 const ccl_private ShaderVolumePhases *phases,
193 const float3 wo,
194 const ccl_private ShaderVolumeClosure *skip_svc,
195 ccl_private BsdfEval *result_eval,
196 float sum_pdf,
197 float sum_sample_weight)
198{
199 for (int i = 0; i < phases->num_closure; i++) {
200 const ccl_private ShaderVolumeClosure *svc = &phases->closure[i];
201
202 if (svc == skip_svc) {
203 continue;
204 }
205
206 float phase_pdf = 0.0f;
207 const Spectrum eval = volume_phase_eval(sd, svc, wo, &phase_pdf);
208
209 if (phase_pdf != 0.0f) {
210 bsdf_eval_accum(result_eval, eval * svc->sample_weight);
211 sum_pdf += phase_pdf * svc->sample_weight;
212 }
213
214 sum_sample_weight += svc->sample_weight;
215 }
216
217 bsdf_eval_mul(result_eval, 1.0f / sum_sample_weight);
218 return (sum_sample_weight > 0.0f) ? sum_pdf / sum_sample_weight : 0.0f;
219}
220
221ccl_device float volume_shader_phase_eval(ccl_attr_maybe_unused KernelGlobals kg,
223 const ccl_private ShaderData *sd,
224 const ccl_private ShaderVolumePhases *phases,
225 const float3 wo,
226 ccl_private BsdfEval *phase_eval,
227 const uint light_shader_flags)
228{
229 bsdf_eval_init(phase_eval, zero_spectrum());
230
231 float pdf = _volume_shader_phase_eval_mis(sd, phases, wo, nullptr, phase_eval, 0.0f, 0.0f);
232
233# if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
234 if ((kernel_data.kernel_features & KERNEL_FEATURE_PATH_GUIDING)) {
235 if (INTEGRATOR_STATE(state, guiding, use_volume_guiding)) {
236 const float guiding_sampling_prob = INTEGRATOR_STATE(
237 state, guiding, volume_guiding_sampling_prob);
238 const float guide_pdf = guiding_phase_pdf(kg, wo);
239 pdf = (guiding_sampling_prob * guide_pdf) + (1.0f - guiding_sampling_prob) * pdf;
240 }
241 }
242# endif
243
244 /* If the light does not use MIS, then it is only sampled via NEE, so the probability of hitting
245 * the light using BSDF sampling is zero. */
246 if (!(light_shader_flags & SHADER_USE_MIS)) {
247 pdf = 0.0f;
248 }
249
250 return pdf;
251}
252
253/* Sample direction for a picked phase function, and return evaluation and PDF for all phase
254 * functions combined using MIS. */
255ccl_device int volume_shader_phase_sample(const ccl_private ShaderData *sd,
256 const ccl_private ShaderVolumePhases *phases,
258 const float2 rand_phase,
259 ccl_private BsdfEval *phase_eval,
261 ccl_private float *pdf,
262 ccl_private float *sampled_roughness)
263{
264 *sampled_roughness = 1.0f - fabsf(volume_phase_get_g(svc));
266
267 *pdf = 0.0f;
268 const int label = volume_phase_sample(sd, svc, rand_phase, &eval, wo, pdf);
269
270 if (*pdf != 0.0f) {
271 if (phases->num_closure > 1) {
272 const float sample_weight = svc->sample_weight;
273 bsdf_eval_init(phase_eval, eval * sample_weight);
274 *pdf = _volume_shader_phase_eval_mis(
275 sd, phases, *wo, svc, phase_eval, *pdf * sample_weight, sample_weight);
276 }
277 else {
278 bsdf_eval_init(phase_eval, eval);
279 }
280 }
281
282 return label;
283}
284
285# if defined(__PATH_GUIDING__)
286ccl_device int volume_shader_phase_guided_sample(KernelGlobals kg,
288 const ccl_private ShaderData *sd,
289 const ccl_private ShaderVolumePhases *phases,
291 const float2 rand_phase,
292 ccl_private BsdfEval *phase_eval,
294 ccl_private float *phase_pdf,
295 ccl_private float *unguided_phase_pdf,
296 ccl_private float *sampled_roughness)
297{
298 const bool use_volume_guiding = INTEGRATOR_STATE(state, guiding, use_volume_guiding);
299 const float guiding_sampling_prob = INTEGRATOR_STATE(
300 state, guiding, volume_guiding_sampling_prob);
301
302 /* Decide between sampling guiding distribution and phase. */
303 float rand_phase_guiding = INTEGRATOR_STATE(state, guiding, sample_volume_guiding_rand);
304 bool sample_guiding = false;
305 if (use_volume_guiding && rand_phase_guiding < guiding_sampling_prob) {
306 sample_guiding = true;
307 rand_phase_guiding /= guiding_sampling_prob;
308 }
309 else {
310 rand_phase_guiding -= guiding_sampling_prob;
311 rand_phase_guiding /= (1.0f - guiding_sampling_prob);
312 }
313
314 /* Initialize to zero. */
315 int label = LABEL_NONE;
316
317 *unguided_phase_pdf = 0.0f;
318 float guide_pdf = 0.0f;
319
320 bsdf_eval_init(phase_eval, zero_spectrum());
321
322 if (sample_guiding) {
323 /* Sample guiding distribution. */
324 *sampled_roughness = 1.0f - fabsf(volume_phase_get_g(svc));
325 guide_pdf = guiding_phase_sample(kg, rand_phase, wo);
326 *phase_pdf = 0.0f;
327
328 if (guide_pdf != 0.0f) {
329 *unguided_phase_pdf = _volume_shader_phase_eval_mis(
330 sd, phases, *wo, nullptr, phase_eval, 0.0f, 0.0f);
331 *phase_pdf = (guiding_sampling_prob * guide_pdf) +
332 ((1.0f - guiding_sampling_prob) * (*unguided_phase_pdf));
333 label = LABEL_VOLUME_SCATTER;
334 }
335 }
336 else {
337 /* Sample phase. */
338 *phase_pdf = 0.0f;
339 label = volume_shader_phase_sample(
340 sd, phases, svc, rand_phase, phase_eval, wo, unguided_phase_pdf, sampled_roughness);
341
342 if (*unguided_phase_pdf != 0.0f) {
343 *phase_pdf = *unguided_phase_pdf;
344 if (use_volume_guiding) {
345 guide_pdf = guiding_phase_pdf(kg, *wo);
346 *phase_pdf *= 1.0f - guiding_sampling_prob;
347 *phase_pdf += guiding_sampling_prob * guide_pdf;
348 }
349
350 kernel_assert(reduce_min(bsdf_eval_sum(phase_eval)) >= 0.0f);
351 }
352 else {
353 bsdf_eval_init(phase_eval, zero_spectrum());
354 }
355
356 kernel_assert(reduce_min(bsdf_eval_sum(phase_eval)) >= 0.0f);
357 }
358
359 return label;
360}
361# endif
362
363/* Motion Blur */
364
365# ifdef __OBJECT_MOTION__
366ccl_device_inline void volume_shader_motion_blur(KernelGlobals kg,
367 ccl_private ShaderData *ccl_restrict sd)
368{
369 if ((sd->object_flag & SD_OBJECT_HAS_VOLUME_MOTION) == 0) {
370 return;
371 }
372
375
376 const float3 P = sd->P;
377 const float velocity_scale =
378 kernel_data_fetch(objects, sd->object).mesh_volume.volume_velocity_scale;
379 const float time_offset = kernel_data.cam.motion_position == MOTION_POSITION_CENTER ? 0.5f :
380 0.0f;
381 const float time = kernel_data.cam.motion_position == MOTION_POSITION_END ?
382 (1.0f - kernel_data.cam.shuttertime) + sd->time :
383 sd->time;
384
385 /* Use a 1st order semi-lagrangian advection scheme to estimate what volume quantity
386 * existed, or will exist, at the given time:
387 *
388 * `phi(x, T) = phi(x - (T - t) * u(x, T), t)`
389 *
390 * where
391 *
392 * x : position
393 * T : super-sampled time (or ray time)
394 * t : current time of the simulation (in rendering we assume this is center frame with
395 * relative time = 0)
396 * phi : the volume quantity
397 * u : the velocity field
398 *
399 * But first we need to determine the velocity field `u(x, T)`, which we can estimate also
400 * using semi-lagrangian advection.
401 *
402 * `u(x, T) = u(x - (T - t) * u(x, T), t)`
403 *
404 * This is the typical way to model self-advection in fluid dynamics, however, we do not
405 * account for other forces affecting the velocity during simulation (pressure, buoyancy,
406 * etc.): this gives a linear interpolation when fluid are mostly "curvy". For better
407 * results, a higher order interpolation scheme can be used (at the cost of more lookups),
408 * or an interpolation of the velocity fields for the previous and next frames could also
409 * be used to estimate `u(x, T)` (which will cost more memory and lookups).
410 *
411 * References:
412 * "Eulerian Motion Blur", Kim and Ko, 2007
413 * "Production Volume Rendering", Wreninge et al., 2012
414 */
415
416 /* Always use linear interpolation for velocity. */
417 const int cubic_flag = sd->shader_flag & SD_VOLUME_CUBIC;
418 sd->shader_flag &= ~SD_VOLUME_CUBIC;
419
420 /* Find velocity. */
421 float3 velocity = primitive_volume_attribute<float3>(kg, sd, v_desc, false);
422 object_dir_transform(kg, sd, &velocity);
423
424 /* Find advected P. */
425 sd->P = P - (time - time_offset) * velocity_scale * velocity;
426
427 /* Find advected velocity. */
428 velocity = primitive_volume_attribute<float3>(kg, sd, v_desc, false);
429 object_dir_transform(kg, sd, &velocity);
430
431 /* Find advected P. */
432 sd->P = P - (time - time_offset) * velocity_scale * velocity;
433
434 /* Restore flag. */
435 sd->shader_flag |= cubic_flag;
436}
437# endif
438
439/* Volume Evaluation */
440
441template<const bool shadow, const uint64_t node_feature_mask, typename ConstIntegratorGenericState>
442ccl_device_inline bool volume_shader_eval_entry(KernelGlobals kg,
443 ConstIntegratorGenericState state,
444 ccl_private ShaderData *ccl_restrict sd,
445 const ccl_private VolumeStack &entry,
446 const PathRayVisibility path_visibility,
447 const uint32_t path_flag)
448{
449 if (entry.shader == SHADER_NONE) {
450 return false;
451 }
452
453 /* Setup shader-data from stack. It's mostly setup already in shader_setup_from_volume, this
454 * switching should be quick. */
455 sd->object = entry.object;
456 sd->shader = entry.shader;
457
458 sd->shader_flag = kernel_data_fetch(shaders, (sd->shader & SHADER_MASK)).flags;
459 sd->object_flag &= ~SD_OBJECT_FLAGS;
460
461 if (sd->object != OBJECT_NONE) {
462 sd->object_flag |= kernel_data_fetch(object_flag, sd->object);
463
464 if (shadow && !(kernel_data_fetch(objects, sd->object).visibility & path_visibility)) {
465 /* If volume is invisible to shadow ray, the hit is not registered, but the volume is still
466 * in the stack. Skip the volume in such cases. */
467 /* NOTE: `SHADOW_CATCHER_PATH_VISIBILITY()` is omitted because `path_visibility` is just
468 * `PATH_RAY_VISIBILITY_SHADOW` when evaluating shadows. */
469 return true;
470 }
471
472# ifdef __OBJECT_MOTION__
473 /* TODO: this is inefficient for motion blur, we should be caching matrices instead of
474 * recomputing them each step. */
475 shader_setup_object_transforms(kg, sd, sd->time);
476
477 volume_shader_motion_blur(kg, sd);
478# endif
479 }
480
481 /* Evaluate shader. */
482# ifdef __OSL__
483 if (kernel_data.kernel_features & KERNEL_FEATURE_OSL_SHADING) {
484 osl_eval_nodes<SHADER_TYPE_VOLUME>(kg, state, sd, path_visibility, path_flag);
485 }
486 else
487# endif
488 {
489# ifdef __SVM__
491 kg, state, sd, nullptr, path_visibility, path_flag);
492# endif
493 }
494
495 return true;
496}
497
498template<const bool shadow, typename ConstIntegratorGenericState>
499ccl_device_inline void volume_shader_eval(KernelGlobals kg,
500 ConstIntegratorGenericState state,
501 ccl_private ShaderData *ccl_restrict sd,
502 const PathRayVisibility path_visibility,
503 const uint32_t path_flag)
504{
505 /* If path is being terminated, we are tracing a shadow ray or evaluating emission, then we don't
506 * need to store closures. The emission, extinction and shadow shader data also do not have a
507 * closure array to save GPU memory. */
508 int max_closures;
509 if ((path_visibility & PATH_RAY_VISIBILITY_SHADOW) ||
511 {
512 max_closures = 0;
513 }
514 else {
515 max_closures = kernel_data.max_closures;
516 }
517
518 /* reset closures once at the start, we will be accumulating the closures
519 * for all volumes in the stack into a single array of closures */
520 sd->num_closure = 0;
521 sd->num_closure_left = max_closures;
522 sd->shader_flag = 0;
523 sd->runtime_flag = SR_IS_VOLUME_SHADER_EVAL | (sd->runtime_flag & ~SR_CLOSURE_FLAG);
524 sd->object_flag = 0;
525
526 for (int i = 0;; i++) {
527 const VolumeStack entry = volume_stack_read<shadow>(state, i);
528 if (!volume_shader_eval_entry<shadow, KERNEL_FEATURE_NODE_MASK_VOLUME>(
529 kg, state, sd, entry, path_visibility, path_flag))
530 {
531 /* Stack fully processed. */
532 return;
533 }
534
535 /* Merge closures to avoid exceeding number of closures limit. */
536 if (!shadow) {
537 if (i > 0) {
538 volume_shader_merge_closures(sd);
539 }
540 }
541 }
542}
543
544#endif /* __VOLUME__ */
545
#define D
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
#define kernel_assert(cond)
#define CLOSURE_IS_VOLUME_SCATTER(type)
#define kernel_data
#define ccl_attr_maybe_unused
#define ccl_restrict
#define MAX_VOLUME_CLOSURE
#define KERNEL_FEATURE_PATH_GUIDING
#define kernel_data_fetch(name, index)
#define SHADER_NONE
#define zero_spectrum
#define OBJECT_NONE
#define KERNEL_FEATURE_OSL_SHADING
#define ccl_private
#define ccl_device_inline
#define CCL_NAMESPACE_END
float reduce_min(float2 a)
ccl_device bool volume_phase_equal(const ccl_private ShaderClosure *c1, const ccl_private ShaderClosure *c2)
ccl_device Spectrum volume_phase_eval(const ccl_private ShaderData *sd, const ccl_private ShaderVolumeClosure *svc, const float3 wo, ccl_private float *pdf)
ccl_device float volume_phase_get_g(const ccl_private ShaderVolumeClosure *svc)
ccl_device int volume_phase_sample(const ccl_private ShaderData *sd, const ccl_private ShaderVolumeClosure *svc, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
const int state
CCL_NAMESPACE_BEGIN ccl_device_forceinline bool is_attribute_found(const ccl_private AttributeDescriptor &desc)
ccl_device_inline AttributeDescriptor find_attribute(const ccl_global AttributeMap *attributes_map, uint attr_offset, const int prim, const uint64_t id)
ccl_device_inline void object_dir_transform(KernelGlobals kg, const ccl_private ShaderData *sd, ccl_private float3 *D)
ccl_device_forceinline float guiding_phase_sample(ccl_attr_maybe_unused KernelGlobals kg, ccl_attr_maybe_unused const float2 rand_phase, ccl_attr_maybe_unused ccl_private float3 *wo)
ccl_device_forceinline bool guiding_phase_init(ccl_attr_maybe_unused KernelGlobals kg, ccl_attr_maybe_unused const float3 P, ccl_attr_maybe_unused const float3 D, ccl_attr_maybe_unused const float g, ccl_attr_maybe_unused ccl_private float &rand)
ccl_device_forceinline float guiding_phase_pdf(ccl_attr_maybe_unused KernelGlobals kg, ccl_attr_maybe_unused const float3 wo)
void osl_eval_nodes(const ThreadKernelGlobalsCPU *kg, ConstIntegratorGenericState state, ShaderData *sd, PathRayVisibility path_visibility, uint32_t path_flag)
ccl_device void svm_eval_nodes(KernelGlobals kg, ConstIntegratorGenericState state, ccl_private ShaderData *sd, ccl_global float *render_buffer, const PathRayVisibility path_visibility, const uint32_t path_flag)
uint32_t PathRayVisibility
@ SR_CLOSURE_FLAG
@ SR_IS_VOLUME_SHADER_EVAL
@ SD_VOLUME_CUBIC
@ PATH_RAY_TERMINATE
@ PATH_RAY_EMISSION
@ PATH_RAY_EXTINCTION
@ PATH_RAY_VISIBILITY_SHADOW
@ SD_OBJECT_HAS_VOLUME_MOTION
@ SD_OBJECT_FLAGS
@ SHADER_USE_MIS
@ SHADER_MASK
@ MOTION_POSITION_END
@ MOTION_POSITION_CENTER
@ LABEL_VOLUME_SCATTER
@ LABEL_NONE
@ ATTR_STD_VOLUME_VELOCITY
CCL_NAMESPACE_BEGIN ccl_device_inline void bsdf_eval_init(ccl_private BsdfEval *eval, const ccl_private ShaderClosure *sc, const float3 wo, Spectrum value)
ccl_device_inline void bsdf_eval_accum(ccl_private BsdfEval *eval, const ccl_private ShaderClosure *sc, const float3 wo, Spectrum value)
ccl_device_inline void bsdf_eval_mul(ccl_private BsdfEval *eval, const float value)
ccl_device_inline Spectrum bsdf_eval_sum(const ccl_private BsdfEval *eval)
std::string time(const std::tm &date_time, TimeFormat format=TimeFormat::H24)
ResultT eval(const Uniform &uni, const ViewMatrices view, ScreenThicknessParameters thickness_params, sampler2D hiz_tx, sampler2D screen_radiance_tx, sampler2D screen_normal_tx, float3 vP, float3 vN, float4 noise, float2 pixel_size, float search_distance, float angle_bias, const int slice_count, const int sample_count, const bool reversed, const bool ao_only)
float sample_weight(float3 out_direction, float3 in_direction, float linear_roughness)
#define fabsf
#define ccl_device
CCL_NAMESPACE_BEGIN ccl_device void shader_setup_object_transforms(KernelGlobals kg, ccl_private ShaderData *ccl_restrict sd, const float time)
Definition shader_data.h:27
#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
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_DENOISING KERNEL_STRUCT_VOLUME_STACK_SIZE KERNEL_FEATURE_PATH_GUIDING sample_volume_guiding_rand
float3 Spectrum