23 float s =
sqrtf(3.0f * (1.0f - alpha_prime));
24 return 0.5f * alpha_prime * (1.0f +
expf(-fourthirdA * s)) *
expf(-s);
41 constexpr
const int max_num_iterations = 12;
42 for (
int i = 0; i < max_num_iterations; ++i) {
43 xmid = 0.5f * (x0 + x1);
67 const float inv_eta = 1.0f / eta;
68 const float F_dr = inv_eta * (-1.440f * inv_eta + 0.710f) + 0.668f + 0.0636f * eta;
69 const float fourthirdA = (4.0f / 3.0f) * (1.0f + F_dr) /
90 #define BURLEY_TRUNCATE 16.0f
91 #define BURLEY_TRUNCATE_CDF 0.9963790093708328f
96 return 1.9f -
A + 3.5f * (
A - 0.8f) * (
A - 0.8f);
133 float exp_r_3_d =
expf(-
r / (3.0f * d));
134 float exp_r_d = exp_r_3_d * exp_r_3_d * exp_r_3_d;
135 return (exp_r_d + exp_r_3_d) / (4.0f * d);
153 const float tolerance = 1e-6f;
154 const int max_iteration_count = 10;
162 r =
expf(xi * xi * 2.4f) - 1.0f;
169 for (
int i = 0; i < max_iteration_count; i++) {
170 float exp_r_3 =
expf(-
r / 3.0f);
171 float exp_r = exp_r_3 * exp_r_3 * exp_r_3;
172 float f = 1.0f - 0.25f * exp_r - 0.75f * exp_r_3 - xi;
173 float f_ = 0.25f * exp_r + 0.25f * exp_r_3;
175 if (
fabsf(f) < tolerance || f_ == 0.0f) {
204 if (radius.
x > 0.0f) {
207 if (radius.
y > 0.0f) {
210 if (radius.
z > 0.0f) {
222 float sampled_radius;
229 sampled_radius = (radius.
x > 0.0f) ? radius.
x : (radius.
y > 0.0f) ? radius.
y : radius.
z;
231 else if (xi < 2.0f) {
233 sampled_radius = (radius.
x > 0.0f && radius.
y > 0.0f) ? radius.
y : radius.
z;
237 sampled_radius = radius.
z;
269 bssrdf->sample_weight = sample_weight;
281 if (
bssrdf->roughness != FLT_MAX) {
287 bsdf->roughness =
bssrdf->roughness;
297 int bssrdf_channels = 3;
301 diffuse_weight.
x =
bssrdf->weight.x;
307 diffuse_weight.
y =
bssrdf->weight.y;
313 diffuse_weight.
z =
bssrdf->weight.z;
319 if (bssrdf_channels < 3) {
321 #ifdef __PRINCIPLED__
322 if (
bssrdf->roughness != FLT_MAX) {
328 bsdf->roughness =
bssrdf->roughness;
346 if (bssrdf_channels > 0) {
356 bssrdf->sample_weight = 0.0f;
MINLINE float safe_sqrtf(float a)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
CCL_NAMESPACE_BEGIN ccl_device ccl_private ShaderClosure * closure_alloc(ccl_private ShaderData *sd, int size, ClosureType type, float3 weight)
ccl_device_inline ccl_private ShaderClosure * bsdf_alloc(ccl_private ShaderData *sd, int size, float3 weight)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ccl_device int bsdf_diffuse_setup(ccl_private DiffuseBsdf *bsdf)
ccl_device_inline float bsdf_principled_diffuse_retro_reflection_sample_weight(ccl_private PrincipledDiffuseBsdf *bsdf, const float3 I)
ccl_device int bsdf_principled_diffuse_setup(ccl_private PrincipledDiffuseBsdf *bsdf)
@ PRINCIPLED_DIFFUSE_RETRO_REFLECTION
@ PRINCIPLED_DIFFUSE_LAMBERT
CCL_NAMESPACE_BEGIN struct Bssrdf Bssrdf
ccl_device_forceinline float bssrdf_burley_root_find(float xi)
ccl_device float bssrdf_num_channels(const float3 radius)
ccl_device_inline ccl_private Bssrdf * bssrdf_alloc(ccl_private ShaderData *sd, float3 weight)
ccl_device float bssrdf_burley_pdf(const float d, float r)
ccl_device_inline float bssrdf_burley_fitting(float A)
ccl_device float bssrdf_dipole_compute_alpha_prime(float rd, float fourthirdA)
#define BURLEY_TRUNCATE_CDF
ccl_device_inline float3 bssrdf_burley_compatible_mfp(float3 r)
ccl_device void bssrdf_setup_radius(ccl_private Bssrdf *bssrdf, const ClosureType type, const float eta)
ccl_device_forceinline float3 bssrdf_eval(const float3 radius, float r)
ccl_device void bssrdf_burley_setup(ccl_private Bssrdf *bssrdf)
ccl_device float bssrdf_dipole_compute_Rd(float alpha_prime, float fourthirdA)
ccl_device void bssrdf_burley_sample(const float d, float xi, ccl_private float *r, ccl_private float *h)
ccl_device int bssrdf_setup(ccl_private ShaderData *sd, ccl_private Bssrdf *bssrdf, ClosureType type, const float ior)
ccl_device float bssrdf_burley_eval(const float d, float r)
ccl_device void bssrdf_sample(const float3 radius, float xi, ccl_private float *r, ccl_private float *h)
ccl_device_forceinline float bssrdf_pdf(const float3 radius, float r)
#define ccl_device_forceinline
#define ccl_device_inline
#define CCL_NAMESPACE_END
@ CLOSURE_BSSRDF_RANDOM_WALK_FIXED_RADIUS_ID
@ CLOSURE_BSSRDF_BURLEY_ID
#define CLOSURE_WEIGHT_CUTOFF
#define BSSRDF_MIN_RADIUS
ccl_device_inline float average(const float2 &a)
ccl_device_inline float3 one_float3()
static const pxr::TfToken ior("ior", pxr::TfToken::Immortal)
closure color bssrdf(string method, normal N, vector radius, color albedo) BUILTIN