示例#1
0
        public void ReflectanceIsSignificantAtSmallViewAngles()
        {
            var s           = Spheres.GlassSphere();
            var r           = new Ray(new Point(0, 0.99f, -2f), new Vector(0, 0, 1));
            var xs          = Intersections.Create(new Intersection(1.8589f, s));
            var comps       = new IntersectionInfo(xs[0], r, xs);
            var reflectance = PhongShading.Schlick(comps);

            reflectance.Should().BeApproximately(0.48873f, 0.0001f);
        }
示例#2
0
        public void ReflectanceIsSmallAtPerpendicularViewAngles()
        {
            var s  = Spheres.GlassSphere();
            var r  = new Ray(new Point(0, 0, 0), new Vector(0, 1, 0));
            var xs = Intersections.Create(new Intersection(-1f, s),
                                          new Intersection(1f, s));
            var comps       = new IntersectionInfo(xs[1], r, xs);
            var reflectance = PhongShading.Schlick(comps);

            reflectance.Should().BeApproximately(0.04f, 0.0001f);
        }
示例#3
0
        public void SchlickApproximationForTotalInternalReflectionIsOne()
        {
            var s  = Spheres.GlassSphere();
            var r  = new Ray(new Point(0, 0, MathF.Sqrt(2f) / 2f), new Vector(0, 1, 0));
            var xs = Intersections.Create(new Intersection(-MathF.Sqrt(2f) / 2f, s),
                                          new Intersection(MathF.Sqrt(2f) / 2f, s));
            var comps       = new IntersectionInfo(xs[1], r, xs);
            var reflectance = PhongShading.Schlick(comps);

            reflectance.Should().Be(1f);
        }