MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenShadingLanguage / sample

Method sample

src/testrender/shading.cpp:605–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603 return pdf = 0;
604 }
605 virtual float sample(const OSL::ShaderGlobals& sg, float rx, float ry, float rz, OSL::Dual2<OSL::Vec3>& wi, float& pdf) const {
606 // only one direction is possible
607 OSL::Dual2<OSL::Vec3> I = OSL::Dual2<OSL::Vec3>(sg.I, sg.dIdx, sg.dIdy);
608 OSL::Dual2<float> cosNO = -dot(N, I);
609 if (cosNO.val() > 0) {
610 wi = (2 * cosNO) * N + I;
611 pdf = std::numeric_limits<float>::infinity();
612 return fresnel_dielectric(cosNO.val(), eta);
613 }
614 return pdf = 0;
615 }
616};
617
618struct Refraction : public BSDF, RefractionParams {

Callers

nothing calls this directly

Calls 2

fresnel_dielectricFunction · 0.85
dotFunction · 0.50

Tested by

no test coverage detected