22 bsdf->alpha_x =
clamp(bsdf->alpha_x, 1e-4f, 1.0f);
23 bsdf->alpha_y =
clamp(bsdf->alpha_y, 1e-4f, 1.0f);
51 float NdotI =
dot(
N,
I);
52 float NdotO =
dot(
N, omega_in);
56 if (
fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
60 if (NdotI > 0.0f && NdotO > 0.0f) {
61 NdotI =
fmaxf(NdotI, 1e-6f);
62 NdotO =
fmaxf(NdotO, 1e-6f);
69 float pump = 1.0f /
fmaxf(1e-6f, (HdotI *
fmaxf(NdotO, NdotI)));
79 float lobe =
powf(HdotN,
e);
82 out = NdotO *
norm * lobe * pump;
84 *pdf =
norm * lobe / HdotI;
91 float HdotX =
dot(
H,
X);
92 float HdotY =
dot(
H,
Y);
95 float e = (n_x * HdotX * HdotX + n_y * HdotY * HdotY) / (1.0f - HdotN * HdotN);
96 lobe =
powf(HdotN,
e);
103 out = NdotO *
norm * lobe * pump;
104 *pdf =
norm * lobe / HdotI;
128 float cos_phi =
cosf(*phi);
129 float sin_phi =
sinf(*phi);
130 *cos_theta =
powf(randv, 1.0f / (n_x * cos_phi * cos_phi + n_y * sin_phi * sin_phi + 1.0f));
150 float NdotI =
dot(
N,
I);
170 cos_theta =
powf(randv, 1.0f / (n_x + 1.0f));
175 float remapped_randu = 4.0f * randu;
177 n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
179 else if (randu < 0.5f) {
180 float remapped_randu = 4.0f * (.5f - randu);
182 n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
185 else if (randu < 0.75f) {
186 float remapped_randu = 4.0f * (randu - 0.5f);
188 n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
192 float remapped_randu = 4.0f * (1.0f - randu);
194 n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
195 phi = 2.0f *
M_PI_F - phi;
200 float sin_theta =
sqrtf(
fmaxf(0.0f, 1.0f - cos_theta * cos_theta));
201 float cos_phi =
cosf(phi);
202 float sin_phi =
sinf(phi);
207 float HdotI =
dot(
H,
I);
212 *omega_in = -
I + (2.0f * HdotI) *
H;
214 if (
fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
225 #ifdef __RAY_DIFFERENTIALS__
227 *domega_in_dx = (2.0f *
dot(
N, dIdx)) *
N - dIdx;
228 *domega_in_dy = (2.0f *
dot(
N, dIdy)) *
N - dIdy;
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its X
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its Y
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ccl_device void bsdf_ashikhmin_shirley_blur(ccl_private ShaderClosure *sc, float roughness)
ccl_device float3 bsdf_ashikhmin_shirley_eval_transmit(ccl_private const ShaderClosure *sc, const float3 I, const float3 omega_in, ccl_private float *pdf)
ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(ccl_private const ShaderClosure *sc, const float3 I, const float3 omega_in, ccl_private float *pdf)
ccl_device int bsdf_ashikhmin_shirley_sample(ccl_private const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, ccl_private float3 *eval, ccl_private float3 *omega_in, ccl_private float3 *domega_in_dx, ccl_private float3 *domega_in_dy, ccl_private float *pdf)
ccl_device_inline float bsdf_ashikhmin_shirley_roughness_to_exponent(float roughness)
CCL_NAMESPACE_BEGIN ccl_device int bsdf_ashikhmin_shirley_setup(ccl_private MicrofacetBsdf *bsdf)
ccl_device_inline void bsdf_ashikhmin_shirley_sample_first_quadrant(float n_x, float n_y, float randu, float randv, ccl_private float *phi, ccl_private float *cos_theta)
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
#define ccl_device_forceinline
#define ccl_device_inline
#define CCL_NAMESPACE_END
@ CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
T clamp(const T &a, const T &min, const T &max)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken roughness("roughness", pxr::TfToken::Immortal)
ccl_device void make_orthonormals_tangent(const float3 N, const float3 T, ccl_private float3 *a, ccl_private float3 *b)
ccl_device_inline void make_orthonormals(const float3 N, ccl_private float3 *a, ccl_private float3 *b)