Beispiel #1
0
        public bool Scatter(Ray rayIn, HitRecord record, ref Vec3 attenuation, ref Ray scatteredRay, Random random)
        {
            var bounceDirection = record.Normal + GeometrySampler.RandomPointInUnitSphere(random);

            scatteredRay = new Ray(record.Point, bounceDirection);
            attenuation  = this.Albedo.Value(0, 0, record.Point);
            return(true);
        }
Beispiel #2
0
        public bool Scatter(Ray rayIn, HitRecord record, ref Vec3 attenuation, ref Ray scatteredRay, Random random)
        {
            var reflectedDirection = Vec3.Reflect(rayIn.Direction.Normalized, record.Normal);
            var fuzzyDirection     = reflectedDirection + this.Fuzz * GeometrySampler.RandomPointInUnitSphere(random);

            scatteredRay = new Ray(record.Point, fuzzyDirection);
            attenuation  = this.Albedo;
            return(scatteredRay.Direction.Dot(record.Normal) > 0);
        }