// public float Pdf(Vector3 <float> wo, Vector3 <float> wh) { if (sampleVisibleArea) { return(D(wh) * G1(wo) * Vector3 <float> .AbsDot(wo, wh) / BxDF.AbsCosTheta(wo)); } else { return(D(wh) * BxDF.AbsCosTheta(wo)); } }
public override float Lambda(Vector3 <float> w) { var absTanTheta = Math.Abs(BxDF.TanTheta(w)); if (float.IsInfinity(absTanTheta)) { return(0); } var alpha = MathF.Sqrt(BxDF.Cos2Phi(w) * alphaX * alphaX + BxDF.Sin2Phi(w) * alphaY * alphaY); var alpha2Tan2Theta = (alpha * absTanTheta) * (alpha * absTanTheta); return((-1 + MathF.Sqrt(1 + alpha2Tan2Theta)) / 2.0f); }
public override float D(Vector3 <float> wh) { var tan2Theta = BxDF.Tan2Theta(wh); // Special case: tan² converges to infinity (at grazing angles) if (float.IsInfinity(tan2Theta)) { return(0); } var cos2Theta = BxDF.Cos2Theta(wh); return (MathF.Exp(-tan2Theta * (BxDF.Cos2Phi(wh) / (alphaX * alphaX) + BxDF.Sin2Phi(wh) / (alphaY * alphaY))) / (MathUtils.Pi * alphaX * alphaY * cos2Theta * cos2Theta)); }
public override float Lambda(Vector3 <float> w) { var absTanTheta = Math.Abs(BxDF.TanTheta(w)); if (float.IsInfinity(absTanTheta)) { return(0); } var alpha = MathF.Sqrt(BxDF.Cos2Phi(w) * alphaX * alphaX + BxDF.Sin2Phi(w) * alphaY * alphaY); var a = 1.0f / (alpha / absTanTheta); if (a >= 1.6f) { return(0); } return((1 - 1.259f * a + 0.396f * a * a) / (3.535f * a + 2.181f * a * a)); }
public void Add(BxDF b) { bxdfs.Add(b); }