Blender V4.3
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
24// clang-format on
25
27
28/* Returns the square of the roughness of the closure if it has roughness,
29 * 0 for singular closures and 1 otherwise. */
31{
32 if (CLOSURE_IS_BSDF_SINGULAR(sc->type)) {
33 return 0.0f;
34 }
35
36 if (CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
38 return bsdf->alpha_x * bsdf->alpha_y;
39 }
40
41 return 1.0f;
42}
43
45{
46 if (sc->type == CLOSURE_BSDF_OREN_NAYAR_ID) {
48 return sqr(sqr(bsdf->roughness));
49 }
50
51 /* For the Principled BSDF, we want the Roughness pass to return the value that
52 * was set in the node. However, this value doesn't affect all closures (e.g.
53 * diffuse), so skip those that don't really have a concept of roughness. */
54 if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
55 return -1.0f;
56 }
57
59}
60
61/* An additional term to smooth illumination on grazing angles when using bump mapping.
62 * Based on "Taming the Shadow Terminator" by Matt Jen-Yuan Chiang,
63 * Yining Karl Li and Brent Burley. */
65{
66 const float cosNI = dot(N, I);
67 if (cosNI < 0.0f) {
68 Ng = -Ng;
69 }
70 float g = safe_divide(dot(Ng, I), cosNI * dot(Ng, N));
71
72 /* If the incoming light is on the unshadowed side, return full brightness. */
73 if (g >= 1.0f) {
74 return 1.0f;
75 }
76
77 /* If the incoming light points away from the surface, return black. */
78 if (g < 0.0f) {
79 return 0.0f;
80 }
81
82 /* When bump map correction is not used do skip the smoothing. */
83 if ((shader_flag & SD_USE_BUMP_MAP_CORRECTION) == 0) {
84 return 1.0f;
85 }
86
87 /* Return smoothed value to avoid discontinuity at perpendicular angle. */
88 float g2 = sqr(g);
89 return -g2 * g + g2 + g;
90}
91
92ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
93{
94 /* Shadow terminator workaround, taken from Appleseed.
95 * SPDX-License-Identifier: MIT
96 * Copyright (c) 2019 Francois Beaune, The appleseedhq Organization */
97 cos_in = min(cos_in, 1.0f);
98
99 const float angle = fast_acosf(cos_in);
100 const float val = max(cosf(angle * frequency_multiplier), 0.0f) / cos_in;
101 return val;
102}
103
105{
106 return dot(sc->N, wo) < 0.0f;
107}
108
111 ccl_private const ShaderClosure *sc,
112 const int path_flag,
113 const float3 rand,
114 ccl_private Spectrum *eval,
116 ccl_private float *pdf,
117 ccl_private float2 *sampled_roughness,
118 ccl_private float *eta)
119{
120 /* For curves use the smooth normal, particularly for ribbons the geometric
121 * normal gives too much darkening otherwise. */
122 *eval = zero_spectrum();
123 *pdf = 0.f;
124 int label = LABEL_NONE;
125 const float3 Ng = (sd->type & PRIMITIVE_CURVE) ? sc->N : sd->Ng;
126 const float2 rand_xy = float3_to_float2(rand);
127
128 switch (sc->type) {
130 label = bsdf_diffuse_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
131 *sampled_roughness = one_float2();
132 *eta = 1.0f;
133 break;
134#if defined(__SVM__) || defined(__OSL__)
136 label = bsdf_oren_nayar_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
137 *sampled_roughness = one_float2();
138 *eta = 1.0f;
139 break;
140# ifdef __OSL__
142 label = bsdf_phong_ramp_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
143 *eta = 1.0f;
144 break;
146 label = bsdf_diffuse_ramp_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
147 *sampled_roughness = one_float2();
148 *eta = 1.0f;
149 break;
150# endif
152 label = bsdf_translucent_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
153 *sampled_roughness = one_float2();
154 *eta = 1.0f;
155 break;
157 label = bsdf_transparent_sample(sc, Ng, sd->wi, eval, wo, pdf);
158 *sampled_roughness = zero_float2();
159 *eta = 1.0f;
160 break;
162 /* ray portals are not handled by the BSDF code, we should never get here */
163 kernel_assert(false);
164 break;
169 kg, sc, Ng, sd->wi, rand, eval, wo, pdf, sampled_roughness, eta);
170 break;
175 kg, sc, Ng, sd->wi, rand, eval, wo, pdf, sampled_roughness, eta);
176 break;
179 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
180 *eta = 1.0f;
181 break;
183 label = bsdf_ashikhmin_velvet_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
184 *sampled_roughness = one_float2();
185 *eta = 1.0f;
186 break;
188 label = bsdf_diffuse_toon_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
189 *sampled_roughness = one_float2();
190 *eta = 1.0f;
191 break;
193 label = bsdf_glossy_toon_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
194 // double check if this is valid
195 *sampled_roughness = one_float2();
196 *eta = 1.0f;
197 break;
200 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
201 *eta = 1.0f;
202 break;
205 sc, Ng, sd->wi, rand_xy, eval, wo, pdf, sampled_roughness);
206 *eta = 1.0f;
207 break;
208# ifdef __PRINCIPLED_HAIR__
210 label = bsdf_hair_chiang_sample(kg, sc, sd, rand, eval, wo, pdf, sampled_roughness);
211 *eta = 1.0f;
212 break;
214 label = bsdf_hair_huang_sample(kg, sc, sd, rand, eval, wo, pdf, sampled_roughness);
215 *eta = 1.0f;
216 break;
217# endif
219 label = bsdf_sheen_sample(sc, Ng, sd->wi, rand_xy, eval, wo, pdf);
220 *sampled_roughness = one_float2();
221 *eta = 1.0f;
222 break;
223#endif
224 default:
226 break;
227 }
228
229 /* Test if BSDF sample should be treated as transparent for background. */
230 if (label & LABEL_TRANSMIT) {
231 float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
232
233 if (threshold_squared >= 0.0f && !(label & LABEL_DIFFUSE)) {
234 if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
236 }
237 }
238 }
239 else {
240 /* Shadow terminator offset. */
241 const float frequency_multiplier =
242 kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
243 if (frequency_multiplier > 1.0f) {
244 const float cosNO = dot(*wo, sc->N);
245 *eval *= shift_cos_in(cosNO, frequency_multiplier);
246 }
247 if (label & LABEL_DIFFUSE) {
248 if (!isequal(sc->N, sd->N)) {
249 *eval *= bump_shadowing_term(sd->flag, sd->N, sc->N, *wo);
250 }
251 }
252 }
253
254#ifdef WITH_CYCLES_DEBUG
255 kernel_assert(*pdf >= 0.0f);
256 kernel_assert(eval->x >= 0.0f && eval->y >= 0.0f && eval->z >= 0.0f);
257#endif
258
259 return label;
260}
261
263 ccl_private const ShaderClosure *sc,
264 const float3 wo,
265 ccl_private float2 *roughness,
266 ccl_private float *eta)
267{
268#ifdef __SVM__
269 float alpha = 1.0f;
270#endif
271 switch (sc->type) {
273 *roughness = one_float2();
274 *eta = 1.0f;
275 break;
276#ifdef __SVM__
278 *roughness = one_float2();
279 *eta = 1.0f;
280 break;
281# ifdef __OSL__
283 alpha = phong_ramp_exponent_to_roughness(((ccl_private const PhongRampBsdf *)sc)->exponent);
284 *roughness = make_float2(alpha, alpha);
285 *eta = 1.0f;
286 break;
288 *roughness = one_float2();
289 *eta = 1.0f;
290 break;
291# endif
293 *roughness = one_float2();
294 *eta = 1.0f;
295 break;
298 *roughness = zero_float2();
299 *eta = 1.0f;
300 break;
307 ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
308 *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
309 *eta = (bsdf_is_transmission(sc, wo)) ? bsdf->ior : 1.0f;
310 break;
311 }
313 ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
314 *roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
315 *eta = 1.0f;
316 break;
317 }
319 *roughness = one_float2();
320 *eta = 1.0f;
321 break;
323 *roughness = one_float2();
324 *eta = 1.0f;
325 break;
327 // double check if this is valid
328 *roughness = one_float2();
329 *eta = 1.0f;
330 break;
332 *roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
333 ((ccl_private HairBsdf *)sc)->roughness2);
334 *eta = 1.0f;
335 break;
337 *roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
338 ((ccl_private HairBsdf *)sc)->roughness2);
339 *eta = 1.0f;
340 break;
341# ifdef __PRINCIPLED_HAIR__
343 alpha = ((ccl_private ChiangHairBSDF *)sc)->m0_roughness;
344 *roughness = make_float2(alpha, alpha);
345 *eta = 1.0f;
346 break;
348 alpha = ((ccl_private HuangHairBSDF *)sc)->roughness;
349 *roughness = make_float2(alpha, alpha);
350 *eta = 1.0f;
351 break;
352# endif
354 alpha = ((ccl_private SheenBsdf *)sc)->roughness;
355 *roughness = make_float2(alpha, alpha);
356 *eta = 1.0f;
357 break;
358#endif
359 default:
360 *roughness = one_float2();
361 *eta = 1.0f;
362 break;
363 }
364}
365
367 ccl_private const ShaderClosure *sc,
368 const float3 wo)
369{
370 /* For curves use the smooth normal, particularly for ribbons the geometric
371 * normal gives too much darkening otherwise. */
372 int label;
373 switch (sc->type) {
379 break;
380#ifdef __SVM__
383 break;
384# ifdef __OSL__
387 break;
390 break;
391# endif
394 break;
397 break;
400 break;
407 ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
410 break;
411 }
414 break;
417 break;
420 break;
423 break;
426 break;
429 break;
430# ifdef __PRINCIPLED_HAIR__
432 if (bsdf_is_transmission(sc, wo))
434 else
436 break;
439 break;
440# endif
443 break;
444#endif
445 default:
447 break;
448 }
449
450 /* Test if BSDF sample should be treated as transparent for background. */
451 if (label & LABEL_TRANSMIT) {
452 float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
453
454 if (threshold_squared >= 0.0f) {
455 if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
457 }
458 }
459 }
460 return label;
461}
462
463#ifndef __KERNEL_CUDA__
465#else
467#endif
471 ccl_private const ShaderClosure *sc,
472 const float3 wo,
473 ccl_private float *pdf)
474{
475 Spectrum eval = zero_spectrum();
476 *pdf = 0.f;
477
478 switch (sc->type) {
480 eval = bsdf_diffuse_eval(sc, sd->wi, wo, pdf);
481 break;
482#if defined(__SVM__) || defined(__OSL__)
484 eval = bsdf_oren_nayar_eval(sc, sd->wi, wo, pdf);
485 break;
486# ifdef __OSL__
488 eval = bsdf_phong_ramp_eval(sc, sd->wi, wo, pdf);
489 break;
491 eval = bsdf_diffuse_ramp_eval(sc, sd->wi, wo, pdf);
492 break;
493# endif
495 eval = bsdf_translucent_eval(sc, sd->wi, wo, pdf);
496 break;
498 eval = bsdf_transparent_eval(sc, sd->wi, wo, pdf);
499 break;
501 eval = bsdf_ray_portal_eval(sc, sd->wi, wo, pdf);
502 break;
506 /* For consistency with eval() this should be using sd->Ng, but that causes
507 * artifacts (see shadow_terminator_metal test). Needs deeper investigation
508 * for how to solve this. */
509 eval = bsdf_microfacet_ggx_eval(kg, sc, sd->N, sd->wi, wo, pdf);
510 break;
514 eval = bsdf_microfacet_beckmann_eval(kg, sc, sd->N, sd->wi, wo, pdf);
515 break;
517 eval = bsdf_ashikhmin_shirley_eval(sc, sd->N, sd->wi, wo, pdf);
518 break;
520 eval = bsdf_ashikhmin_velvet_eval(sc, sd->wi, wo, pdf);
521 break;
523 eval = bsdf_diffuse_toon_eval(sc, sd->wi, wo, pdf);
524 break;
526 eval = bsdf_glossy_toon_eval(sc, sd->wi, wo, pdf);
527 break;
528# ifdef __PRINCIPLED_HAIR__
530 eval = bsdf_hair_chiang_eval(kg, sd, sc, wo, pdf);
531 break;
533 eval = bsdf_hair_huang_eval(kg, sd, sc, wo, pdf);
534 break;
535# endif
537 eval = bsdf_hair_reflection_eval(sc, sd->wi, wo, pdf);
538 break;
540 eval = bsdf_hair_transmission_eval(sc, sd->wi, wo, pdf);
541 break;
543 eval = bsdf_sheen_eval(sc, sd->wi, wo, pdf);
544 break;
545#endif
546 default:
547 break;
548 }
549
550 if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
551 if (!isequal(sc->N, sd->N)) {
552 eval *= bump_shadowing_term(sd->flag, sd->N, sc->N, wo);
553 }
554 }
555
556 /* Shadow terminator offset. */
557 const float frequency_multiplier =
558 kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
559 if (frequency_multiplier > 1.0f) {
560 const float cosNO = dot(wo, sc->N);
561 if (cosNO >= 0.0f) {
562 eval *= shift_cos_in(cosNO, frequency_multiplier);
563 }
564 }
565
566#ifdef WITH_CYCLES_DEBUG
567 kernel_assert(*pdf >= 0.0f);
568 kernel_assert(eval.x >= 0.0f && eval.y >= 0.0f && eval.z >= 0.0f);
569#endif
570 return eval;
571}
572
574{
575 /* TODO: do we want to blur volume closures? */
576#if defined(__SVM__) || defined(__OSL__)
577 switch (sc->type) {
584 /* TODO: Recompute energy preservation after blur? */
585 bsdf_microfacet_blur(sc, roughness);
586 break;
588 bsdf_ashikhmin_shirley_blur(sc, roughness);
589 break;
590# ifdef __PRINCIPLED_HAIR__
592 bsdf_hair_chiang_blur(sc, roughness);
593 break;
595 bsdf_hair_huang_blur(sc, roughness);
596 break;
597# endif
598 default:
599 break;
600 }
601#endif
602}
603
605 ccl_private const ShaderData *sd,
606 ccl_private const ShaderClosure *sc,
607 const bool reflection,
608 const bool transmission)
609{
610 Spectrum albedo = sc->weight;
611 /* Some closures include additional components such as Fresnel terms that cause their albedo to
612 * be below 1. The point of this function is to return a best-effort estimation of their albedo,
613 * meaning the amount of reflected/refracted light that would be expected when illuminated by a
614 * uniform white background.
615 * This is used for the denoising albedo pass and diffuse/glossy/transmission color passes.
616 * NOTE: This should always match the sample_weight of the closure - as in, if there's an albedo
617 * adjustment in here, the sample_weight should also be reduced accordingly.
618 * TODO(lukas): Consider calling this function to determine the sample_weight? Would be a bit of
619 * extra overhead though. */
620#if defined(__SVM__) || defined(__OSL__)
621 if (CLOSURE_IS_BSDF_MICROFACET(sc->type)) {
623 kg, sd, (ccl_private const MicrofacetBsdf *)sc, reflection, transmission);
624 }
625# ifdef __PRINCIPLED_HAIR__
626 else if (sc->type == CLOSURE_BSDF_HAIR_CHIANG_ID) {
627 /* TODO(lukas): Principled Hair could also be split into a glossy and a transmission component,
628 * similar to Glass BSDFs. */
629 albedo *= bsdf_hair_chiang_albedo(sd, sc);
630 }
631 else if (sc->type == CLOSURE_BSDF_HAIR_HUANG_ID) {
632 albedo *= bsdf_hair_huang_albedo(sd, sc);
633 }
634# endif
635#endif
636 return albedo;
637}
638
MINLINE float safe_divide(float a, float b)
ccl_device_inline int bsdf_label(const KernelGlobals kg, ccl_private const ShaderClosure *sc, const float3 wo)
Definition bsdf.h:366
ccl_device_inline float bump_shadowing_term(int shader_flag, float3 Ng, float3 N, float3 I)
Definition bsdf.h:64
ccl_device_inline void bsdf_roughness_eta(const KernelGlobals kg, ccl_private const ShaderClosure *sc, const float3 wo, ccl_private float2 *roughness, ccl_private float *eta)
Definition bsdf.h:262
CCL_NAMESPACE_BEGIN ccl_device_inline float bsdf_get_specular_roughness_squared(ccl_private const ShaderClosure *sc)
Definition bsdf.h:30
ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multiplier)
Definition bsdf.h:92
ccl_device_inline float bsdf_get_roughness_pass_squared(ccl_private const ShaderClosure *sc)
Definition bsdf.h:44
ccl_device_inline int bsdf_sample(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private const 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:109
ccl_device void bsdf_blur(KernelGlobals kg, ccl_private ShaderClosure *sc, float roughness)
Definition bsdf.h:573
ccl_device_inline bool bsdf_is_transmission(ccl_private const ShaderClosure *sc, const float3 wo)
Definition bsdf.h:104
ccl_device Spectrum bsdf_eval(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private const ShaderClosure *sc, const float3 wo, ccl_private float *pdf)
Definition bsdf.h:469
ccl_device_inline Spectrum bsdf_albedo(KernelGlobals kg, ccl_private const ShaderData *sd, ccl_private const ShaderClosure *sc, const bool reflection, const bool transmission)
Definition bsdf.h:604
ccl_device void bsdf_ashikhmin_shirley_blur(ccl_private ShaderClosure *sc, float roughness)
ccl_device int bsdf_ashikhmin_shirley_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
ccl_device_forceinline Spectrum bsdf_ashikhmin_shirley_eval(ccl_private const ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, const float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_ashikhmin_velvet_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_diffuse_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_diffuse_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device int bsdf_translucent_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_translucent_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_hair_transmission_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
Definition bsdf_hair.h:194
ccl_device Spectrum bsdf_hair_transmission_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_hair.h:91
ccl_device Spectrum bsdf_hair_reflection_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_hair.h:39
ccl_device int bsdf_hair_reflection_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf, ccl_private float2 *sampled_roughness)
Definition bsdf_hair.h:142
ccl_device Spectrum bsdf_microfacet_ggx_eval(KernelGlobals kg, ccl_private const ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device_forceinline int bsdf_microfacet_eval_flag(const ccl_private MicrofacetBsdf *bsdf)
ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg, ccl_private const ShaderClosure *sc, float3 Ng, 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_estimate_albedo(KernelGlobals kg, ccl_private const ShaderData *sd, ccl_private const MicrofacetBsdf *bsdf, const bool eval_reflection, const bool eval_transmission)
ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg, ccl_private const ShaderClosure *sc, float3 Ng, 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, float roughness)
ccl_device Spectrum bsdf_microfacet_beckmann_eval(KernelGlobals kg, ccl_private const ShaderClosure *sc, const float3 Ng, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_oren_nayar_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_oren_nayar_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device void bsdf_hair_chiang_blur(ccl_private ShaderClosure *sc, float roughness)
ccl_device Spectrum bsdf_hair_chiang_albedo(ccl_private const ShaderData *sd, ccl_private const ShaderClosure *sc)
ccl_device Spectrum bsdf_hair_chiang_eval(KernelGlobals kg, ccl_private const ShaderData *sd, ccl_private const ShaderClosure *sc, const float3 wo, ccl_private float *pdf)
ccl_device int bsdf_hair_chiang_sample(KernelGlobals kg, ccl_private const 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 int bsdf_hair_huang_sample(const KernelGlobals kg, ccl_private const 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_huang_albedo(ccl_private const ShaderData *sd, ccl_private const ShaderClosure *sc)
ccl_device Spectrum bsdf_hair_huang_eval(KernelGlobals kg, ccl_private const ShaderData *sd, ccl_private const ShaderClosure *sc, const float3 wo, ccl_private float *pdf)
ccl_device void bsdf_hair_huang_blur(ccl_private ShaderClosure *sc, float roughness)
ccl_device Spectrum bsdf_ray_portal_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_sheen_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_sheen.h:53
ccl_device int bsdf_sheen_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
Definition bsdf_sheen.h:80
ccl_device int bsdf_diffuse_toon_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
Definition bsdf_toon.h:84
ccl_device int bsdf_glossy_toon_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, float2 rand, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
Definition bsdf_toon.h:148
ccl_device Spectrum bsdf_glossy_toon_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_toon.h:119
ccl_device Spectrum bsdf_diffuse_toon_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
Definition bsdf_toon.h:59
ccl_device int bsdf_transparent_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 wi, ccl_private Spectrum *eval, ccl_private float3 *wo, ccl_private float *pdf)
ccl_device Spectrum bsdf_transparent_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
additional_info("compositor_sum_squared_difference_float_shared") .push_constant(Type output_img float dot(value.rgb, luminance_coefficients)") .define("LOAD(value)"
const char * label
#define kernel_assert(cond)
#define kernel_data
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define kernel_data_fetch(name, index)
#define cosf(x)
#define ccl_device
#define ccl_private
#define ccl_device_inline
#define CCL_NAMESPACE_END
ccl_device_forceinline float2 make_float2(const float x, const float y)
#define CLOSURE_IS_BSDF_MICROFACET(type)
#define CLOSURE_IS_BSDF_SINGULAR(type)
#define CLOSURE_IS_BSDF_DIFFUSE(type)
@ 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_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
ShaderData
@ LABEL_TRANSMIT
@ LABEL_RAY_PORTAL
@ LABEL_TRANSMIT_TRANSPARENT
@ LABEL_DIFFUSE
@ LABEL_NONE
@ LABEL_SINGULAR
@ LABEL_GLOSSY
@ LABEL_REFLECT
@ LABEL_TRANSPARENT
ShaderClosure
ccl_device float fast_acosf(float x)
Definition math_fast.h:260
ccl_device_inline float2 one_float2()
Definition math_float2.h:19
CCL_NAMESPACE_BEGIN ccl_device_inline float2 zero_float2()
Definition math_float2.h:14
ccl_device_inline bool isequal(const float2 a, const float2 b)
#define N
#define I
#define min(a, b)
Definition sort.c:32
float max
#define zero_spectrum
SPECTRUM_DATA_TYPE Spectrum
ccl_device_inline float sqr(float a)
Definition util/math.h:782
ccl_device_inline float2 float3_to_float2(const float3 a)
Definition util/math.h:530