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

Function MetalMaterial__eval

tutorials/pathtracer/pathtracer_device.cpp:643–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643Vec3fa MetalMaterial__eval(ISPCMetalMaterial* This, const BRDF& brdf, const Vec3fa& wo, const DifferentialGeometry& dg, const Vec3fa& wi)
644{
645 const FresnelConductor fresnel = make_FresnelConductor(Vec3fa(This->eta),Vec3fa(This->k));
646 const PowerCosineDistribution distribution = make_PowerCosineDistribution(rcp(This->roughness));
647
648 const float cosThetaO = dot(wo,dg.Ns);
649 const float cosThetaI = dot(wi,dg.Ns);
650 if (cosThetaI <= 0.0f || cosThetaO <= 0.0f) return Vec3fa(0.f);
651 const Vec3fa wh = normalize(wi+wo);
652 const float cosThetaH = dot(wh, dg.Ns);
653 const float cosTheta = dot(wi, wh); // = dot(wo, wh);
654 const Vec3fa F = eval(fresnel,cosTheta);
655 const float D = eval(distribution,cosThetaH);
656 const float G = min(1.0f, min(2.0f * cosThetaH * cosThetaO / cosTheta,
657 2.0f * cosThetaH * cosThetaI / cosTheta));
658 return (Vec3fa(This->reflectance)*F) * D * G * rcp(4.0f*cosThetaO);
659}
660
661Vec3fa MetalMaterial__sample(ISPCMetalMaterial* This, const BRDF& brdf, const Vec3fa& Lw, const Vec3fa& wo, const DifferentialGeometry& dg, Sample3f& wi_o, Medium& medium, const Vec2f& s)
662{

Callers 2

MetalMaterial__sampleFunction · 0.85
Material__evalFunction · 0.85

Calls 8

make_FresnelConductorFunction · 0.85
Vec3faClass · 0.50
rcpFunction · 0.50
dotFunction · 0.50
normalizeFunction · 0.50
evalFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected