예제 #1
0
        public override bool Scatter(Ray r, HitRecord hitRecord, out Vector3 attenuation, out Ray scattered)
        {
            Vector3 target = hitRecord.HitPoint + hitRecord.SurfaceNormal + VectorHelpers.GetRandomInUnitSphere();

            scattered   = new Ray(hitRecord.HitPoint, target - hitRecord.HitPoint);
            attenuation = Texture.GetValue(0, 0, hitRecord.HitPoint);
            return(true);
        }
예제 #2
0
        public Vector3 GetValue(float u, float v, Vector3 hitPoint)
        {
            double sineFunc(float val) => Math.Sin(10 * val);

            double sines = sineFunc(hitPoint.X) * sineFunc(hitPoint.Y) * sineFunc(hitPoint.Z);

            if (sines < 0)
            {
                return(OddTexture.GetValue(u, v, hitPoint));
            }
            else
            {
                return(EvenTexture.GetValue(u, v, hitPoint));
            }
        }
예제 #3
0
 public override Vector3 Emitted(float u, float v, Vector3 hitPoint)
 {
     return(emit.GetValue(u, v, hitPoint));
 }