MCPcopy Create free account
hub / github.com/RenderKit/embree / sample

Function sample

tutorials/common/tutorial/optics.h:140–148  ·  view source on GitHub ↗

! Samples the power cosine distribution. */

Source from the content-addressed store, hash-verified

138
139/*! Samples the power cosine distribution. */
140inline void sample(const PowerCosineDistribution& This, const Vec3fa& wo, const Vec3fa& N, Sample3f &wi, const Vec2f s)
141{
142 Vec3fa dir = powerCosineSampleHemisphere(This.exp,s);
143 Sample3f wh;
144 wh.v = frame(N) * dir;
145 wh.pdf = powerCosineSampleHemispherePDF(dir,This.exp);
146 Sample3f r = make_Sample3f(reflect(wo,wh.v),1.0f);
147 wi = make_Sample3f(r.v,wh.pdf/(4.0f*abs(dot(wo,wh.v))));
148}
149
150/*! Samples the power cosine distribution. */
151#if defined(ISPC)

Callers 1

MetalMaterial__sampleFunction · 0.85

Calls 7

frameFunction · 0.85
make_Sample3fFunction · 0.85
reflectFunction · 0.85
absFunction · 0.50
dotFunction · 0.50

Tested by

no test coverage detected