MCPcopy Create free account
hub / github.com/blender/cycles / bsdf_diffuse_sample

Function bsdf_diffuse_sample

src/kernel/closure/bsdf_diffuse.h:43–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43ccl_device int bsdf_diffuse_sample(const ccl_private ShaderClosure *sc,
44 const float3 Ng,
45 const float3 /*wi*/,
46 const float2 rand,
47 ccl_private Spectrum *eval,
48 ccl_private float3 *wo,
49 ccl_private float *pdf)
50{
51 const ccl_private DiffuseBsdf *bsdf = (const ccl_private DiffuseBsdf *)sc;
52 const float3 N = bsdf->N;
53
54 // distribution over the hemisphere
55 sample_cos_hemisphere(N, rand, wo, pdf);
56
57 if (dot(Ng, *wo) > 0.0f) {
58 *eval = make_spectrum(*pdf);
59 }
60 else {
61 *pdf = 0.0f;
62 *eval = zero_spectrum();
63 }
64 return LABEL_REFLECT | LABEL_DIFFUSE;
65}
66
67/* TRANSLUCENT */
68

Callers 1

bsdf_sampleFunction · 0.85

Calls 2

sample_cos_hemisphereFunction · 0.85
dotFunction · 0.50

Tested by

no test coverage detected