Skip to content

solid_angle

float  solid_angle(bsdf b, int mask)

b

BSDF to sample.

mask

A bitmask indicating which types of bounces to evaluate.

See bouncemask for information on component label bitmasks.

Examples

examples

// Split BSDF into component lobes
bsdf lobes[] = split_bsdf(hitF);
// Get solid angle of lobes
float angles[];
resize(angles, len(lobes));
for (int i = 0; i < len(lobes); i++)
{
angles[i] = solid_angle(lobes[i], PBR_ALL_MASK);
}
// Compute PDF from angles
float pdf[] = compute_pdf(angles);
// Compute CDF from PDF
float cdf[] = compute_cdf(pdf);
// Randomly select a BSDF based on albedo distribution
int id = sample_cdf(cdf, sx);
// Do something with the selected BSDF
// lobes[id] ...