public TestScene(double aspect)
        {
            double R = Math.Cos(Math.PI / 4);

            IHitable[] hitables =
            {
                new Sphere(Vec3.Create(-R, 0, -1), R, new Lambertian(Vec3.Create(1, 0, 0))),
                new Sphere(Vec3.Create(R,  0, -1), R, new Lambertian(Vec3.Create(0, 0, 1)))
            };
            World  = new HitableList(hitables);
            Camera = Camera.CreateByVerticalFiled(90, aspect);
        }
 public MaterialsScene(double aspect)
 {
     IHitable[] hitables =
     {
         new Sphere(Vec3.Create(0,  -100.5, 0),   100, new Lambertian(Vec3.Create(0.8, 0.8, 0.0))),
         new Sphere(Vec3.Create(0,       0, 0),   0.5, new Lambertian(Vec3.Create(0.1, 0.2, 0.5))),
         new Sphere(Vec3.Create(1,       0, 0),   0.5, new Metal(Vec3.Create(0.8,      0.6,   0.2),0.3)),
         new Sphere(Vec3.Create(-1,      0, 0),   0.5, new Dielectric(1.5)),
         new Sphere(Vec3.Create(-1,      0, 0), -0.45, new Dielectric(1.5))
     };
     World  = new HitableList(hitables);
     Camera = Camera.CreateLookAt(Vec3.Create(0.25, 0.5, 2.2), Vec3.Create(0.1, 0.0, 0), Vec3.Create(0, 1, 0), 45, aspect, 0, 1);
 }
예제 #3
0
        public DefocusBlurScene(double aspect)
        {
            IHitable[] hitables =
            {
                new Sphere(Vec3.Create(0,  -100.5, -1),   100, new Lambertian(Vec3.Create(0.8, 0.8, 0.0))),
                new Sphere(Vec3.Create(0,       0, -1),   0.5, new Lambertian(Vec3.Create(0.1, 0.2, 0.5))),
                new Sphere(Vec3.Create(1,       0, -1),   0.5, new Metal(Vec3.Create(0.8,      0.6,   0.2),0.3)),
                new Sphere(Vec3.Create(-1,      0, -1),   0.5, new Dielectric(1.5)),
                new Sphere(Vec3.Create(-1,      0, -1), -0.45, new Dielectric(1.5))
            };
            World = new HitableList(hitables);
            var    lookFrom      = Vec3.Create(3, 3, 2);
            var    lookAt        = Vec3.Create(0, 0, -1);
            var    dist_to_focus = (lookFrom - lookAt).Length;
            double aderpture     = 2;

            Camera = Camera.CreateLookAt(lookFrom, lookAt, Vec3.Create(0, 1, 0), 25, aspect, aderpture, dist_to_focus);
        }
        public CoverScene(double aspect)
        {
            var             sampler  = new Random();
            List <IHitable> hitables = new List <IHitable>();

            hitables.Add(new Sphere(Vec3.Create(0, -1000, 0), 1000, new Lambertian(Vec3.Create(0.5, 0.5, 0.5))));
            for (int a = -11; a < 11; ++a)
            {
                for (int b = -11; b < 11; ++b)
                {
                    double choos_mat = sampler.NextDouble();
                    Vec3   center    = Vec3.Create(a + 0.9 * sampler.NextDouble(), 0.2, b + 0.9 * sampler.NextDouble());
                    if ((center - Vec3.Create(4, 0.2, 0)).Length > 0.9)
                    {
                        if (choos_mat < 0.8) // diffuse
                        {
                            hitables.Add(new Sphere(center, 0.2,
                                                    new Lambertian(Vec3.Create(sampler.NextDouble() * sampler.NextDouble(), sampler.NextDouble() * sampler.NextDouble(), sampler.NextDouble() * sampler.NextDouble()))));
                        }
                        else if (choos_mat < 0.9) // metal
                        {
                            hitables.Add(new Sphere(center, 0.2,
                                                    new Metal(Vec3.Create(0.5 * (1 + sampler.NextDouble()), 0.5 * (1 + sampler.NextDouble()), 0.5 * (1 + sampler.NextDouble())), 0.5 * sampler.NextDouble())));
                        }
                        else // glass
                        {
                            hitables.Add(new Sphere(center, 0.2, new Dielectric(1.5)));
                        }
                    }
                }
            }
            hitables.Add(new Sphere(Vec3.Create(0, 1, 0), 1, new Dielectric(1.5)));
            hitables.Add(new Sphere(Vec3.Create(-4, 1, 0), 1, new Lambertian(Vec3.Create(0.4, 0.2, 0.1))));
            hitables.Add(new Sphere(Vec3.Create(4, 1, 0), 1, new Metal(Vec3.Create(0.7, 0.6, 0.5), 0)));
            World = new HitableList(hitables.ToArray());
            var    lookFrom      = Vec3.Create(12, 2, 3);
            var    lookAt        = Vec3.Create(0, 0, 0);
            double dist_to_focus = 10;
            double aderpture     = 0.1;

            Camera = Mathematics.Camera.CreateLookAt(lookFrom, lookAt, Vec3.Create(0, 1, 0), 20, aspect, aderpture, dist_to_focus);
        }