Пример #1
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1920, 1080, SystemOfCoordinates.SSC_FLOAT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new AreaLighting(this);

            MultiJittered sampler = new MultiJittered(vp.NumSamples);

            AmbientOccluder occluder = new AmbientOccluder();

            occluder.Color         = ColorUtils.WHITE;
            occluder.ScaleRadiance = 1.5;
            occluder.MinAmount     = 0.4f;
            occluder.Sampler       = sampler;
            AmbientLight           = occluder;

            Pinhole pinhole = new Pinhole(new Vec3(-0.731249, -0.199999, -0.3),
                                          new Vec3(-0.562499, -0.185185, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          0.6f, 1.0f);

            Camera = pinhole;

            CreateIllumination();
            CreateWalls();
            CreateObjects();
        }
Пример #2
0
        void build10()
        {
            World world = new World();
            int   ns    = 49;

            world.ViewPlane.HRes = 400;
            world.ViewPlane.VRes = 400;
            world.ViewPlane.SetSampler(new Regular(ns));
            world.ViewPlane.MaxDepth = 10;
            world.Tracer             = new Whitted(world);
            AmbientOccluder occ = new AmbientOccluder();

            occ.RadianceScale = 1.0f;
            occ.MinAmount     = 0f;
            occ.Shadows       = true;
            occ.Color         = Vector3.One();
            occ.SetSampler(new MultiJittered(ns));
            world.AmbientLight = occ;
            Pinhole cam = new Pinhole();

            cam.Position = new Vector3(40, 30, 20);
            cam.Target   = new Vector3(0, 0, 0);
            cam.Distance = 5500;
            cam.Zoom     = 1.5f;
            world.Camera = cam;
            PointLight pl = new PointLight();

            pl.Color         = Vector3.One();
            pl.Position      = new Vector3(4, 4, 0);
            pl.RadianceScale = 1.0f;
            pl.Shadows       = true;
            world.Lights.Add(pl);
        }
Пример #3
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1920, 1080, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 144;

            backgroundColor = ColorUtils.BLACK;
            //tracer = new RayCast(this);
            tracer = new AreaLighting(this);

            AmbientOccluder a = new AmbientOccluder(ColorUtils.WHITE,
                                                    0.4, 1.5);

            a.Sampler    = new MultiJittered(vp.NumSamples);
            AmbientLight = a;

            Pinhole c = new Pinhole(new Vec3(-702, -108, 270),
                                    new Vec3(-540, -100, 0),
                                    new Vec3(0, 1, 0),
                                    800, 1.5f);

            Camera = c;



            CreateIllumination();
            CreateWalls();
            CreateObjects();
        }
Пример #4
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 1;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 0.0, 20),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          3600);

            Camera = pinhole;

            Directional l = new Directional();

            l.SetDirection(-10, 20, 20);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = false;
            AddLight(l);

            int numSpheres = 1000000;

            double volume = 0.1 / numSpheres;
            double radius = Math.Pow(0.75 * volume / Math.PI, 0.333333);

            Grid grid = new Grid();

            Rnd.SetRandSeed(15);

            for (int j = 0; j < numSpheres; j++)
            {
                Matte matte = new Matte();
                matte.SetKa(0.25f);
                matte.SetKd(0.75f);
                matte.SetColor(new Vec3(Rnd.RandDouble(),
                                        Rnd.RandDouble(),
                                        Rnd.RandDouble()));

                Sphere sphere = new Sphere();
                sphere.Radius = radius;
                sphere.SetCenter(1.0f - 2.0f * (float)Rnd.RandDouble(),
                                 1.0f - 2.0f * (float)Rnd.RandDouble(),
                                 1.0f - 2.0f * (float)Rnd.RandDouble());
                sphere.Material = matte;
                grid.AddObject(sphere);
            }

            grid.SetupCells();

            AddObject(grid);
        }
Пример #5
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 25;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0, 0, 65),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          9000 /**24*/);

            Camera = pinhole;

            Directional light = new Directional();

            light.SetDirection(-0.25f, 0.4f, 1.0f);
            light.ScaleRadiance = 2.5f;
            AddLight(light);

            //image
            Image image = new Image();

            image.Load(PATH + "ppm/EarthLowRes.ppm");

            //mapping
            SphericalMap sphericalMap = new SphericalMap();

            //image based texture
            ImageTexture texture = new ImageTexture(image, sphericalMap);

            //textured material
            SV_Matte svMatte = new SV_Matte();

            svMatte.SetKa(0.45f);
            svMatte.SetKd(0.65f);
            svMatte.SetCd(texture);

            Sphere s = new Sphere();

            s.Material = svMatte;

            Instance earth = new Instance(s);

            earth.Material = svMatte;
            earth.RotateY(-72);
            earth.RotateX(40);
            earth.RotateZ(20);
            AddObject(earth);
        }
Пример #6
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 16;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(100, 0, 100),
                                          new Vec3(0, 1, 0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          8000);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(50, 50, 1);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(new Vec3(0.75));
            m.SetKa(0.25f);
            m.SetKd(0.8f);
            m.SetKs(0.15f);
            m.SetExp(50.0f);

            Instance ellipsoid = new Instance(new Sphere());

            ellipsoid.Material = m;
            ellipsoid.Scale(2, 3, 1);
            ellipsoid.RotateX(-45);
            ellipsoid.Translate(0, 1, 0);
            AddObject(ellipsoid);

            //Plane p = new Plane(new Vec3(0, -10, 0), new Vec3(0, 1, 0));
            //Matte pm = new Matte();
            //pm.SetKa(0.25f);
            //pm.SetKd(0.75f);
            //pm.SetColor(new Vec3(0.3));
            //p.Material = pm;

            //AddObject(p);
        }
        public override void Build()
        {
            int numSamples = 4;

            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = numSamples;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            MultiJittered sampler = new MultiJittered(numSamples);

            sampler.Generate();

            AmbientOccluder occluder = new AmbientOccluder();

            occluder.ScaleRadiance = 1.0;
            occluder.Color         = ColorUtils.WHITE;
            occluder.MinAmount     = 0.0;
            occluder.Sampler       = sampler;
            AmbientLight           = occluder;

            Pinhole pinhole = new Pinhole(new Vec3(25.0, 20.0, 45.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          5000.0f);

            pinhole.ComputeUVW();
            Camera = pinhole;

            Matte matte = new Matte();

            matte.SetKa(0.75f);
            matte.SetKd(0.0f);
            matte.SetColor(1.0f, 0.7f, 0.0f);

            Sphere s = new Sphere(new Vec3(0, 1, 0), 1);

            s.Material = matte;
            AddObject(s);

            matte = new Matte();
            matte.SetKa(0.75f);
            matte.SetKd(0.0f);
            matte.SetColor(ColorUtils.WHITE);

            Plane p = new Plane(new Vec3(0, 0, 0), new Vec3(0, 1, 0));

            p.Material = matte;
            AddObject(p);
        }
Пример #8
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          500);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(100, 100, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(0.2f, 0.5f, 0.4f);
            m.SetKa(0.25f);
            m.SetKd(0.75f);
            m.SetKs(0.2f);
            m.SetExp(20.0f);

            Grid sphere = new Grid();

            //sphere.TessellateFlatSphere(200, 100);
            sphere.TessellateSmoothSphere(100, 50);
            sphere.Material = m;
            sphere.SetupCells();

            Instance i = new Instance(sphere);

            i.Scale(60.0f);

            AddObject(i);
        }
Пример #9
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          500);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(100, 100, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(new Vec3(0.35f));
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.4f);
            m.SetExp(64.0f);

            float t = 20;
            float b = -80;
            float r = 50;

            //BeveledCylinder bc = new BeveledCylinder(b, t, r, 6);
            //bc.Material = m;
            Cylinder c = Cylinder.Create(b, t, r, 3);

            c.Material = m;

            AddObject(c);
        }
Пример #10
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          500);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(100, 100, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(ColorUtils.BLUE);
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.4f);
            m.SetExp(64.0f);

            Annulus an = new Annulus(new Vec3(),
                                     new Vec3(0, 1, 0), 55, 80);

            an.Material = m;

            AddObject(an);
        }
Пример #11
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 0.0, 500.0),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          2000.0f);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(0, 100, -20);
            l.ScaleRadiance = 20.0f;
            l.Shadows       = false;
            AddLight(l);

            Triangle t = new Triangle(new Vec3(0, 50, 0),
                                      new Vec3(-50, -50, 0),
                                      new Vec3(50, -50, 0));
            Matte matte = new Matte();

            matte.SetKa(0.2f);
            matte.SetKd(0.5f);
            matte.SetColor(new Vec3(0.8, 0.6, 0.2));

            t.Material = matte;
            t.Shadows  = false;

            AddObject(t);
        }
        public override void Build()
        {
            vp            = ViewPlane.Create(1920, 1080, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 144;
            vp.MaxDepth   = 10;

            backgroundColor = new Vec3(0.15);
            tracer          = new AreaLighting(this);

            AmbientOccluder a = new AmbientOccluder();

            a.ScaleRadiance = 0.5;
            a.MinAmount     = 0.05;
            a.Sampler       = new MultiJittered(vp.NumSamples);
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(75, 40, 100),
                                          new Vec3(-10, 39, 0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          360, 3.0f);

            Camera = pinhole;

            Rectangle rectangle = new Rectangle(new Vec3(75, 40, 100),
                                                new Vec3(0, 50, 0),
                                                new Vec3(50, 0, -50));
            Emissive        e    = new Emissive(ColorUtils.WHITE, 20);
            RectangularLamp lamp = new RectangularLamp(rectangle, e);

            lamp.Sampler = new MultiJittered(vp.NumSamples);
            lamp.Shadows = false;

            AddObject(lamp);

            AreaLight light = new AreaLight();

            light.Object = lamp;

            AddLight(light);

            Reflective reflective1 = new Reflective();

            reflective1.SetKa(0.25f);
            reflective1.SetKd(0.5f);
            reflective1.SetColor(0.75f, 0.75f, 0.0f);
            reflective1.SetSpecularColor(ColorUtils.WHITE);
            reflective1.SetKs(0.15f);
            reflective1.SetExp(100.0f);
            reflective1.SetKr(0.75f);
            reflective1.SetReflectiveColor(ColorUtils.WHITE);

            double radius = 23.0;
            Sphere s1     = new Sphere(new Vec3(38, radius, -25), radius);

            s1.Material = reflective1;
            AddObject(s1);

            Matte matte1 = new Matte();

            matte1.SetKa(0.45f);
            matte1.SetKd(0.75f);
            matte1.SetColor(0.75f, 0.25f, 0.0f);

            Sphere s2 = new Sphere(new Vec3(-7, 10, 42), 20);

            s2.Material = matte1;
            AddObject(s2);

            Reflective reflective2 = new Reflective();

            reflective2.SetKa(0.35f);
            reflective2.SetKd(0.75f);
            reflective2.SetColor(ColorUtils.BLACK);
            reflective2.SetSpecularColor(ColorUtils.WHITE);
            reflective2.SetKs(0.0f);
            reflective2.SetExp(1.0f);
            reflective2.SetKr(0.75f);
            reflective2.SetReflectiveColor(ColorUtils.WHITE);

            Sphere s3 = new Sphere(new Vec3(-30, 59, 35), 20);

            s3.Material = reflective2;
            AddObject(s3);

            //cylinder
            Reflective reflective3 = new Reflective();

            reflective3.SetKa(0.35f);
            reflective3.SetKd(0.5f);
            reflective3.SetColor(0.0f, 0.5f, 0.75f);
            reflective3.SetSpecularColor(ColorUtils.WHITE);
            reflective3.SetKs(0.2f);
            reflective3.SetExp(100.0f);
            reflective3.SetKr(0.75f);
            reflective3.SetReflectiveColor(ColorUtils.WHITE);

            float b  = 0.0f;
            float t  = 85f;
            float cr = 22f;

            SolidCylinder cylinder = new SolidCylinder(b, t, cr);

            cylinder.Material = reflective3;
            AddObject(cylinder);

            //box
            Matte matte2 = new Matte();

            matte2.SetKa(0.15f);
            matte2.SetKd(0.5f);
            matte2.SetColor(0.75f, 1.0f, 0.75f);

            Box box = new Box(new Vec3(-35, 0, -110),
                              new Vec3(-25, 60, 65));

            box.Material = matte2;
            AddObject(box);

            //plane
            Matte matte3 = new Matte();

            matte3.SetKa(0.30f);
            matte3.SetKd(0.9f);
            matte3.SetColor(ColorUtils.WHITE);

            Plane plane = new Plane(new Vec3(),
                                    new Vec3(0, 1, 0));

            plane.Material = matte3;

            AddObject(plane);
        }
Пример #13
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1920, 1080, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            //Ambient a = new Ambient();
            //a.ScaleRadiance = 1.0f;
            //AmbientLight = a;

            AmbientOccluder a = new AmbientOccluder();

            a.ScaleRadiance = 1.5;
            a.Color         = ColorUtils.WHITE;
            a.MinAmount     = 0.4;
            a.Sampler       = new MultiJittered(vp.NumSamples);
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(-150.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          800);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(0, 300, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(ColorUtils.BLUE);
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.4f);
            m.SetExp(64.0f);

            Phong m1 = new Phong();

            m1.SetColor(ColorUtils.YELLOW);
            m1.SetKa(0.2f);
            m1.SetKd(0.65f);
            m1.SetKs(0.4f);
            m1.SetExp(64.0f);

            SolidCone sc = new SolidCone(70, 60);

            sc.SetBodyMaterial(m);
            sc.SetBaseMaterial(m1);

            AddObject(sc);

            Sphere s = new Sphere(new Vec3(150, 0, 0), 50);

            s.Material = m;

            Box b = new Box(-200, -70, -50, 50, -100, 0);

            b.Material = m1;

            AddObject(s);
            AddObject(b);
        }
        public override void Build()
        {
            vp = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            //vp.NumSamples = 4096;
            vp.NumSamples = 400;
            vp.MaxDepth   = 10;

            backgroundColor = ColorUtils.BLACK;

            tracer = new GlobalTrace(this);
            //tracer = new PathTrace(this);

            Ambient ambient = new Ambient();

            ambient.ScaleRadiance = 0;
            AmbientLight          = ambient;

            Pinhole camera = new Pinhole();

            camera.SetEye(27.6, 27.4, -80);
            camera.SetLookat(27.6, 27.4, 0.0);
            camera.ViewPlaneDistance = 1200;
            Camera = camera;

            Vec3 p0;
            Vec3 a, b;
            Vec3 normal;

            // box dimensions

            double width  = 55.28;     // x direction
            double height = 54.88;     // y direction
            double depth  = 55.92;     // z direction


            Emissive emissive = new Emissive(new Vec3(1.0, 0.73, 0.4), 100);

            p0     = new Vec3(21.3, height - 0.001, 22.7);
            a      = new Vec3(0.0, 0.0, 10.5);
            b      = new Vec3(13.0, 0.0, 0.0);
            normal = new Vec3(0.0, -1.0, 0.0);

            RectangularLamp lamp = new RectangularLamp(new Rectangle(p0, a, b, normal), emissive);

            lamp.Sampler = new MultiJittered(vp.NumSamples);
            AddObject(lamp);

            AreaLight ceilingLight = new AreaLight();

            ceilingLight.Object = lamp;
            AddLight(ceilingLight);


            // left wall

            Matte matte1 = new Matte();

            matte1.SetKa(0.0f);
            matte1.SetKd(0.6f);
            matte1.SetColor(0.57f, 0.025f, 0.025f);     // red
            matte1.SetSampler(new MultiJittered(vp.NumSamples));

            p0     = new Vec3(width, 0.0, 0.0);
            a      = new Vec3(0.0, 0.0, depth);
            b      = new Vec3(0.0, height, 0.0);
            normal = new Vec3(-1.0, 0.0, 0.0);
            Rectangle leftWall = new Rectangle(p0, a, b, normal);

            leftWall.Material = matte1;
            AddObject(leftWall);


            // right wall

            Matte matte2 = new Matte();

            matte2.SetKa(0.0f);
            matte2.SetKd(0.6f);
            matte2.SetColor(0.37f, 0.59f, 0.2f);    // green
            matte2.SetSampler(new MultiJittered(vp.NumSamples));

            p0     = new Vec3(0.0, 0.0, 0.0);
            a      = new Vec3(0.0, 0.0, depth);
            b      = new Vec3(0.0, height, 0.0);
            normal = new Vec3(1.0, 0.0, 0.0);
            Rectangle rightWall = new Rectangle(p0, a, b, normal);

            rightWall.Material = matte2;
            AddObject(rightWall);


            // back wall

            Matte matte3 = new Matte();

            matte3.SetKa(0.0f);
            matte3.SetKd(0.6f);
            matte3.SetColor(ColorUtils.WHITE);
            matte3.SetSampler(new MultiJittered(vp.NumSamples));

            p0     = new Vec3(0.0, 0.0, depth);
            a      = new Vec3(width, 0.0, 0.0);
            b      = new Vec3(0.0, height, 0.0);
            normal = new Vec3(0.0, 0.0, -1.0);
            Rectangle backWall = new Rectangle(p0, a, b, normal);

            backWall.Material = matte3;
            AddObject(backWall);


            // floor

            p0     = new Vec3(0.0, 0.0, 0.0);
            a      = new Vec3(0.0, 0.0, depth);
            b      = new Vec3(width, 0.0, 0.0);
            normal = new Vec3(0.0, 1.0, 0.0);
            Rectangle floor = new Rectangle(p0, a, b, normal);

            floor.Material = matte3;
            AddObject(floor);


            // ceiling

            p0     = new Vec3(0.0, height, 0.0);
            a      = new Vec3(0.0, 0.0, depth);
            b      = new Vec3(width, 0.0, 0.0);
            normal = new Vec3(0.0, -1.0, 0.0);
            Rectangle ceiling = new Rectangle(p0, a, b, normal);

            ceiling.Material = matte3;
            AddObject(ceiling);


            // the two boxes defined as 5 rectangles each

            // short box

            // top

            p0     = new Vec3(13.0, 16.5, 6.5);
            a      = new Vec3(-4.8, 0.0, 16.0);
            b      = new Vec3(16.0, 0.0, 4.9);
            normal = new Vec3(0.0, 1.0, 0.0);
            Rectangle shortTop = new Rectangle(p0, a, b, normal);

            shortTop.Material = matte3;
            AddObject(shortTop);


            // side 1

            p0 = new Vec3(13.0, 0.0, 6.5);
            a  = new Vec3(-4.8, 0.0, 16.0);
            b  = new Vec3(0.0, 16.5, 0.0);
            Rectangle shortSide1 = new Rectangle(p0, a, b);

            shortSide1.Material = matte3;
            AddObject(shortSide1);


            // side 2

            p0 = new Vec3(8.2, 0.0, 22.5);
            a  = new Vec3(15.8, 0.0, 4.7);
            Rectangle shortSide2 = new Rectangle(p0, a, b);

            shortSide2.Material = matte3;
            AddObject(shortSide2);


            // side 3

            p0 = new Vec3(24.2, 0.0, 27.4);
            a  = new Vec3(4.8, 0.0, -16.0);
            Rectangle shortSide3 = new Rectangle(p0, a, b);

            shortSide3.Material = matte3;
            AddObject(shortSide3);


            // side 4

            p0 = new Vec3(29.0, 0.0, 11.4);
            a  = new Vec3(-16.0, 0.0, -4.9);
            Rectangle shortSide4 = new Rectangle(p0, a, b);

            shortSide4.Material = matte3;
            AddObject(shortSide4);



            // tall box

            // top

            p0     = new Vec3(42.3, 33.0, 24.7);
            a      = new Vec3(-15.8, 0.0, 4.9);
            b      = new Vec3(4.9, 0.0, 15.9);
            normal = new Vec3(0.0, 1.0, 0.0);
            Rectangle tallTop = new Rectangle(p0, a, b, normal);

            tallTop.Material = matte3;
            AddObject(tallTop);


            // side 1

            p0 = new Vec3(42.3, 0.0, 24.7);
            a  = new Vec3(-15.8, 0.0, 4.9);
            b  = new Vec3(0.0, 33.0, 0.0);
            Rectangle tallSide1 = new Rectangle(p0, a, b);

            tallSide1.Material = matte3;
            AddObject(tallSide1);


            // side 2

            p0 = new Vec3(26.5, 0.0, 29.6);
            a  = new Vec3(4.9, 0.0, 15.9);
            Rectangle tallSide2 = new Rectangle(p0, a, b);

            tallSide2.Material = matte3;
            AddObject(tallSide2);


            // side 3

            p0 = new Vec3(31.4, 0.0, 45.5);
            a  = new Vec3(15.8, 0.0, -4.9);
            Rectangle tallSide3 = new Rectangle(p0, a, b);

            tallSide3.Material = matte3;
            AddObject(tallSide3);


            // side 4

            p0 = new Vec3(47.2, 0.0, 40.6);
            a  = new Vec3(-4.9, 0.0, -15.9);
            Rectangle tallSide4 = new Rectangle(p0, a, b);

            tallSide4.Material = matte3;
            AddObject(tallSide4);
        }
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 100;
            vp.MaxDepth   = 10;

            backgroundColor = new Vec3(0.0, 0.3, 0.25);
            tracer          = new Whitted(this);

            //AmbientOccluder a = new AmbientOccluder(ColorUtils.WHITE,
            //                                        0.25, 1.0);
            //a.Sampler = new MultiJittered(vp.NumSamples);
            Ambient a = new Ambient();

            a.ScaleRadiance = 0.25f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(1, 7.5, 20),
                                          new Vec3(0.0, -0.35, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          5250);

            Camera = pinhole;

            Emissive e = new Emissive();

            e.ScaleRadiance = 3.0f;
            e.Ce            = ColorUtils.WHITE;

            RectangularLamp lamp = new RectangularLamp(
                new Rectangle(new Vec3(0, 20, 0),
                              new Vec3(1, 0, 0),
                              new Vec3(0, 0, 1),
                              new Vec3(0, -1, 0)),
                e);

            lamp.Sampler = new MultiJittered(vp.NumSamples);
            AddObject(lamp);

            AreaLight areaLight = new AreaLight();

            areaLight.Object  = lamp;
            areaLight.Shadows = true;
            AddLight(areaLight);

            //PointLight l = new PointLight();
            //l.SetLocation(20, 20, 15);
            //l.ScaleRadiance = 3.0f;
            //AddLight(l);

            Transparent glass = new Transparent();

            glass.SetKs(0.5f);
            glass.SetExp(2000);
            glass.SetIor(1.5f);
            glass.SetKr(0.1f);
            glass.SetKt(1.53f);
            //glass.SetCd(0.4f);

            float ir = 0.9f;
            float or = 1;

            //Bowl b = Bowl.CreateFlatRimmedBowl(ir, or);
            Bowl b = Bowl.CreateRoundRimmedBowl(ir, or);

            b.Material = glass;
            AddObject(b);

            Reflective reflective = new Reflective();

            reflective.SetKa(0.6f);
            reflective.SetKd(0.4f);
            reflective.SetCd(ColorUtils.RED);
            reflective.SetKs(0.5f);
            reflective.SetExp(2000);
            reflective.SetKr(0.25f);

            double r = 0.4;
            double t = 55;

            t = MathUtils.PI * t / 180;
            double x = -(0.9 - r) * Math.Cos(t);
            double y = -(0.9 - r) * Math.Sin(t);

            Sphere s = new Sphere(new Vec3(x, y, 0), r, reflective);

            AddObject(s);

            Reflective reflective2 = new Reflective();

            reflective2.SetKa(0.6f);
            reflective2.SetKd(0.4f);
            reflective2.SetCd(ColorUtils.YELLOW);
            reflective2.SetKs(0.5f);
            reflective2.SetExp(2000);
            reflective2.SetKr(0.5f);

            r = 0.35;
            t = 35;
            t = MathUtils.PI * t / 180;
            x = (0.9 - r) * Math.Cos(t);
            y = -(0.9 - r) * Math.Sin(t);

            Sphere s2 = new Sphere(new Vec3(x, y, 0), r, reflective2);

            AddObject(s2);

            Matte rm = new Matte();

            rm.SetColor(ColorUtils.WHITE);
            rm.SetKa(0.8f);
            rm.SetKd(0.85f);

            Rectangle rectangle = new Rectangle(new Vec3(-2, -1, -5),
                                                new Vec3(0, 0, 9),
                                                new Vec3(4, 0, 0));

            rectangle.Material = rm;
            AddObject(rectangle);
        }
Пример #16
0
 public static void Reset()
 {
     pinhole = new Pinhole(Camera.ScreenBounds.Width / 2, Camera.ScreenBounds.Height / 2, Pinhole.Type.Open);
 }
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new AreaLighting(this);

            MultiJittered sampler = new MultiJittered(vp.NumSamples);

            sampler.Generate();

            AmbientOccluder occluder = new AmbientOccluder(ColorUtils.WHITE, 0.0);

            occluder.Sampler = sampler;
            //occluder.ScaleRadiance = 1.0;
            //occluder.Color = ColorUtils.WHITE;
            //occluder.SetMinAmount(0.0f);
            AmbientLight = occluder;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 0.0, 500.0),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          2000.0f);

            Camera = pinhole;

            Emissive emissive = new Emissive(ColorUtils.WHITE, 20.0f);

            //emissive.ScaleRadiance = 1.0f;
            //emissive.Ce = new Vec3(1.0, 1.0, 1.0);

            sampler = new MultiJittered(256);
            sampler.Generate();

            ConcaveSphere sphere = new ConcaveSphere(new Vec3(), 10000.0);

            //sphere.Radius = 10000.0;
            sphere.Sampler          = sampler;
            sphere.Material         = emissive;
            sphere.EmissiveMaterial = emissive;
            sphere.Shadows          = false;
            AddObject(sphere);

            sampler = new MultiJittered(256);
            sampler.Generate();

            EnvironmentLight l = new EnvironmentLight();

            l.Material = emissive;
            l.Sampler  = sampler;
            l.Sampler.MapSamplesToHemisphere(10);
            l.Shadows = true;
            AddLight(l);

            //Rectangle rectangle = new Rectangle(new Vec3(0.0, 100.0, 0.0),
            //                                    new Vec3(216.0, 0.0, 0.0),
            //                                    new Vec3(0.0, 0.0, 216.0));
            //emissive = new Emissive();
            //emissive.ScaleRadiance = 1.0f;
            //emissive.Ce = ColorUtils.WHITE;

            //rectangle.Material = emissive;
            //rectangle.Sampler = sampler;
            //rectangle.Shadows = false;
            //AddObject(rectangle);

            AreaLight areaLight = new AreaLight();

            areaLight.Object  = sphere;
            areaLight.Shadows = true;
            AddLight(areaLight);

            Vec3 lightGreen = new Vec3(0.65f, 1.0f, 0.30f);
            Vec3 green      = new Vec3(0.0f, 0.6f, 0.3f);
            Vec3 darkGreen  = new Vec3(0.0f, 0.41f, 0.41f);

            Vec3 yellow     = new Vec3(1.0f, 1.0f, 0.0f);
            Vec3 darkYellow = new Vec3(0.61f, 0.61f, 0.0f);

            Vec3 lightPurple = new Vec3(0.65f, 0.3f, 1.0f);
            Vec3 darkPurple  = new Vec3(0.5f, 0.0f, 1.0f);

            Vec3 brown  = new Vec3(0.71f, 0.40f, 0.16f);
            Vec3 orange = new Vec3(1.0f, 0.75f, 0.0f);

            Matte matte = new Matte();

            matte.SetKa(0.2f);
            matte.SetKd(0.5f);
            matte.SetColor(ColorUtils.WHITE);

            Plane p = new Plane(new Vec3(0, -85, 0), new Vec3(0, 1, 0));

            p.Material = matte;
            AddObject(p);

            Phong m = new Phong();

            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.1f);
            m.SetExp(8.0f);
            m.SetColor(ColorUtils.WHITE);

            Sphere s = new Sphere(new Vec3(5, 3, 0), 30);

            s.Material = m;

            AddObject((Sphere)s.Clone());

            s.SetCenter(45, -7, -60);
            s.Radius = 20;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(40, 43, -100);
            s.Radius = 17;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-20, 28, -15);
            s.Radius = 20;
            m.SetColor(orange);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-25, -7, -35);
            s.Radius = 27;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(20, -27, -35);
            s.Radius = 25;
            m.SetColor(lightGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(35, 18, -35);
            s.Radius = 22;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-57, -17, -50);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-47, 16, -80);
            s.Radius = 23;
            m.SetColor(lightGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-15, -32, -60);
            s.Radius = 22;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-35, -37, -80);
            s.Radius = 22;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(10, 43, -80);
            s.Radius = 22;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(30, -7, -80);
            s.Radius = 10;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-40, 48, -110);
            s.Radius = 18;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-10, 53, -120);
            s.Radius = 18;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-55, -52, -100);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(5, -52, -100);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-20, -57, -120);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(55, -27, -100);
            s.Radius = 17;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(50, -47, -120);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(70, -42, -150);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(5, 73, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(66, 21, -130);
            s.Radius = 13;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(72, -12, -140);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(64, 5, -160);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(55, 38, -160);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-73, -2, -160);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(30, -62, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(25, 63, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-60, 46, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-30, 68, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(58, 56, -180);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-63, -39, -180);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(46, 68, -200);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-3, -72, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject(s);
        }
Пример #18
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 64;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            AmbientOccluder a = new AmbientOccluder(ColorUtils.WHITE,
                                                    0.25, 1.0);

            a.Sampler    = new MultiJittered(vp.NumSamples);
            AmbientLight = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          500);

            Camera = pinhole;

            Emissive e = new Emissive();

            e.ScaleRadiance = 8.0f;
            e.Ce            = ColorUtils.WHITE;

            Rectangle rectangle = new Rectangle(new Vec3(0.0, 200.0, 100.0),
                                                new Vec3(216.0, 0.0, 0.0),
                                                new Vec3(0.0, 0.0, 216.0));

            rectangle.Shadows = false;

            RectangularLamp lamp = new RectangularLamp(rectangle, e);

            lamp.Sampler = new MultiJittered(vp.NumSamples);
            AddObject(lamp);

            AreaLight areaLight = new AreaLight();

            areaLight.Object  = lamp;
            areaLight.Shadows = true;
            AddLight(areaLight);

            //PointLight l = new PointLight();
            //l.Color = ColorUtils.WHITE;
            //l.SetLocation(100, 100, 200);
            //l.ScaleRadiance = 3.0f;
            //l.Shadows = true;
            //AddLight(l);

            Phong m = new Phong();

            m.SetColor(new Vec3(0.6, 0.2, 0.02));
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.4f);
            m.SetExp(64.0f);

            Phong i = new Phong();

            i.SetColor(new Vec3(0.8, 0.4, 0.02));
            i.SetKa(0.2f);
            i.SetKd(0.65f);
            i.SetKs(0.4f);
            i.SetExp(64.0f);

            //Bowl b = Bowl.CreateFlatRimmedBowl(75, 80);
            //Bowl b = Bowl.CreateRoundRimmedBowl(75, 80);
            Bowl b = Bowl.Create(75, 80, true);

            b.SetExternalMaterial(m);
            b.SetInternalMaterial(i);
            b.SetBorderMaterial(i);

            AddObject(b);

            Plane p  = new Plane(new Vec3(0, -80, 0), new Vec3(0, 1, 0));
            Matte pm = new Matte();

            pm.SetColor(new Vec3(0.2, 0.2, 0.2));
            pm.SetKa(0.2f);
            pm.SetKd(0.6f);
            p.Material = pm;

            AddObject(p);
        }
Пример #19
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1920, 1080, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 64;
            vp.MaxDepth   = 10;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new Whitted(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(7.5, 3, 9.5),
                                          new Vec3(5.0, 2.5, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          800);

            Camera = pinhole;

            PointLight l1 = new PointLight();

            l1.Color = ColorUtils.WHITE;
            l1.SetLocation(10, 10, 0);
            l1.ScaleRadiance = 2.0f;
            AddLight(l1);

            PointLight l2 = new PointLight();

            l2.Color = ColorUtils.WHITE;
            l2.SetLocation(0, 10, 10);
            l2.ScaleRadiance = 2.0f;
            AddLight(l2);

            PointLight l3 = new PointLight();

            l3.Color = ColorUtils.WHITE;
            l3.SetLocation(-10, 10, 0);
            l3.ScaleRadiance = 2.0f;
            AddLight(l3);

            PointLight l4 = new PointLight();

            l4.Color = ColorUtils.WHITE;
            l4.SetLocation(0, 10, -10);
            l4.ScaleRadiance = 2.0f;
            AddLight(l4);

            //sphere
            Reflective r1 = new Reflective();

            r1.SetKa(0.1f);
            r1.SetKd(0.4f);
            r1.SetCd(0, 0, 1);
            r1.SetKs(0.25f);
            r1.SetExp(100.0f);
            r1.SetKr(0.85f);
            r1.SetReflectiveColor(0.75f, 0.75f, 1.0f);
            //r1.SetSpecularColor(ColorUtils.WHITE);

            Sphere s1 = new Sphere(new Vec3(0, 0.5, 0), 4);

            s1.Material = r1;
            AddObject(s1);

            //wall
            double roomSize = 11.0;

            //floor
            Matte m1 = new Matte(new Vec3(0.25), 0.1f, 0.50f);

            Plane floor = new Plane(new Vec3(0, -roomSize, 0), new Vec3(0, 1, 0));

            floor.Material = m1;
            AddObject(floor);

            //ceiling
            Matte m2 = new Matte(ColorUtils.WHITE, 0.35f, 0.50f);

            Plane ceiling = new Plane(new Vec3(0, roomSize, 0), new Vec3(0, -1, 0));

            ceiling.Material = m2;
            AddObject(ceiling);

            //back
            Matte m3 = new Matte(new Vec3(0.5, 0.75, 0.75), 0.15f, 0.60f);

            Plane back = new Plane(new Vec3(0, 0, -roomSize), new Vec3(0, 0, 1));

            back.Material = m3;
            AddObject(back);

            //front
            Plane front = new Plane(new Vec3(0, 0, roomSize), new Vec3(0, 0, -1));

            front.Material = m3;
            AddObject(front);

            //left
            Matte m4 = new Matte(new Vec3(0.71, 0.40, 0.20), 0.15f, 0.60f);

            Plane left = new Plane(new Vec3(-roomSize, 0, 0), new Vec3(1, 0, 0));

            left.Material = m4;
            AddObject(left);

            //front
            Plane right = new Plane(new Vec3(roomSize, 0, 0), new Vec3(-1, 0, 0));

            right.Material = m4;
            AddObject(right);

            //mirrors
            double mirrorSize = 8;
            double offset     = 1.0;

            Reflective r2 = new Reflective();

            r2.SetKa(0.0f);
            r2.SetKd(0.0f);
            r2.SetCd(0, 0, 0);
            r2.SetKs(0.0f);
            r2.SetExp(2.0f);
            r2.SetKr(0.9f);
            r2.SetReflectiveColor(0.9f, 1.0f, 0.9f);
            //r2.SetSpecularColor(ColorUtils.WHITE);

            float           e = 25000;
            GlossyReflector g = new GlossyReflector();

            g.SetSamples(vp.NumSamples, e);
            g.SetKa(0.0f);
            g.SetKd(0.0f);
            g.SetKs(0.0f);
            g.SetExp(e);
            g.SetCd(0, 0, 0);
            g.SetKr(0.9f);
            g.SetExponent(e);
            g.SetReflectiveColor(0.9f, 1.0f, 0.9f);
            //r.SetSpecularColor(ColorUtils.WHITE);
            //back
            Rectangle rect1 = new Rectangle(new Vec3(-mirrorSize, -mirrorSize, -(roomSize - offset)),
                                            new Vec3(2.0 * mirrorSize, 0, 0),
                                            new Vec3(0, 2.0 * mirrorSize, 0),
                                            new Vec3(0, 0, 1),
                                            g);

            AddObject(rect1);

            //front
            Rectangle rect2 = new Rectangle(new Vec3(-mirrorSize, -mirrorSize, +(roomSize - offset)),
                                            new Vec3(2.0 * mirrorSize, 0, 0),
                                            new Vec3(0, 2.0 * mirrorSize, 0),
                                            new Vec3(0, 0, -1),
                                            g);

            AddObject(rect2);

            //left
            Rectangle rect3 = new Rectangle(new Vec3(-(roomSize - offset), -mirrorSize, mirrorSize),
                                            new Vec3(0, 0, -2.0 * mirrorSize),
                                            new Vec3(0, 2.0 * mirrorSize, 0),
                                            new Vec3(1, 0, 0),
                                            r2);

            AddObject(rect3);

            //
            Reflective r3 = new Reflective();

            r3.SetKa(0.0f);
            r3.SetKd(0.0f);
            r3.SetCd(0, 0, 0);
            r3.SetKs(0.0f);
            r3.SetExp(2.0f);
            r3.SetKr(1.0f);
            r3.SetReflectiveColor(1.0f, 1.0f, 0.5f);
            //r3.SetSpecularColor(ColorUtils.WHITE);

            Rectangle rect4 = new Rectangle(new Vec3(-mirrorSize, -4.0, -mirrorSize),
                                            new Vec3(0, 0, 2.0 * mirrorSize),
                                            new Vec3(2.0 * mirrorSize, 0, 0),
                                            new Vec3(0, 1, 0),
                                            r3);

            AddObject(rect4);
        }
Пример #20
0
        public override void Build()
        {
            vp                = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples     = 64;
            vp.ShowOutOfGamut = 2;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new AreaLighting(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 0.0, 500.0),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          2000.0f);

            Camera = pinhole;

            Emissive emissive = new Emissive();

            emissive.ScaleRadiance = 40.0f;
            emissive.Ce            = ColorUtils.WHITE;

            MultiJittered sampler = new MultiJittered(256);

            sampler.Generate();

            Rectangle rectangle = new Rectangle(new Vec3(100.0, 100.0, 200.0),
                                                new Vec3(216.0, 0.0, 0.0),
                                                new Vec3(0.0, 0.0, 216.0));

            rectangle.Shadows = false;

            RectangularLamp lamp = new RectangularLamp(rectangle, emissive);

            lamp.Sampler = sampler;
            AddObject(lamp);

            AreaLight areaLight = new AreaLight();

            areaLight.Object  = lamp;
            areaLight.Shadows = true;
            AddLight(areaLight);

            Vec3 lightGreen = new Vec3(0.65f, 1.0f, 0.30f);
            Vec3 green      = new Vec3(0.0f, 0.6f, 0.3f);
            Vec3 darkGreen  = new Vec3(0.0f, 0.41f, 0.41f);

            Vec3 yellow     = new Vec3(1.0f, 1.0f, 0.0f);
            Vec3 darkYellow = new Vec3(0.61f, 0.61f, 0.0f);

            Vec3 lightPurple = new Vec3(0.65f, 0.3f, 1.0f);
            Vec3 darkPurple  = new Vec3(0.5f, 0.0f, 1.0f);

            Vec3 brown  = new Vec3(0.71f, 0.40f, 0.16f);
            Vec3 orange = new Vec3(1.0f, 0.75f, 0.0f);

            Matte matte = new Matte();

            matte.SetKa(0.2f);
            matte.SetKd(0.5f);
            matte.SetColor(ColorUtils.WHITE);

            Plane p = new Plane(new Vec3(0, -85, 0), new Vec3(0, 1, 0));

            p.Material = matte;
            AddObject(p);

            Matte m = new Matte();

            //Plastic *m = new Plastic();
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            //m.SetKs(0.1f);
            //m.SetExp(8.0f);
            m.SetColor(ColorUtils.WHITE);

            Sphere s = new Sphere(new Vec3(5, 3, 0), 30);

            s.Material = m;

            AddObject((Sphere)s.Clone());

            s.SetCenter(45, -7, -60);
            s.Radius = 20;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(40, 43, -100);
            s.Radius = 17;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-20, 28, -15);
            s.Radius = 20;
            m.SetColor(orange);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-25, -7, -35);
            s.Radius = 27;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(20, -27, -35);
            s.Radius = 25;
            m.SetColor(lightGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(35, 18, -35);
            s.Radius = 22;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-57, -17, -50);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-47, 16, -80);
            s.Radius = 23;
            m.SetColor(lightGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-15, -32, -60);
            s.Radius = 22;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-35, -37, -80);
            s.Radius = 22;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(10, 43, -80);
            s.Radius = 22;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(30, -7, -80);
            s.Radius = 10;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-40, 48, -110);
            s.Radius = 18;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-10, 53, -120);
            s.Radius = 18;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-55, -52, -100);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(5, -52, -100);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-20, -57, -120);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(55, -27, -100);
            s.Radius = 17;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(50, -47, -120);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(70, -42, -150);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(5, 73, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(66, 21, -130);
            s.Radius = 13;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(72, -12, -140);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(64, 5, -160);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(55, 38, -160);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-73, -2, -160);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(30, -62, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(25, 63, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-60, 46, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-30, 68, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(58, 56, -180);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-63, -39, -180);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(46, 68, -200);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-3, -72, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject(s);
        }
Пример #21
0
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 4;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 80.0, 210),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          500);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(0, 100, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Phong m = new Phong();

            m.SetColor(ColorUtils.BLUE);
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.4f);
            m.SetExp(64.0f);

            Phong m1 = new Phong();

            m1.SetColor(ColorUtils.YELLOW);
            m1.SetKa(0.2f);
            m1.SetKd(0.65f);
            m1.SetKs(0.4f);
            m1.SetExp(64.0f);

            Phong m2 = new Phong();

            m2.SetColor(ColorUtils.GREEN);
            m2.SetKa(0.2f);
            m2.SetKd(0.65f);
            m2.SetKs(0.4f);
            m2.SetExp(64.0f);

            float t = 20;
            float b = -80;
            float r = 50;

            ConvexPartSphere cps = new ConvexPartSphere(new Vec3(), 50);

            cps.Material = m;

            SolidCylinder sc = new SolidCylinder(b, t, r);

            sc.SetTopMaterial(m);
            sc.SetWallMaterial(m1);
            sc.SetBottomMaterial(m2);
            sc.BoundingBox = new BBox(-r, r, b, t, -r, r);

            //Disk top = new Disk(new Vec3(0, t, 0), new Vec3(0, 1, 0), r);
            //Disk bottom = new Disk(new Vec3(0, b, 0), new Vec3(0, -1, 0), r);
            //OpenCylinder wall = new OpenCylinder(b, t, r);
            //wall.BoundingBox = new BBox(-r, r, b, t, -r, r);

            //top.Material = m;
            //bottom.Material = m1;
            //wall.Material = m1;
            AddObject(sc);
            //AddObject(top);
            //AddObject(wall);
        }
        public override void Build()
        {
            vp            = ViewPlane.Create(1920, 1080, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 100;
            vp.MaxDepth   = 5;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new PathTrace(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 0.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(100, 45, 100),
                                          new Vec3(-10, 40, 0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          800, 1.5f);

            Camera = pinhole;

            Emissive emissive = new Emissive(ColorUtils.WHITE, 1.5f);

            ConcaveSphere sphere = new ConcaveSphere();

            sphere.Radius   = 1000000;
            sphere.Shadows  = false;
            sphere.Material = emissive;
            AddObject(sphere);

            float ka = 0.2f;

            Matte m1 = new Matte();

            m1.SetKa(ka);
            m1.SetKd(0.60f);
            m1.SetColor(ColorUtils.WHITE);
            m1.SetSampler(new MultiJittered(vp.NumSamples));

            Sphere largeSphere = new Sphere(new Vec3(38, 20, -24), 20);

            largeSphere.Material = m1;
            AddObject(largeSphere);

            Matte m2 = new Matte();

            m2.SetKa(ka);
            m2.SetKd(0.5f);
            m2.SetColor(0.85f);
            m2.SetSampler(new MultiJittered(vp.NumSamples));

            Sphere smallSphere = new Sphere(new Vec3(34, 12, 13), 12);

            smallSphere.Material = m2;
            AddObject(smallSphere);

            Matte m3 = new Matte();

            m3.SetKa(ka);
            m3.SetKd(0.75f);
            m3.SetColor(0.73f, 0.22f, 0.0f);
            m3.SetSampler(new MultiJittered(vp.NumSamples));

            Sphere mediumSphere = new Sphere(new Vec3(-7, 15, 42), 16);

            mediumSphere.Material = m3;
            AddObject(mediumSphere);

            Matte m4 = new Matte();

            m4.SetKa(ka);
            m4.SetKd(0.75f);
            m4.SetColor(0.60f);
            m4.SetSampler(new MultiJittered(vp.NumSamples));

            float b = 0;
            float t = 85;
            float r = 22;

            SolidCylinder cylinder = new SolidCylinder(b, t, r, m4);

            AddObject(cylinder);

            Matte m5 = new Matte();

            m5.SetKa(ka);
            m5.SetKd(0.75f);
            m5.SetColor(0.95f);
            m5.SetSampler(new MultiJittered(vp.NumSamples));

            Box box = new Box(new Vec3(-55, 0, -110),
                              new Vec3(-25, 60, 65),
                              m5);

            AddObject(box);

            Matte m6 = new Matte();

            m6.SetKa(0.15f);
            m6.SetKd(0.95f);
            m6.SetColor(0.37f, 0.43f, 0.08f);
            m6.SetSampler(new MultiJittered(vp.NumSamples));

            Plane plane = new Plane(new Vec3(0, 0.01, 0),
                                    new Vec3(0, 1, 0),
                                    m6);

            AddObject(plane);
        }
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 1;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(),
                                          new Vec3(-100, 0, 0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          400);

            Camera = pinhole;

            Directional l1 = new Directional();

            l1.SetDirection(1, 0, 0);
            l1.ScaleRadiance = 1.0f;
            l1.Shadows       = true;

            Directional l2 = new Directional();

            l2.SetDirection(0, 1, 0);
            l2.ScaleRadiance = 2.0f;
            l2.Shadows       = true;

            Directional l3 = new Directional();

            l3.SetDirection(0, 0, 1);
            l3.ScaleRadiance = 1.5f;
            l3.Shadows       = true;

            Directional l4 = new Directional();

            l4.SetDirection(-1, 0, 0);
            l4.ScaleRadiance = 1.0f;
            l4.Shadows       = true;

            Directional l5 = new Directional();

            l5.SetDirection(0, -1, 0);
            l5.ScaleRadiance = 1.5f;
            l5.Shadows       = true;

            Directional l6 = new Directional();

            l6.SetDirection(0, 0, -1);
            l6.ScaleRadiance = 1.5f;
            l6.Shadows       = true;

            AddLight(l1);
            AddLight(l2);
            AddLight(l3);
            AddLight(l4);
            AddLight(l5);
            AddLight(l6);

            int numSpheres = 25;

            double volume = 0.1 / numSpheres;
            float  radius = (float)(2.5 * Math.Pow(0.75 * volume / Math.PI, 0.333333));

            Grid grid = new Grid();

            Rnd.SetRandSeed(14);

            for (int j = 0; j < numSpheres; j++)
            {
                Matte matte = new Matte();
                matte.SetKa(0.25f);
                matte.SetKd(0.85f);
                matte.SetColor(new Vec3(Rnd.RandDouble(),
                                        Rnd.RandDouble(),
                                        Rnd.RandDouble()));

                Sphere sphere = new Sphere();
                sphere.Material = matte;

                Instance instance = new Instance(sphere);
                instance.Scale(radius, radius, radius);
                instance.Translate(new Vec3(1.0 - 2.0 * Rnd.RandDouble(),
                                            1.0 - 2.0 * Rnd.RandDouble(),
                                            1.0 - 2.0 * Rnd.RandDouble()));
                instance.ComputeBoundingBox();

                grid.AddObject(instance);
            }

            grid.SetupCells();

            AddObject(grid);
        }
        public override void Build()
        {
            vp            = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples = 16;
            vp.MaxDepth   = 5;

            backgroundColor = new Vec3(0.5);
            tracer          = new Whitted(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 0.5f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(5, 6, 10),
                                          new Vec3(0.0, 1.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          2000);

            Camera = pinhole;

            PointLight light1 = new PointLight();

            light1.SetLocation(40, 50, 30);
            light1.ScaleRadiance = 3.0f;
            AddLight(light1);

            Vec3 glassColor  = new Vec3(0.65, 1.0, 0.75);
            Vec3 liquidColor = new Vec3(1.0, 0.25, 1.0);

            Dielectric glass = new Dielectric();

            glass.SetEtaIn(1.50f);
            glass.SetEtaOut(1.0f);
            glass.SetCfIn(glassColor);
            glass.SetCfOut(1, 1, 1);

            Dielectric liquid = new Dielectric();

            liquid.SetEtaIn(1.33f);
            liquid.SetEtaOut(1.0f);
            liquid.SetCfIn(liquidColor);
            liquid.SetCfOut(1, 1, 1);

            Dielectric dielectric = new Dielectric();

            dielectric.SetEtaIn(1.33f);
            dielectric.SetEtaOut(1.50f);
            dielectric.SetCfIn(liquidColor);
            dielectric.SetCfOut(glassColor);

            //double height = 2.0;
            //double innerRadius = 0.9;
            //double wallThickness = 0.1;
            //double baseThickness = 0.3;
            //double waterHeight = 1.5;
            //double meniscusRadius = 0.1;

            double glassHeight  = 2.0;
            double liquidHeight = 1.5;
            double innerRadius  = 0.991;
            double outerRadius  = 1.0;

            GlassWithLiquid glassWithLiquid = new GlassWithLiquid(glassHeight,
                                                                  liquidHeight,
                                                                  innerRadius,
                                                                  outerRadius);

            //GlassWithLiquid glassWithLiquid = new GlassWithLiquid(
            //                                                      height,
            //                                                      innerRadius,
            //                                                      wallThickness,
            //                                                      baseThickness,
            //                                                      waterHeight,
            //                                                      meniscusRadius);

            glassWithLiquid.SetGlassAirMaterial(glass);
            glassWithLiquid.SetLiquidAirMaterial(liquid);
            glassWithLiquid.SetLiquidGlassMaterial(dielectric);
            AddObject(glassWithLiquid);

            Matte matte = new Matte();

            matte.SetColor(1, 1, 0);
            matte.SetKa(0.25f);
            matte.SetKd(0.65f);

            Instance straw = new Instance(new OpenCylinder(-1.2, 1.7, 0.05));

            straw.Material = matte;
            straw.RotateZ(40);
            straw.Translate(0, 1.25f, 0);
            //straw.ComputeBoundingBox();
            AddObject(straw);

            // ground plane
            Checker3D checker = new Checker3D();

            checker.Size = 0.5f;
            checker.SetColor1(0.75f);
            checker.SetColor2(1);

            SV_Matte svMatte = new SV_Matte();

            svMatte.SetKa(0.5f);
            svMatte.SetKd(0.75f);
            svMatte.SetCd(checker);

            Plane plane = new Plane(new Vec3(0, -0.01, 0),
                                    new Vec3(0, 1, 0));

            plane.Material = svMatte;
            AddObject(plane);
        }
Пример #25
0
        public override void Build()
        {
            vp                = ViewPlane.Create(1024, 768, SystemOfCoordinates.SSC_INT);
            vp.NumSamples     = 16;
            vp.ShowOutOfGamut = 0;

            backgroundColor = ColorUtils.BLACK;
            tracer          = new RayCast(this);

            Ambient a = new Ambient();

            a.ScaleRadiance = 1.0f;
            AmbientLight    = a;

            Pinhole pinhole = new Pinhole(new Vec3(0.0, 0.0, 500.0),
                                          new Vec3(0.0, 0.0, 0.0),
                                          new Vec3(0.0, 1.0, 0.0),
                                          2000.0f);

            Camera = pinhole;

            PointLight l = new PointLight();

            l.Color = ColorUtils.WHITE;
            l.SetLocation(100, 100, 200);
            l.ScaleRadiance = 3.0f;
            l.Shadows       = true;
            AddLight(l);

            Vec3 lightGreen = new Vec3(0.65f, 1.0f, 0.30f);
            Vec3 green      = new Vec3(0.0f, 0.6f, 0.3f);
            Vec3 darkGreen  = new Vec3(0.0f, 0.41f, 0.41f);

            Vec3 yellow     = new Vec3(1.0f, 1.0f, 0.0f);
            Vec3 darkYellow = new Vec3(0.61f, 0.61f, 0.0f);

            Vec3 lightPurple = new Vec3(0.65f, 0.3f, 1.0f);
            Vec3 darkPurple  = new Vec3(0.5f, 0.0f, 1.0f);

            Vec3 brown  = new Vec3(0.71f, 0.40f, 0.16f);
            Vec3 orange = new Vec3(1.0f, 0.75f, 0.0f);

            Matte matte = new Matte();

            matte.SetKa(0.2f);
            matte.SetKd(0.5f);
            matte.SetColor(ColorUtils.WHITE);

            Plane p = new Plane(new Vec3(0, -85, 0), new Vec3(0, 1, 0));

            p.Material = matte;
            AddObject(p);

            Phong m = new Phong();

            //Plastic *m = new Plastic();
            m.SetKa(0.2f);
            m.SetKd(0.65f);
            m.SetKs(0.1f);
            m.SetExp(8.0f);
            m.SetColor(ColorUtils.WHITE);

            Sphere s = new Sphere(new Vec3(5, 3, 0), 30);

            s.Material = m;

            AddObject((Sphere)s.Clone());

            s.SetCenter(45, -7, -60);
            s.Radius = 20;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(40, 43, -100);
            s.Radius = 17;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-20, 28, -15);
            s.Radius = 20;
            m.SetColor(orange);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-25, -7, -35);
            s.Radius = 27;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(20, -27, -35);
            s.Radius = 25;
            m.SetColor(lightGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(35, 18, -35);
            s.Radius = 22;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-57, -17, -50);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-47, 16, -80);
            s.Radius = 23;
            m.SetColor(lightGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-15, -32, -60);
            s.Radius = 22;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-35, -37, -80);
            s.Radius = 22;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(10, 43, -80);
            s.Radius = 22;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(30, -7, -80);
            s.Radius = 10;
            m.SetColor(darkYellow);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-40, 48, -110);
            s.Radius = 18;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-10, 53, -120);
            s.Radius = 18;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-55, -52, -100);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(5, -52, -100);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-20, -57, -120);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(55, -27, -100);
            s.Radius = 17;
            m.SetColor(darkGreen);
            AddObject((Sphere)s.Clone());

            s.SetCenter(50, -47, -120);
            s.Radius = 15;
            m.SetColor(brown);
            AddObject((Sphere)s.Clone());

            s.SetCenter(70, -42, -150);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(5, 73, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(66, 21, -130);
            s.Radius = 13;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(72, -12, -140);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(64, 5, -160);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(55, 38, -160);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-73, -2, -160);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(30, -62, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(25, 63, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-60, 46, -140);
            s.Radius = 15;
            m.SetColor(darkPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-30, 68, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(58, 56, -180);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-63, -39, -180);
            s.Radius = 11;
            m.SetColor(green);
            AddObject((Sphere)s.Clone());

            s.SetCenter(46, 68, -200);
            s.Radius = 10;
            m.SetColor(lightPurple);
            AddObject((Sphere)s.Clone());

            s.SetCenter(-3, -72, -130);
            s.Radius = 12;
            m.SetColor(lightPurple);
            AddObject(s);
        }