void sample_bsdf(bsdf F, vector viewer_u, vector &dir, vector &eval, int &type, float sx, float sy, ...)
void sample_bsdf(bsdf F, vector viewer_u, vector &dir, vector &eval, int &type, float sx, float sy, int mask, ...)
void sample_bsdf(bsdf F, vector viewer_u, vector &dir, vector &eval, float &pdf, int &type, float sx, float sy, ...)
void sample_bsdf(bsdf F, vector viewer_u, vector &dir, vector &eval, float &pdf, int &type, float sx, float sy, int mask, ...)
void sample_bsdf(bsdf b, vector viewer_u, vector normal_v, int &mask, vector &dir, vector &eval, float &pdf, int &type, float sx, float sy, int bounces, ...)
F
The BSDF to sample.
viewer_u
The U vector (input viewer direction).
normal_v
The V vector (input surface normal).
&mask
A bitfield of flags for the BSDF, defined in pbr.h
.
See bouncemask for information on component label bitmasks.
&dir
The function overwrites this variable with the outgoing ray direction.
&eval
The function overwrites this variable with the outgoing ray color, scaled by albedo.
This is not the same as the evaluated vector returned by the eval_bsdf
operation. Here, &eval
will not vary with the outgoing sample direction.
&pdf
The function overwrites this variable with the computed PDF of the BSDF.
&type
???
sx
and sy
Random values, such as generated by nextsample. Different values of sx
and sy
represent different random directions to sample.
&eval
Overwritten with the color, scaled by albedo, of the sampled component.
&type
Overwritten with the type of component sampled. This uses the same constants as in
the mask
argument.
&pdf
The sampling pdf for the sampled component.
bounces
A bitmask representing bounce types allowed.
The sample_bsdf
function passes keyword arguments to the BSDF being
evaluated. For custom BSDFs these keyword arguments are bound to shader
arguments (e.g. indicating whether the BSDF is being evaluated for direct or
indirect illumination). It’s also possible for a BSDF to pass information back
to sample_bsdf
. To indicate that a keyword argument value should be imported
from the BSDF prefix the keyword with "import:". For example:
Examples
sample_bsdf(F, inI, outI, eval, type, sx, sy, "direct", 0, // Specify indirect illumination "import:sssmfp", sssmfp, // Read the exported sssmfp parameter ... );
See also | |
bsdf | |
pbr |
|
sampling |