21 #ifndef LIB_LIGHTMETRICA_BSDF_H
22 #define LIB_LIGHTMETRICA_BSDF_H
24 #include "generalizedbsdf.h"
25 #include "surfacegeometry.h"
37 LM_ASSET_INTERFACE_DEF(
"bsdf",
"bsdfs");
38 LM_ASSET_DEPENDENCIES(
"texture");
59 const Math::Vec3& localWi,
const Math::Vec3& localWo,
const Math::Vec3& worldWi,
const Math::Vec3& worldWo)
64 auto wiDotNg = Math::Dot(worldWi, geom.
gn);
65 auto woDotNg = Math::Dot(worldWo, geom.
gn);
66 auto wiDotNs = Math::CosThetaZUp(localWi);
67 auto woDotNs = Math::CosThetaZUp(localWo);
68 if (wiDotNg * wiDotNs <= 0 || woDotNg * woDotNs <= 0)
70 return Math::Float(0);
76 if (transportDir == TransportDirection::LE)
79 return wiDotNs * woDotNg / (woDotNs * wiDotNg);
82 return Math::Float(1);
89 #endif // LIB_LIGHTMETRICA_BSDF_H
static LM_FORCE_INLINE Math::Float ShadingNormalCorrectionFactor(const TransportDirection &transportDir, const SurfaceGeometry &geom, const Math::Vec3 &localWi, const Math::Vec3 &localWo, const Math::Vec3 &worldWi, const Math::Vec3 &worldWo)
Definition: bsdf.h:57
Definition: generalizedbsdf.h:168
Math::Vec3 gn
Geometry normal.
Definition: surfacegeometry.h:42
Definition: surfacegeometry.h:36