41 if (angle < max_angle) {
44 else if (angle < (max_angle + smooth) && smooth != 0.0f) {
45 is = (1.0f - (angle - max_angle) / smooth);
65 float max_angle = bsdf->
size;
66 float smooth = bsdf->smooth;
67 float cosNO =
dot(bsdf->N, wo);
73 if (angle < sample_angle) {
93 float max_angle = bsdf->
size;
94 float smooth = bsdf->smooth;
100 if (
dot(Ng, *wo) > 0.0f) {
101 float angle =
acosf(cosNO);
125 float max_angle = bsdf->
size;
126 float smooth = bsdf->smooth;
127 float cosNI =
dot(bsdf->N, wi);
128 float cosNO =
dot(bsdf->N, wo);
130 if (cosNI > 0 && cosNO > 0) {
132 float3 R = (2 * cosNI) * bsdf->N - wi;
133 float cosRO =
dot(
R, wo);
138 if (angle < sample_angle) {
157 float max_angle = bsdf->
size;
158 float smooth = bsdf->smooth;
159 float cosNI =
dot(bsdf->N, wi);
163 float3 R = (2 * cosNI) * bsdf->N - wi;
171 if (
dot(Ng, *wo) > 0.0f &&
dot(bsdf->N, *wo) > 0.0f) {
172 float angle =
acosf(cosRO);
MINLINE float safe_acosf(float a)
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)
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)
ccl_device int bsdf_diffuse_toon_setup(ccl_private ToonBsdf *bsdf)
ccl_device float bsdf_toon_get_intensity(float max_angle, float smooth, float angle)
ccl_device float bsdf_toon_get_sample_angle(float max_angle, float smooth)
ccl_device Spectrum bsdf_glossy_toon_eval(ccl_private const ShaderClosure *sc, const float3 wi, const float3 wo, ccl_private float *pdf)
CCL_NAMESPACE_BEGIN struct ToonBsdf ToonBsdf
ccl_device_inline int bsdf_toon_setup_common(ccl_private ToonBsdf *bsdf)
ccl_device int bsdf_glossy_toon_setup(ccl_private ToonBsdf *bsdf)
ccl_device Spectrum bsdf_diffuse_toon_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)"
#define ccl_device_inline
#define CCL_NAMESPACE_END
@ CLOSURE_BSDF_DIFFUSE_TOON_ID
@ CLOSURE_BSDF_GLOSSY_TOON_ID
ccl_device_inline float3 sample_uniform_cone(const float3 N, const float one_minus_cos_angle, const float2 rand, ccl_private float *cos_theta, ccl_private float *pdf)
SPECTRUM_DATA_TYPE Spectrum
ccl_device_inline float one_minus_cos(const float angle)
ccl_device_inline int clamp(int a, int mn, int mx)