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)); }