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(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);
        }
Example #3
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);
        }