yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
52a45890b
master
1implementing bsdfs; 2public struct LambertDiffuseBTDF : IBSDF, IDifferentiable 3{ 4 float3 albedo = {}; ///< Diffuse albedo. 5#if 0 6 public __init(float3 albedo_) 7#else 8 __init(float3 albedo_) 9#endif 10 { 11 this.albedo = albedo_; 12 } 13 14 [Differentiable] 15 public float3 eval(const float3 wi, const float3 wo, BSDFContext bc) 16 { 17 if (min(wi.z, -wo.z) < 1e-6f) 18 return float3(0.f); 19 20 return (1.0 / 3.1415) * albedo * -wo.z; 21 } 22}