Exemplo n.º 1
0
 public override Spectrum SampleL(Point p, float pEpsilon, LightSample ls,
     float time, out Vector wi, out float pdf,
     out VisibilityTester vis)
 {
     wi = _direction;
     pdf = 1.0f;
     vis = new VisibilityTester(p, pEpsilon, wi, time);
     return _radiance;
 }
Exemplo n.º 2
0
 public override Spectrum SampleL(Scene scene, LightSample ls, float u1, float u2, float time, out Ray ray, out Normal ns, out float pdf)
 {
     ray = new Ray(_lightPosition, 
         MonteCarloUtilities.UniformSampleSphere(ls.UPos0, ls.UPos1), 
         0.0f, float.PositiveInfinity, time);
     ns = (Normal) ray.Direction;
     pdf = MonteCarloUtilities.UniformSpherePdf();
     return _intensity;
 }
Exemplo n.º 3
0
 public override Spectrum SampleL(
     Point p, float pEpsilon, LightSample ls, float time, out Vector wi,
     out float pdf, out VisibilityTester vis)
 {
     wi = Vector.Normalize(_lightPosition - p);
     pdf = 1.0f;
     vis = new VisibilityTester(p, pEpsilon, _lightPosition, 0.0f, time);
     return _intensity / Point.DistanceSquared(_lightPosition, p);
 }
Exemplo n.º 4
0
        public override Spectrum SampleL(Scene scene, LightSample ls, float u1, float u2, float time, out Ray ray, out Normal ns, out float pdf)
        {
            // Choose point on disk oriented toward infinite light direction
            Point worldCenter;
            float worldRadius;
            scene.WorldBound.BoundingSphere(out worldCenter, out worldRadius);
            Vector v1, v2;
            Vector.CoordinateSystem(_direction, out v1, out v2);
            float d1, d2;
            MonteCarloUtilities.ConcentricSampleDisk(ls.UPos0, ls.UPos1, out d1, out d2);
            Point Pdisk = worldCenter + worldRadius * (d1 * v1 + d2 * v2);

            // Set ray origin and direction for infinite light ray
            ray = new Ray(Pdisk + worldRadius * _direction, -_direction, 0.0f, float.PositiveInfinity, time);
            ns = (Normal) ray.Direction;

            pdf = 1.0f / (MathUtility.Pi * worldRadius * worldRadius);
            return _radiance;
        }
Exemplo n.º 5
0
 public override Spectrum SampleL(Scene scene, LightSample ls, float u1, float u2, float time, out Ray ray, out Normal ns, out float pdf)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 6
0
 public override Spectrum SampleL(Point p, float pEpsilon, LightSample ls, float time, out Vector wi, out float pdf,
     out VisibilityTester vis)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 7
0
 public abstract Spectrum SampleL(Scene scene, LightSample ls, float u1, float u2,
     float time, out Ray ray, out Normal ns, out float pdf);
Exemplo n.º 8
0
 public abstract Spectrum SampleL(Point p, float pEpsilon, LightSample ls,
     float time, out Vector wi, out float pdf, out VisibilityTester vis);