Beispiel #1
0
        public override bool Scatter(Ray r, HitRecord rec, out Vec3f attenuation, out Ray Scattered, Random drand)
        {
            Vec3f reflected = Vec3f.Reflect(r.Direction.GetNormal(), rec.Normal);

            Scattered = new Ray(rec.Point, reflected + Fuzz * RayTrace1.RandomInUnitSphere(drand));

            attenuation = Albedo;

            return(Vec3f.Dot(Scattered.Direction, rec.Normal) > 0);
        }
        public override bool Scatter(Ray r, HitRecord rec, out Vec3f attenuation, out Ray Scattered, Random drand)
        {
            Vec3f target = rec.Point + rec.Normal + RayTrace1.RandomInUnitSphere(drand);

            Scattered = new Ray(rec.Point, target - rec.Point);

            attenuation = Albedo;

            return(true);
        }