private static void TestCase02() { // The Schlick approximation with a perpendicular viewing angle Shape shape = new GlassSphere(); Ray r = new Ray(Tuple.Point(0, 0, 0), Tuple.Vector(0, 1, 0)); List <Intersection> xs = Intersection.Aggregate(new Intersection(-1, shape), new Intersection(1, shape)); Computation comps = new Computation(xs[1], r, xs); float reflectance = Fresnel.Schlick(comps); Assert.Equal(0.04f, reflectance, 5); }
private static void TestCase03() { // The Schlick approximation with small angle and n2 > n1 Shape shape = new GlassSphere(); Ray r = new Ray(Tuple.Point(0, 0.99f, -2), Tuple.Vector(0, 0, 1)); List <Intersection> xs = Intersection.Aggregate(new Intersection(1.8589f, shape)); Computation comps = new Computation(xs[0], r, xs); float reflectance = Fresnel.Schlick(comps); Assert.Equal(0.48873f, reflectance, 5); }
private static void TestCase01() { // The Schlick approximation under total internal reflection Shape shape = new GlassSphere(); Ray r = new Ray(Tuple.Point(0, 0, Sqrt(2) / 2), Tuple.Vector(0, 1, 0)); List <Intersection> xs = Intersection.Aggregate(new Intersection(-Sqrt(2) / 2, shape), new Intersection(Sqrt(2) / 2, shape)); Computation comps = new Computation(xs[1], r, xs); float reflectance = Fresnel.Schlick(comps); Assert.Equal(1, reflectance); }