32 if (rand_bsdf.
x < 0.5f) {
38 rand_bsdf.
x = 2.0f * (rand_bsdf.
x - 0.5f);
41 const float cos_NI =
dot(
bssrdf->N, sd->wi);
51 const float alpha =
bssrdf->alpha;
52 const float neta = 1.0f /
bssrdf->ior;
59 const float cos_HI =
dot(
H, sd->wi);
60 const float arg = 1.0f - (
sqr(neta) * (1.0f -
sqr(cos_HI)));
64 const float dnp =
max(
sqrtf(arg), 1e-7f);
65 const float nK = (neta * cos_HI) - dnp;
66 *wo = -(neta * sd->wi) + (nK *
H);
116 if (!subsurface_entry_bounce(kg,
bssrdf, sd, &rng_state, &wo) ||
dot(sd->Ng, wo) >= 0.0f) {
153 N = surface_shader_bssrdf_normal(sd);
181 if (!subsurface_random_walk(kg,
state, rng_state, ray, ss_isect)) {
186 if (!subsurface_disk(kg,
state, rng_state, ray, ss_isect)) {
194 const int object = ss_isect.hits[0].object;
208 ray.P += ray.D * ray.tmax * 2.0f;
220 const bool use_caustics =
kernel_data.integrator.use_caustics &&
231 else if (use_raytrace_kernel) {
ccl_device_inline ccl_private ShaderClosure * bsdf_alloc(ccl_private ShaderData *sd, const int size, Spectrum weight)
ccl_device int bsdf_diffuse_setup(ccl_private DiffuseBsdf *bsdf)
ccl_device_forceinline float3 microfacet_ggx_sample_vndf(const float3 wi, const float alpha_x, const float alpha_y, const float2 rand)
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
ccl_device_forceinline int intersection_get_shader(KernelGlobals kg, const ccl_private Intersection *ccl_restrict isect)
ccl_device_forceinline int intersection_get_object_flags(KernelGlobals kg, const ccl_private Intersection *ccl_restrict isect)
ccl_device_inline T to_global(const float2 p, const T X, const T Y)
#define kernel_assert(cond)
#define ccl_optional_struct_init
#define kernel_data_fetch(name, index)
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define KERNEL_FEATURE_LIGHT_PASSES
#define CCL_NAMESPACE_END
ccl_device_forceinline float differential_make_compact(const float dD)
ccl_device_forceinline float differential_zero_compact()
CCL_NAMESPACE_BEGIN ccl_device void integrator_volume_stack_update_for_subsurface(KernelGlobals kg, IntegratorState state, const float3 from_P, const float3 to_P)
ccl_device_forceinline void guiding_record_bssrdf_weight(KernelGlobals kg, IntegratorState state, const Spectrum weight, const Spectrum albedo)
@ CLOSURE_BSSRDF_BURLEY_ID
@ CLOSURE_BSSRDF_RANDOM_WALK_SKIN_ID
@ PATH_RAY_SUBSURFACE_BACKFACING
@ PATH_RAY_SUBSURFACE_DISK
@ PATH_RAY_DIFFUSE_ANCESTOR
@ PATH_RAY_SUBSURFACE_RANDOM_WALK
@ SD_OBJECT_INTERSECTS_VOLUME
@ LABEL_SUBSURFACE_SCATTER
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE
@ DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE
@ DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE
ccl_device_inline void make_orthonormals(const float3 N, ccl_private float3 *a, ccl_private float3 *b)
ccl_device_inline void path_state_rng_load(ConstIntegratorState state, ccl_private RNGState *rng_state)
ccl_device_inline float2 path_state_rng_2D(KernelGlobals kg, const ccl_private RNGState *rng_state, const int dimension)
ccl_device_inline void sample_cos_hemisphere(const float3 N, const float2 rand_in, ccl_private float3 *wo, ccl_private float *pdf)
#define INTEGRATOR_STATE_WRITE(state, nested_struct, member)
#define INTEGRATOR_STATE(state, nested_struct, member)
IntegratorStateCPU * IntegratorState
ccl_device_forceinline void integrator_path_next_sorted(KernelGlobals, IntegratorState state, const DeviceKernel current_kernel, const DeviceKernel next_kernel, const uint32_t key)
CCL_NAMESPACE_BEGIN ccl_device_forceinline void integrator_state_write_ray(IntegratorState state, const ccl_private Ray *ccl_restrict ray)
ccl_device_forceinline void integrator_state_write_isect(IntegratorState state, const ccl_private Intersection *ccl_restrict isect)
closure color bssrdf(string method, normal N, vector radius, color albedo) BUILTIN
ccl_device_inline Spectrum surface_shader_bssrdf_sample_weight(const ccl_private ShaderData *ccl_restrict sd, const ccl_private ShaderClosure *ccl_restrict bssrdf_sc)