Пример #1
0
        public virtual float GenerateRayDifferential(CameraSample sample, out RayDifferential rd)
        {
            Ray   ray;
            float wt = GenerateRay(sample, out ray);

            rd = RayDifferential.FromRay(ray);

            // Find ray after shifting one pixel in the $x$ direction
            CameraSample sshift = sample;

            ++(sshift.ImageX);
            Ray   rx;
            float wtx = GenerateRay(sshift, out rx);

            rd.RxOrigin    = rx.Origin;
            rd.RxDirection = rx.Direction;

            // Find ray after shifting one pixel in the $y$ direction
            --(sshift.ImageX);
            ++(sshift.ImageY);
            Ray   ry;
            float wty = GenerateRay(sshift, out ry);

            rd.RyOrigin    = ry.Origin;
            rd.RyDirection = ry.Direction;

            if (wtx == 0.0f || wty == 0.0f)
            {
                return(0.0f);
            }

            rd.HasDifferentials = true;
            return(wt);
        }
Пример #2
0
 public Spectrum Transmittance(Scene scene, Renderer renderer,
                               Sample sample, Random rng)
 {
     return(renderer.Transmittance(
                scene, RayDifferential.FromRay(Ray),
                sample, rng));
 }