Blender V5.0
bsdf.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// clang-format off
23// clang-format on
24
26
27/* Returns the square of the roughness of the closure if it has roughness,
28 * 0 for singular closures and 1 otherwise. */
30{
31 if (CLOSURE_IS_BSDF_SINGULAR(sc->type)) {
32 return 0.0f;
33 }
34
35 if (CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
37 return bsdf->alpha_x * bsdf->alpha_y;
38 }
39
40 return 1.0f;
41}
42
44{
45 if (sc->type == CLOSURE_BSDF_OREN_NAYAR_ID) {
47 return sqr(sqr(bsdf->roughness));
48 }
49
50 /* For the Principled BSDF, we want the Roughness pass to return the value that
51 * was set in the node. However, this value doesn't affect all closures (e.g.
52 * diffuse), so skip those that don't really have a concept of roughness. */
53 if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
54 return -1.0f;
55 }
56
58}
59
60/* An additional term to smooth illumination on grazing angles when using bump mapping
61 * based on "A Microfacet-Based Shadowing Function to Solve the Bump Terminator Problem"
62 * by Alejandro Conty Estevez, Pascal Lecocq, and Clifford Stein. It preserves detail
63 * close to the shadow terminator, and doesn't "wash out" intermediate bumps using a
64 * Cook-Torrance GGX function for shading. */
66 const ccl_private ShaderClosure *sc,
67 const float3 I,
68 const bool is_eval)
69{
70 if (isequal(sc->N, sd->N)) {
71 return 1.0f;
72 }
73
74 /* Smoothing doesn't apply to curve geometry. */
75 if (sd->type & PRIMITIVE_CURVE) {
76 return 1.0f;
77 }
78
79 /* In order to avoid artifacts at the shadow terminator when using smooth normals,
80 * the BSDF evaluation functions allow for light leaking through the actual geometry
81 * and only checks that the directions are in the correct hemisphere w.r.t. the
82 * shading normal.
83 * However, when using bump/normal mapping, this can lead to light leaking not just
84 * "around" the shadow terminator, but to the rear side of supposedly opaque geometry.
85 * In order to detect this case, we can ensure that the direction is also valid w.r.t.
86 * the smoothed (but non-bump-mapped) normal `sd->N` (or `Ns` for short below).
87 *
88 * `dot(Ns, I) * dot(Ns, N)` tells us if I and N are on the same side of the smoothed geometry.
89 * If incoming(I) and normal(N) are on the same side we reject refractions, `dot(N, I) < 0`.
90 * If they are on different sides we reject reflections, `dot(N, I) > 0`. */
91 const float cosNsI = dot(sd->N, I);
92 const float cosNsN = dot(sd->N, sc->N);
93 const float cosNI = dot(sc->N, I);
94 const bool is_diffuse = CLOSURE_IS_BSDF_DIFFUSE(sc->type);
95 if (cosNsI * cosNsN * cosNI < 0.0f && (is_eval || is_diffuse)) {
96 return 0.0f;
97 }
98
99 /* The above test applies to all closures, but the softening only applies to diffuse ones. */
100 if (!is_diffuse) {
101 return 1.0f;
102 }
103
104 /* When bump map correction is not used do skip the smoothing. */
105 if ((sd->flag & SD_USE_BUMP_MAP_CORRECTION) == 0) {
106 return 1.0f;
107 }
108
109 /* Get absolute incoming and shader normal deviation from smoothed normal, then clamp. */
110 const float cos_i = fabsf(cosNsI);
111 const float cos_d = fabsf(cosNsN);
112 if (cos_d >= 1.0f || cos_i >= 1.0f) {
113 return 1.0f;
114 }
115 if (cos_i < 1e-6f) {
116 return 0.0f;
117 }
118
119 /* Get GGX shading values for final smoothing. */
120 const float tan2_d = 1.0f / sqr(cos_d) - 1.0f;
121 const float bump_alpha2 = saturatef(0.125f * tan2_d);
122
123 /* Return smoothed value to avoid discontinuity at perpendicular angle. */
124 return bsdf_G<MicrofacetType::GGX>(bump_alpha2, cos_i);
125}
126
127ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
128{
129 /* Shadow terminator workaround, taken from Appleseed.
130 * SPDX-License-Identifier: MIT
131 * Copyright (c) 2019 Francois Beaune, The appleseedhq Organization */
132 cos_in = min(cos_in, 1.0f);
133
134 const float angle = fast_acosf(cos_in);
135 const float val = max(cosf(angle * frequency_multiplier), 0.0f) / cos_in;
136 return val;
137}
138
139ccl_device_inline bool bsdf_is_transmission(const ccl_private ShaderClosure *sc, const float3 wo)
140{
141 return dot(sc->N, wo) < 0.0f;
142}
143
145 ccl_private ShaderData *sd,
146 const ccl_private ShaderClosure *sc,
147 const float3 rand,
148 ccl_private Spectrum *eval,
150 ccl_private float *pdf,
151 ccl_private float2 *sampled_roughness,
152 ccl_private float *eta)
153{
154 /* For curves use the smooth normal, particularly for ribbons the geometric
155 * normal gives too much darkening otherwise. */
156 *eval = zero_spectrum();
157 *pdf = 0.f;
158 int label = LABEL_NONE;
159 const float3 Ng = (sd->type & PRIMITIVE_CURVE) ? sc->N : sd->Ng;
160 const float2 rand_xy = make_float2(rand);
161
162 switch (sc->type) {
164 label = bsdf_diffuse_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
165 *sampled_roughness = one_float2();
166 *eta = 1.0f;
167 break;
168#if defined(__SVM__) || defined(__OSL__)
170 label = bsdf_oren_nayar_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
171 *sampled_roughness = one_float2();
172 *eta = 1.0f;
173 break;
174# ifdef __OSL__
176 label = bsdf_burley_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
177 *sampled_roughness = one_float2();
178 *eta = 1.0f;
179 break;
181 label = bsdf_phong_ramp_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
182 *eta = 1.0f;
183 break;
185 label = bsdf_diffuse_ramp_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
186 *sampled_roughness = one_float2();
187 *eta = 1.0f;
188 break;
189# endif
191 label = bsdf_translucent_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
192 *sampled_roughness = one_float2();
193 *eta = 1.0f;
194 break;
196 label = bsdf_transparent_sample(sc, Ng, sd->wi, eval, wo, pdf);
197 *sampled_roughness = zero_float2();
198 *eta = 1.0f;
199 break;
201 /* ray portals are not handled by the BSDF code, we should never get here */
202 kernel_assert(false);
203 break;
208 kg, sc, Ng, sd->wi, rand, eval, wo, pdf, sampled_roughness, eta);
209 break;
214 kg, sc, Ng, sd->wi, rand, eval, wo, pdf, sampled_roughness, eta);
215 break;
218 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
219 *eta = 1.0f;
220 break;
222 label = bsdf_ashikhmin_velvet_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
223 *sampled_roughness = one_float2();
224 *eta = 1.0f;
225 break;
227 label = bsdf_diffuse_toon_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
228 *sampled_roughness = one_float2();
229 *eta = 1.0f;
230 break;
232 label = bsdf_glossy_toon_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
233 // double check if this is valid
234 *sampled_roughness = one_float2();
235 *eta = 1.0f;
236 break;
239 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
240 *eta = 1.0f;
241 break;
244 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
245 *eta = 1.0f;
246 break;
247# ifdef __PRINCIPLED_HAIR__
249 label = bsdf_hair_chiang_sample(kg, sc, sd, rand, eval, wo, pdf, sampled_roughness);
250 *eta = 1.0f;
251 break;
253 label = bsdf_hair_huang_sample(kg, sc, sd, rand, eval, wo, pdf, sampled_roughness);
254 *eta = 1.0f;
255 break;
256# endif
258 label = bsdf_sheen_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
259 *sampled_roughness = one_float2();
260 *eta = 1.0f;
261 break;
262#endif
263 default:
264 label = LABEL_NONE;
265 break;
266 }
267
268 /* Test if BSDF sample should be treated as transparent for background. */
269 if (label & LABEL_TRANSMIT) {
270 const float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
271
272 if (threshold_squared >= 0.0f && !(label & LABEL_DIFFUSE)) {
273 if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
275 }
276 }
277 }
278 else {
279 /* Shadow terminator offset. */
280 const float frequency_multiplier =
281 kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
282 if (frequency_multiplier > 1.0f) {
283 const float cosNO = dot(*wo, sc->N);
284 *eval *= shift_cos_in(cosNO, frequency_multiplier);
285 }
286 *eval *= bump_shadowing_term(sd, sc, *wo, false);
287 }
288
289#ifdef WITH_CYCLES_DEBUG
290 kernel_assert(*pdf >= 0.0f);
291 kernel_assert(eval->x >= 0.0f && eval->y >= 0.0f && eval->z >= 0.0f);
292#endif
293
294 return label;
295}
296
298 const float3 wo,
299 ccl_private float2 *roughness,
300 ccl_private float *eta)
301{
302#ifdef __SVM__
303 float alpha = 1.0f;
304#endif
305 switch (sc->type) {
307 *roughness = one_float2();
308 *eta = 1.0f;
309 break;
310#ifdef __SVM__
312 *roughness = one_float2();
313 *eta = 1.0f;
314 break;
315# ifdef __OSL__
317 *roughness = one_float2();
318 *eta = 1.0f;
319 break;
321 alpha = phong_ramp_exponent_to_roughness(((const ccl_private PhongRampBsdf *)sc)->exponent);
322 *roughness = make_float2(alpha, alpha);
323 *eta = 1.0f;
324 break;
326 *roughness = one_float2();
327 *eta = 1.0f;
328 break;
329# endif
331 *roughness = one_float2();
332 *eta = 1.0f;
333 break;
336 *roughness = zero_float2();
337 *eta = 1.0f;
338 break;
345 const ccl_private MicrofacetBsdf *bsdf = (const ccl_private MicrofacetBsdf *)sc;
346 *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
347 *eta = (bsdf_is_transmission(sc, wo)) ? bsdf->ior : 1.0f;
348 break;
349 }
351 const ccl_private MicrofacetBsdf *bsdf = (const ccl_private MicrofacetBsdf *)sc;
352 *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
353 *eta = 1.0f;
354 break;
355 }
357 *roughness = one_float2();
358 *eta = 1.0f;
359 break;
361 *roughness = one_float2();
362 *eta = 1.0f;
363 break;
365 // double check if this is valid
366 *roughness = one_float2();
367 *eta = 1.0f;
368 break;
370 *roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
371 ((ccl_private HairBsdf *)sc)->roughness2);
372 *eta = 1.0f;
373 break;
375 *roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
376 ((ccl_private HairBsdf *)sc)->roughness2);
377 *eta = 1.0f;
378 break;
379# ifdef __PRINCIPLED_HAIR__
381 alpha = ((ccl_private ChiangHairBSDF *)sc)->m0_roughness;
382 *roughness = make_float2(alpha, alpha);
383 *eta = 1.0f;
384 break;
386 alpha = ((ccl_private HuangHairBSDF *)sc)->roughness;
387 *roughness = make_float2(alpha, alpha);
388 *eta = 1.0f;
389 break;
390# endif
392 alpha = ((ccl_private SheenBsdf *)sc)->roughness;
393 *roughness = make_float2(alpha, alpha);
394 *eta = 1.0f;
395 break;
396#endif
397 default:
398 *roughness = one_float2();
399 *eta = 1.0f;
400 break;
401 }
402}
403
405 const ccl_private ShaderClosure *sc,
406 const float3 wo)
407{
408 /* For curves use the smooth normal, particularly for ribbons the geometric
409 * normal gives too much darkening otherwise. */
410 int label;
411 switch (sc->type) {
417 break;
418#ifdef __SVM__
421 break;
422# ifdef __OSL__
425 break;
427 label = LABEL_REFLECT | LABEL_GLOSSY;
428 break;
431 break;
432# endif
435 break;
438 break;
441 break;
448 const ccl_private MicrofacetBsdf *bsdf = (const ccl_private MicrofacetBsdf *)sc;
449 label = ((bsdf_is_transmission(sc, wo)) ? LABEL_TRANSMIT : LABEL_REFLECT) |
451 break;
452 }
454 label = LABEL_REFLECT | LABEL_GLOSSY;
455 break;
458 break;
461 break;
463 label = LABEL_REFLECT | LABEL_GLOSSY;
464 break;
466 label = LABEL_REFLECT | LABEL_GLOSSY;
467 break;
470 break;
471# ifdef __PRINCIPLED_HAIR__
473 if (bsdf_is_transmission(sc, wo)) {
475 }
476 else {
477 label = LABEL_REFLECT | LABEL_GLOSSY;
478 }
479 break;
481 label = LABEL_REFLECT | LABEL_GLOSSY;
482 break;
483# endif
486 break;
487#endif
488 default:
489 label = LABEL_NONE;
490 break;
491 }
492
493 /* Test if BSDF sample should be treated as transparent for background. */
494 if (label & LABEL_TRANSMIT) {
495 const float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
496
497 if (threshold_squared >= 0.0f) {
498 if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
500 }
501 }
502 }
503 return label;
504}
505
506#ifndef __KERNEL_CUDA__
508#else
510#endif
513 ccl_private ShaderData *sd,
514 const ccl_private ShaderClosure *sc,
515 const float3 wo,
516 ccl_private float *pdf)
517{
518 Spectrum eval = zero_spectrum();
519 *pdf = 0.f;
520
521 const float bump_shadowing = bump_shadowing_term(sd, sc, wo, true);
522 if (bump_shadowing == 0.0f) {
523 return zero_spectrum();
524 }
525
526 switch (sc->type) {
528 eval = bsdf_diffuse_eval(sc, sd->wi, wo, pdf);
529 break;
530#if defined(__SVM__) || defined(__OSL__)
532 eval = bsdf_oren_nayar_eval(sc, sd->wi, wo, pdf);
533 break;
534# ifdef __OSL__
536 eval = bsdf_burley_eval(sc, sd->wi, wo, pdf);
537 break;
539 eval = bsdf_phong_ramp_eval(sc, sd->wi, wo, pdf);
540 break;
542 eval = bsdf_diffuse_ramp_eval(sc, sd->wi, wo, pdf);
543 break;
544# endif
546 eval = bsdf_translucent_eval(sc, sd->wi, wo, pdf);
547 break;
549 eval = bsdf_transparent_eval(sc, sd->wi, wo, pdf);
550 break;
552 eval = bsdf_ray_portal_eval(sc, sd->wi, wo, pdf);
553 break;
557 eval = bsdf_microfacet_ggx_eval(kg, sc, sd->wi, wo, pdf);
558 break;
562 eval = bsdf_microfacet_beckmann_eval(kg, sc, sd->wi, wo, pdf);
563 break;
565 eval = bsdf_ashikhmin_shirley_eval(sc, sd->wi, wo, pdf);
566 break;
568 eval = bsdf_ashikhmin_velvet_eval(sc, sd->wi, wo, pdf);
569 break;
571 eval = bsdf_diffuse_toon_eval(sc, sd->wi, wo, pdf);
572 break;
574 eval = bsdf_glossy_toon_eval(sc, sd->wi, wo, pdf);
575 break;
576# ifdef __PRINCIPLED_HAIR__
578 eval = bsdf_hair_chiang_eval(kg, sd, sc, wo, pdf);
579 break;
581 eval = bsdf_hair_huang_eval(kg, sd, sc, wo, pdf);
582 break;
583# endif
585 eval = bsdf_hair_reflection_eval(sc, sd->wi, wo, pdf);
586 break;
588 eval = bsdf_hair_transmission_eval(sc, sd->wi, wo, pdf);
589 break;
591 eval = bsdf_sheen_eval(sc, sd->wi, wo, pdf);
592 break;
593#endif
594 default:
595 break;
596 }
597
598 eval *= bump_shadowing;
599
600 /* Shadow terminator offset. */
601 const float frequency_multiplier =
602 kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
603 if (frequency_multiplier > 1.0f) {
604 const float cosNO = dot(wo, sc->N);
605 if (cosNO >= 0.0f) {
606 eval *= shift_cos_in(cosNO, frequency_multiplier);
607 }
608 }
609
610#ifdef WITH_CYCLES_DEBUG
611 kernel_assert(*pdf >= 0.0f);
612 kernel_assert(eval.x >= 0.0f && eval.y >= 0.0f && eval.z >= 0.0f);
613#endif
614 return eval;
615}
616
617ccl_device void bsdf_blur(ccl_private ShaderClosure *sc, const float roughness)
618{
619 /* TODO: do we want to blur volume closures? */
620#if defined(__SVM__) || defined(__OSL__)
621 switch (sc->type) {
628 /* TODO: Recompute energy preservation after blur? */
629 bsdf_microfacet_blur(sc, roughness);
630 break;
632 bsdf_ashikhmin_shirley_blur(sc, roughness);
633 break;
634# ifdef __PRINCIPLED_HAIR__
636 bsdf_hair_chiang_blur(sc, roughness);
637 break;
639 bsdf_hair_huang_blur(sc, roughness);
640 break;
641# endif
642 default:
643 break;
644 }
645#endif
646}
647
649 const ccl_private ShaderData *sd,
650 const ccl_private ShaderClosure *sc,
651 const bool reflection,
652 const bool transmission)
653{
654 Spectrum albedo = sc->weight;
655 /* Some closures include additional components such as Fresnel terms that cause their albedo to
656 * be below 1. The point of this function is to return a best-effort estimation of their albedo,
657 * meaning the amount of reflected/refracted light that would be expected when illuminated by a
658 * uniform white background.
659 * This is used for the denoising albedo pass and diffuse/glossy/transmission color passes.
660 * NOTE: This should always match the sample_weight of the closure - as in, if there's an albedo
661 * adjustment in here, the sample_weight should also be reduced accordingly.
662 * TODO(lukas): Consider calling this function to determine the sample_weight? Would be a bit of
663 * extra overhead though. */
664#if defined(__SVM__) || defined(__OSL__)
665 if (CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
667 kg, sd, (const ccl_private MicrofacetBsdf *)sc, reflection, transmission);
668 }
669# ifdef __PRINCIPLED_HAIR__
670 else if (sc->type == CLOSURE_BSDF_HAIR_CHIANG_ID) {
671 /* TODO(lukas): Principled Hair could also be split into a glossy and a transmission component,
672 * similar to Glass BSDFs. */
673 albedo *= bsdf_hair_chiang_albedo(sd, sc);
674 }
675 else if (sc->type == CLOSURE_BSDF_HAIR_HUANG_ID) {
676 albedo *= bsdf_hair_huang_albedo(sd, sc);
677 }
678# endif
679#endif
680 return albedo;
681}
682
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:117
CCL_NAMESPACE_BEGIN ccl_device_inline float bsdf_get_specular_roughness_squared(const ccl_private ShaderClosure *sc)
Definition bsdf.h:29
ccl_device Spectrum bsdf_eval(KernelGlobals kg, ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const float3 wo, ccl_private float *pdf)
Definition bsdf.h:512
ccl_device_inline float bump_shadowing_term(const ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const float3 I, const bool is_eval)
Definition bsdf.h:65
ccl_device_inline void bsdf_roughness_eta(const ccl_private ShaderClosure *sc, const float3 wo, ccl_private float2 *roughness, ccl_private float *eta)
Definition bsdf.h:297
ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
Definition bsdf.h:127
ccl_device_inline float bsdf_get_roughness_pass_squared(const ccl_private ShaderClosure *sc)
Definition bsdf.h:43
ccl_device_inline int bsdf_label(const KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 wo)
Definition bsdf.h:404
ccl_device_inline int bsdf_sample(KernelGlobals kg, ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const float3 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness, ccl_private float *eta)
Definition bsdf.h:144
ccl_device_inline bool bsdf_is_transmission(const ccl_private ShaderClosure *sc, const float3 wo)
Definition bsdf.h:139
ccl_device_inline Spectrum bsdf_albedo(KernelGlobals kg, const ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const bool reflection, const bool transmission)
Definition bsdf.h:648
ccl_device void bsdf_blur(ccl_private ShaderClosure *sc, const float roughness)
Definition bsdf.h:617
ccl_device void bsdf_ashikhmin_shirley_blur(ccl_private ShaderClosure *sc, const float roughness)
ccl_device_forceinline Spectrum bsdf_ashikhmin_shirley_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_ashikhmin_shirley_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
ccl_device Spectrum bsdf_ashikhmin_velvet_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_ashikhmin_velvet_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_diffuse_eval(const ccl_private ShaderClosure *sc, const float3, const float3 wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_translucent_eval(const ccl_private ShaderClosure *sc, const float3, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_diffuse_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device int bsdf_translucent_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_hair_reflection_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_hair.h:43
ccl_device int bsdf_hair_reflection_sample(const ccl_private ShaderClosure *sc, const float3, const float3 wi, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
Definition bsdf_hair.h:146
ccl_device Spectrum bsdf_hair_transmission_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_hair.h:95
ccl_device int bsdf_hair_transmission_sample(const ccl_private ShaderClosure *sc, const float3, const float3 wi, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
Definition bsdf_hair.h:201
ccl_device Spectrum bsdf_microfacet_ggx_eval(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_microfacet_estimate_albedo(KernelGlobals kg, const ccl_private ShaderData *sd, const ccl_private MicrofacetBsdf *bsdf, const bool eval_reflection, const bool eval_transmission)
ccl_device_forceinline int bsdf_microfacet_eval_flag(const ccl_private MicrofacetBsdf *bsdf)
ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness, ccl_private float *eta)
ccl_device Spectrum bsdf_microfacet_beckmann_eval(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device_inline float bsdf_G(const float alpha2, const float cos_N)
ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness, ccl_private float *eta)
ccl_device void bsdf_microfacet_blur(ccl_private ShaderClosure *sc, const float roughness)
ccl_device int bsdf_oren_nayar_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_oren_nayar_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_hair_chiang_sample(KernelGlobals kg, const ccl_private ShaderClosure *sc, ccl_private ShaderData *sd, float3 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
ccl_device Spectrum bsdf_hair_chiang_eval(KernelGlobals kg, const ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const float3 wo, ccl_private float *pdf)
ccl_device void bsdf_hair_chiang_blur(ccl_private ShaderClosure *sc, const float roughness)
ccl_device Spectrum bsdf_hair_chiang_albedo(const ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc)
ccl_device Spectrum bsdf_hair_huang_albedo(const ccl_private ShaderData *, const ccl_private ShaderClosure *sc)
ccl_device void bsdf_hair_huang_blur(ccl_private ShaderClosure *sc, const float roughness)
ccl_device int bsdf_hair_huang_sample(const KernelGlobals kg, const ccl_private ShaderClosure *sc, ccl_private ShaderData *sd, const float3 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
ccl_device Spectrum bsdf_hair_huang_eval(KernelGlobals kg, ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const float3 wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_ray_portal_eval(const ccl_private ShaderClosure *, const float3, const float3, ccl_private float *pdf)
ccl_device int bsdf_sheen_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
Definition bsdf_sheen.h:77
ccl_device Spectrum bsdf_sheen_eval(const ccl_private ShaderClosure *sc, const float3, const float3 wo, ccl_private float *pdf)
Definition bsdf_sheen.h:56
ccl_device Spectrum bsdf_glossy_toon_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_toon.h:125
ccl_device int bsdf_diffuse_toon_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
Definition bsdf_toon.h:90
ccl_device int bsdf_glossy_toon_sample(const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
Definition bsdf_toon.h:154
ccl_device Spectrum bsdf_diffuse_toon_eval(const ccl_private ShaderClosure *sc, const float3, const float3 wo, ccl_private float *pdf)
Definition bsdf_toon.h:65
ccl_device int bsdf_transparent_sample(const ccl_private ShaderClosure *, const float3, const float3 wi, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_transparent_eval(const ccl_private ShaderClosure *, const float3, const float3, ccl_private float *pdf)
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
#define kernel_assert(cond)
#define kernel_data
#define CLOSURE_IS_BSDF_MICROFACET(type)
#define kernel_data_fetch(name, index)
#define CLOSURE_IS_BSDF_SINGULAR(type)
#define zero_spectrum
#define ccl_private
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define CLOSURE_IS_BSDF_DIFFUSE(type)
#define CCL_NAMESPACE_END
#define saturatef(x)
@ CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID
@ CLOSURE_BSDF_PHONG_RAMP_ID
@ CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID
@ CLOSURE_BSDF_DIFFUSE_RAMP_ID
@ CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID
@ CLOSURE_BSDF_DIFFUSE_ID
@ CLOSURE_BSSRDF_BURLEY_ID
@ CLOSURE_BSDF_SHEEN_ID
@ CLOSURE_BSDF_TRANSPARENT_ID
@ CLOSURE_BSDF_DIFFUSE_TOON_ID
@ CLOSURE_BSDF_MICROFACET_GGX_ID
@ CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID
@ CLOSURE_BSDF_HAIR_TRANSMISSION_ID
@ CLOSURE_BSDF_BURLEY_ID
@ CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID
@ CLOSURE_BSSRDF_RANDOM_WALK_ID
@ CLOSURE_BSDF_HAIR_HUANG_ID
@ CLOSURE_BSDF_MICROFACET_BECKMANN_ID
@ CLOSURE_BSDF_RAY_PORTAL_ID
@ CLOSURE_BSDF_OREN_NAYAR_ID
@ CLOSURE_BSDF_GLOSSY_TOON_ID
@ CLOSURE_BSDF_HAIR_CHIANG_ID
@ CLOSURE_BSDF_HAIR_REFLECTION_ID
@ CLOSURE_BSSRDF_RANDOM_WALK_SKIN_ID
@ CLOSURE_BSDF_TRANSLUCENT_ID
@ CLOSURE_BSDF_ASHIKHMIN_VELVET_ID
@ SD_USE_BUMP_MAP_CORRECTION
@ PRIMITIVE_CURVE
@ LABEL_TRANSMIT
@ LABEL_RAY_PORTAL
@ LABEL_TRANSMIT_TRANSPARENT
@ LABEL_DIFFUSE
@ LABEL_NONE
@ LABEL_SINGULAR
@ LABEL_GLOSSY
@ LABEL_REFLECT
@ LABEL_TRANSPARENT
ccl_device float fast_acosf(const float x)
Definition math_fast.h:259
ccl_device_inline float2 one_float2()
Definition math_float2.h:18
CCL_NAMESPACE_BEGIN ccl_device_inline float2 zero_float2()
Definition math_float2.h:13
ccl_device_inline bool isequal(const float2 a, const float2 b)
#define I
#define sqr
#define fabsf
#define ccl_device
#define make_float2
#define cosf
#define min(a, b)
Definition sort.cc:36
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136
max
Definition text_draw.cc:251
float3 Spectrum