Blender V4.5
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. */
65ccl_device_inline float bump_shadowing_term(const int shader_flag,
66 float3 Ng,
67 const float3 N,
68 float3 I)
69{
70 const float cosNgI = dot(Ng, I);
71 const float cosNgN = dot(Ng, N);
72 const float cosNI = dot(N, I);
73
74 /* dot(Ng, I) * dot(Ng, N) tells us if I and N are on the same side of the actual geometry.
75 * If incoming(I) and normal(N) are on the same side we reject refractions, dot(N, I) < 0.
76 * If they are on different sides we reject reflections, dot(N, I) > 0. */
77 if (cosNgI * cosNgN * cosNI < 0.0f) {
78 return 0.0f;
79 }
80
81 /* When bump map correction is not used do skip the smoothing. */
82 if ((shader_flag & SD_USE_BUMP_MAP_CORRECTION) == 0) {
83 return 1.0f;
84 }
85
86 /* Get absolute incoming and shader normal deviation from geometric normal, then clamp. */
87 const float cos_i = fabsf(cosNgI);
88 const float cos_d = fabsf(cosNgN);
89 if (cos_d >= 1.0f || cos_i >= 1.0f) {
90 return 1.0f;
91 }
92 if (cos_i < 1e-6f) {
93 return 0.0f;
94 }
95
96 /* Get GGX shading values for final smoothing. */
97 const float tan2_d = 1.0f / sqr(cos_d) - 1.0f;
98 const float bump_alpha2 = saturatef(0.125f * tan2_d);
99
100 /* Return smoothed value to avoid discontinuity at perpendicular angle. */
101 return bsdf_G<MicrofacetType::GGX>(bump_alpha2, cos_i);
102}
103
104ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
105{
106 /* Shadow terminator workaround, taken from Appleseed.
107 * SPDX-License-Identifier: MIT
108 * Copyright (c) 2019 Francois Beaune, The appleseedhq Organization */
109 cos_in = min(cos_in, 1.0f);
110
111 const float angle = fast_acosf(cos_in);
112 const float val = max(cosf(angle * frequency_multiplier), 0.0f) / cos_in;
113 return val;
114}
115
116ccl_device_inline bool bsdf_is_transmission(const ccl_private ShaderClosure *sc, const float3 wo)
117{
118 return dot(sc->N, wo) < 0.0f;
119}
120
122 ccl_private ShaderData *sd,
123 const ccl_private ShaderClosure *sc,
124 const int path_flag,
125 const float3 rand,
126 ccl_private Spectrum *eval,
128 ccl_private float *pdf,
129 ccl_private float2 *sampled_roughness,
130 ccl_private float *eta)
131{
132 /* For curves use the smooth normal, particularly for ribbons the geometric
133 * normal gives too much darkening otherwise. */
134 *eval = zero_spectrum();
135 *pdf = 0.f;
136 int label = LABEL_NONE;
137 const float3 Ng = (sd->type & PRIMITIVE_CURVE) ? sc->N : sd->Ng;
138 const float2 rand_xy = make_float2(rand);
139
140 switch (sc->type) {
142 label = bsdf_diffuse_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
143 *sampled_roughness = one_float2();
144 *eta = 1.0f;
145 break;
146#if defined(__SVM__) || defined(__OSL__)
148 label = bsdf_oren_nayar_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
149 *sampled_roughness = one_float2();
150 *eta = 1.0f;
151 break;
152# ifdef __OSL__
154 label = bsdf_burley_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
155 *sampled_roughness = one_float2();
156 *eta = 1.0f;
157 break;
159 label = bsdf_phong_ramp_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
160 *eta = 1.0f;
161 break;
163 label = bsdf_diffuse_ramp_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
164 *sampled_roughness = one_float2();
165 *eta = 1.0f;
166 break;
167# endif
169 label = bsdf_translucent_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
170 *sampled_roughness = one_float2();
171 *eta = 1.0f;
172 break;
174 label = bsdf_transparent_sample(sc, Ng, sd->wi, eval, wo, pdf);
175 *sampled_roughness = zero_float2();
176 *eta = 1.0f;
177 break;
179 /* ray portals are not handled by the BSDF code, we should never get here */
180 kernel_assert(false);
181 break;
186 kg, sc, Ng, sd->wi, rand, eval, wo, pdf, sampled_roughness, eta);
187 break;
192 kg, sc, Ng, sd->wi, rand, eval, wo, pdf, sampled_roughness, eta);
193 break;
196 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
197 *eta = 1.0f;
198 break;
200 label = bsdf_ashikhmin_velvet_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
201 *sampled_roughness = one_float2();
202 *eta = 1.0f;
203 break;
205 label = bsdf_diffuse_toon_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
206 *sampled_roughness = one_float2();
207 *eta = 1.0f;
208 break;
210 label = bsdf_glossy_toon_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
211 // double check if this is valid
212 *sampled_roughness = one_float2();
213 *eta = 1.0f;
214 break;
217 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
218 *eta = 1.0f;
219 break;
222 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
223 *eta = 1.0f;
224 break;
225# ifdef __PRINCIPLED_HAIR__
227 label = bsdf_hair_chiang_sample(kg, sc, sd, rand, eval, wo, pdf, sampled_roughness);
228 *eta = 1.0f;
229 break;
231 label = bsdf_hair_huang_sample(kg, sc, sd, rand, eval, wo, pdf, sampled_roughness);
232 *eta = 1.0f;
233 break;
234# endif
236 label = bsdf_sheen_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
237 *sampled_roughness = one_float2();
238 *eta = 1.0f;
239 break;
240#endif
241 default:
242 label = LABEL_NONE;
243 break;
244 }
245
246 /* Test if BSDF sample should be treated as transparent for background. */
247 if (label & LABEL_TRANSMIT) {
248 const float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
249
250 if (threshold_squared >= 0.0f && !(label & LABEL_DIFFUSE)) {
251 if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
253 }
254 }
255 }
256 else {
257 /* Shadow terminator offset. */
258 const float frequency_multiplier =
259 kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
260 if (frequency_multiplier > 1.0f) {
261 const float cosNO = dot(*wo, sc->N);
262 *eval *= shift_cos_in(cosNO, frequency_multiplier);
263 }
264 if (label & LABEL_DIFFUSE) {
265 if (!isequal(sc->N, sd->N)) {
266 *eval *= bump_shadowing_term(sd->flag, sd->N, sc->N, *wo);
267 }
268 }
269 }
270
271#ifdef WITH_CYCLES_DEBUG
272 kernel_assert(*pdf >= 0.0f);
273 kernel_assert(eval->x >= 0.0f && eval->y >= 0.0f && eval->z >= 0.0f);
274#endif
275
276 return label;
277}
278
280 const ccl_private ShaderClosure *sc,
281 const float3 wo,
282 ccl_private float2 *roughness,
283 ccl_private float *eta)
284{
285#ifdef __SVM__
286 float alpha = 1.0f;
287#endif
288 switch (sc->type) {
290 *roughness = one_float2();
291 *eta = 1.0f;
292 break;
293#ifdef __SVM__
295 *roughness = one_float2();
296 *eta = 1.0f;
297 break;
298# ifdef __OSL__
300 *roughness = one_float2();
301 *eta = 1.0f;
302 break;
304 alpha = phong_ramp_exponent_to_roughness(((const ccl_private PhongRampBsdf *)sc)->exponent);
305 *roughness = make_float2(alpha, alpha);
306 *eta = 1.0f;
307 break;
309 *roughness = one_float2();
310 *eta = 1.0f;
311 break;
312# endif
314 *roughness = one_float2();
315 *eta = 1.0f;
316 break;
319 *roughness = zero_float2();
320 *eta = 1.0f;
321 break;
328 const ccl_private MicrofacetBsdf *bsdf = (const ccl_private MicrofacetBsdf *)sc;
329 *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
330 *eta = (bsdf_is_transmission(sc, wo)) ? bsdf->ior : 1.0f;
331 break;
332 }
334 const ccl_private MicrofacetBsdf *bsdf = (const ccl_private MicrofacetBsdf *)sc;
335 *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
336 *eta = 1.0f;
337 break;
338 }
340 *roughness = one_float2();
341 *eta = 1.0f;
342 break;
344 *roughness = one_float2();
345 *eta = 1.0f;
346 break;
348 // double check if this is valid
349 *roughness = one_float2();
350 *eta = 1.0f;
351 break;
353 *roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
354 ((ccl_private HairBsdf *)sc)->roughness2);
355 *eta = 1.0f;
356 break;
358 *roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
359 ((ccl_private HairBsdf *)sc)->roughness2);
360 *eta = 1.0f;
361 break;
362# ifdef __PRINCIPLED_HAIR__
364 alpha = ((ccl_private ChiangHairBSDF *)sc)->m0_roughness;
365 *roughness = make_float2(alpha, alpha);
366 *eta = 1.0f;
367 break;
369 alpha = ((ccl_private HuangHairBSDF *)sc)->roughness;
370 *roughness = make_float2(alpha, alpha);
371 *eta = 1.0f;
372 break;
373# endif
375 alpha = ((ccl_private SheenBsdf *)sc)->roughness;
376 *roughness = make_float2(alpha, alpha);
377 *eta = 1.0f;
378 break;
379#endif
380 default:
381 *roughness = one_float2();
382 *eta = 1.0f;
383 break;
384 }
385}
386
388 const ccl_private ShaderClosure *sc,
389 const float3 wo)
390{
391 /* For curves use the smooth normal, particularly for ribbons the geometric
392 * normal gives too much darkening otherwise. */
393 int label;
394 switch (sc->type) {
400 break;
401#ifdef __SVM__
404 break;
405# ifdef __OSL__
408 break;
410 label = LABEL_REFLECT | LABEL_GLOSSY;
411 break;
414 break;
415# endif
418 break;
421 break;
424 break;
431 const ccl_private MicrofacetBsdf *bsdf = (const ccl_private MicrofacetBsdf *)sc;
432 label = ((bsdf_is_transmission(sc, wo)) ? LABEL_TRANSMIT : LABEL_REFLECT) |
434 break;
435 }
437 label = LABEL_REFLECT | LABEL_GLOSSY;
438 break;
441 break;
444 break;
446 label = LABEL_REFLECT | LABEL_GLOSSY;
447 break;
449 label = LABEL_REFLECT | LABEL_GLOSSY;
450 break;
453 break;
454# ifdef __PRINCIPLED_HAIR__
456 if (bsdf_is_transmission(sc, wo)) {
458 }
459 else {
460 label = LABEL_REFLECT | LABEL_GLOSSY;
461 }
462 break;
464 label = LABEL_REFLECT | LABEL_GLOSSY;
465 break;
466# endif
469 break;
470#endif
471 default:
472 label = LABEL_NONE;
473 break;
474 }
475
476 /* Test if BSDF sample should be treated as transparent for background. */
477 if (label & LABEL_TRANSMIT) {
478 const float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
479
480 if (threshold_squared >= 0.0f) {
481 if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
483 }
484 }
485 }
486 return label;
487}
488
489#ifndef __KERNEL_CUDA__
491#else
493#endif
496 ccl_private ShaderData *sd,
497 const ccl_private ShaderClosure *sc,
498 const float3 wo,
499 ccl_private float *pdf)
500{
501 Spectrum eval = zero_spectrum();
502 *pdf = 0.f;
503
504 switch (sc->type) {
506 eval = bsdf_diffuse_eval(sc, sd->wi, wo, pdf);
507 break;
508#if defined(__SVM__) || defined(__OSL__)
510 eval = bsdf_oren_nayar_eval(sc, sd->wi, wo, pdf);
511 break;
512# ifdef __OSL__
514 eval = bsdf_burley_eval(sc, sd->wi, wo, pdf);
515 break;
517 eval = bsdf_phong_ramp_eval(sc, sd->wi, wo, pdf);
518 break;
520 eval = bsdf_diffuse_ramp_eval(sc, sd->wi, wo, pdf);
521 break;
522# endif
524 eval = bsdf_translucent_eval(sc, sd->wi, wo, pdf);
525 break;
527 eval = bsdf_transparent_eval(sc, sd->wi, wo, pdf);
528 break;
530 eval = bsdf_ray_portal_eval(sc, sd->wi, wo, pdf);
531 break;
535 /* For consistency with eval() this should be using sd->Ng, but that causes
536 * artifacts (see shadow_terminator_metal test). Needs deeper investigation
537 * for how to solve this. */
538 eval = bsdf_microfacet_ggx_eval(kg, sc, sd->N, sd->wi, wo, pdf);
539 break;
543 eval = bsdf_microfacet_beckmann_eval(kg, sc, sd->N, sd->wi, wo, pdf);
544 break;
546 eval = bsdf_ashikhmin_shirley_eval(sc, sd->N, sd->wi, wo, pdf);
547 break;
549 eval = bsdf_ashikhmin_velvet_eval(sc, sd->wi, wo, pdf);
550 break;
552 eval = bsdf_diffuse_toon_eval(sc, sd->wi, wo, pdf);
553 break;
555 eval = bsdf_glossy_toon_eval(sc, sd->wi, wo, pdf);
556 break;
557# ifdef __PRINCIPLED_HAIR__
559 eval = bsdf_hair_chiang_eval(kg, sd, sc, wo, pdf);
560 break;
562 eval = bsdf_hair_huang_eval(kg, sd, sc, wo, pdf);
563 break;
564# endif
566 eval = bsdf_hair_reflection_eval(sc, sd->wi, wo, pdf);
567 break;
569 eval = bsdf_hair_transmission_eval(sc, sd->wi, wo, pdf);
570 break;
572 eval = bsdf_sheen_eval(sc, sd->wi, wo, pdf);
573 break;
574#endif
575 default:
576 break;
577 }
578
579 if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
580 if (!isequal(sc->N, sd->N)) {
581 eval *= bump_shadowing_term(sd->flag, sd->N, sc->N, wo);
582 }
583 }
584
585 /* Shadow terminator offset. */
586 const float frequency_multiplier =
587 kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
588 if (frequency_multiplier > 1.0f) {
589 const float cosNO = dot(wo, sc->N);
590 if (cosNO >= 0.0f) {
591 eval *= shift_cos_in(cosNO, frequency_multiplier);
592 }
593 }
594
595#ifdef WITH_CYCLES_DEBUG
596 kernel_assert(*pdf >= 0.0f);
597 kernel_assert(eval.x >= 0.0f && eval.y >= 0.0f && eval.z >= 0.0f);
598#endif
599 return eval;
600}
601
602ccl_device void bsdf_blur(KernelGlobals kg, ccl_private ShaderClosure *sc, const float roughness)
603{
604 /* TODO: do we want to blur volume closures? */
605#if defined(__SVM__) || defined(__OSL__)
606 switch (sc->type) {
613 /* TODO: Recompute energy preservation after blur? */
614 bsdf_microfacet_blur(sc, roughness);
615 break;
617 bsdf_ashikhmin_shirley_blur(sc, roughness);
618 break;
619# ifdef __PRINCIPLED_HAIR__
621 bsdf_hair_chiang_blur(sc, roughness);
622 break;
624 bsdf_hair_huang_blur(sc, roughness);
625 break;
626# endif
627 default:
628 break;
629 }
630#endif
631}
632
634 const ccl_private ShaderData *sd,
635 const ccl_private ShaderClosure *sc,
636 const bool reflection,
637 const bool transmission)
638{
639 Spectrum albedo = sc->weight;
640 /* Some closures include additional components such as Fresnel terms that cause their albedo to
641 * be below 1. The point of this function is to return a best-effort estimation of their albedo,
642 * meaning the amount of reflected/refracted light that would be expected when illuminated by a
643 * uniform white background.
644 * This is used for the denoising albedo pass and diffuse/glossy/transmission color passes.
645 * NOTE: This should always match the sample_weight of the closure - as in, if there's an albedo
646 * adjustment in here, the sample_weight should also be reduced accordingly.
647 * TODO(lukas): Consider calling this function to determine the sample_weight? Would be a bit of
648 * extra overhead though. */
649#if defined(__SVM__) || defined(__OSL__)
650 if (CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
652 kg, sd, (const ccl_private MicrofacetBsdf *)sc, reflection, transmission);
653 }
654# ifdef __PRINCIPLED_HAIR__
655 else if (sc->type == CLOSURE_BSDF_HAIR_CHIANG_ID) {
656 /* TODO(lukas): Principled Hair could also be split into a glossy and a transmission component,
657 * similar to Glass BSDFs. */
658 albedo *= bsdf_hair_chiang_albedo(sd, sc);
659 }
660 else if (sc->type == CLOSURE_BSDF_HAIR_HUANG_ID) {
661 albedo *= bsdf_hair_huang_albedo(sd, sc);
662 }
663# endif
664#endif
665 return albedo;
666}
667
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:495
ccl_device_inline int bsdf_sample(KernelGlobals kg, ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc, const int path_flag, 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:121
ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
Definition bsdf.h:104
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:387
ccl_device_inline void bsdf_roughness_eta(const KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 wo, ccl_private float2 *roughness, ccl_private float *eta)
Definition bsdf.h:279
ccl_device_inline float bump_shadowing_term(const int shader_flag, float3 Ng, const float3 N, float3 I)
Definition bsdf.h:65
ccl_device_inline bool bsdf_is_transmission(const ccl_private ShaderClosure *sc, const float3 wo)
Definition bsdf.h:116
ccl_device void bsdf_blur(KernelGlobals kg, ccl_private ShaderClosure *sc, const float roughness)
Definition bsdf.h:602
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:633
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 Ng, 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 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_translucent_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 int bsdf_diffuse_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_translucent_eval(const ccl_private ShaderClosure *sc, const float3 wi, const 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_transmission_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_private float2 *sampled_roughness)
Definition bsdf_hair.h:201
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_reflection_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_private float2 *sampled_roughness)
Definition bsdf_hair.h:146
ccl_device Spectrum bsdf_microfacet_ggx_eval(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 Ng, 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 Spectrum bsdf_microfacet_beckmann_eval(KernelGlobals kg, const ccl_private ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 wo, ccl_private float *pdf)
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_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 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_hair_huang_albedo(const ccl_private ShaderData *sd, const ccl_private ShaderClosure *sc)
ccl_device Spectrum bsdf_ray_portal_eval(const ccl_private ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_sheen_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_sheen.h:86
ccl_device Spectrum bsdf_sheen_eval(const ccl_private ShaderClosure *sc, const float3 wi, 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_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 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_toon.h:65
ccl_device int bsdf_diffuse_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:90
ccl_device int bsdf_transparent_sample(const ccl_private ShaderClosure *sc, const float3 Ng, 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 *sc, const float3 wi, const float3 wo, 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 ccl_device
#define zero_spectrum
#define ccl_private
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define CLOSURE_IS_BSDF_DIFFUSE(type)
#define cosf(x)
#define CCL_NAMESPACE_END
#define saturatef(x)
ccl_device_forceinline float2 make_float2(const float x, const float y)
#define fabsf(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_inline float sqr(const float a)
Definition math_base.h:600
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 N
#define I
#define min(a, b)
Definition sort.cc:36
float z
Definition sky_float3.h:27
float y
Definition sky_float3.h:27
float x
Definition sky_float3.h:27
max
Definition text_draw.cc:251
float3 Spectrum