Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [Manta] Shadow algorithm question


Chronological Thread 
  • From: Thiago Ize <thiago@cs.utah.edu>
  • To: James Bigler <bigler@cs.utah.edu>
  • Cc: manta@sci.utah.edu
  • Subject: Re: [Manta] Shadow algorithm question
  • Date: Thu, 07 Feb 2008 10:24:33 -0700

Lower down there is this:
 if(last != -1){
   shadowRays.resize ( first, last + 1);
which I think should handle the problem since shadowRays will start with a valid ray or (partially) valid sse group. Speaking of which, I think it might be more efficient the way it was before where first pointed to the start of the 4-wide simd group, even though the first ray (or 3) of those were invalid. The reason for that is that operating on sse registers of 4 rays with just one valid ray should in principle be just as fast as operating on a single valid scalar ray. If that simd group contains more than one valid ray then it's even more likely to be faster.

Thiago

James Bigler wrote:
Please help clarify something for me with the recent changes to the shadow algorithm.

      for(;i<b;i++){
        Vector dir = shadowRays.getDirection(i);
        if(Dot(dir, sourceRays.getFFNormal(i)) > 0) {

// Block 1: When we have a good ray.  Pretty straight forward.

          shadowRays.setOrigin(i, sourceRays.getHitPosition(i));
          shadowRays.setTime(i, sourceRays.getTime(i));
          // See comment above.
          shadowRays.setHitMaterial(i, NULL);
          last = i;
          if (first < 0)
            first = i;
        }
        else if (first >= 0) {

// Block 2: We have a bad ray and we have found a good ray in the packet somewhere previously.

          //if we've already found a valid ray, use that to copy valid
          //data into the invalid ray.
          shadowRays.setOrigin(i, shadowRays.getOrigin(first));
          shadowRays.setDirection(i, shadowRays.getDirection(first));
          shadowRays.setTime(i, shadowRays.getTime(first));

          shadowRays.maskRay(i); //this sets minT -MAXT and hitMatl to -1
          //We set minT to 0 instead of -MAXT just in case an algorithm
          //uses the ray hit position to compute things. In which case
          //having the hit position at the origin would probably break
          //things less than having it be infinitely far away in the
          //negative direction.
shadowRays.overrideMinT(i, 0);//TOOD: verify 0 is ok (should we use -eps?).
        } else {

// Block 3: We have a bad ray, and we have *not* found a good ray previously.

          shadowRays.maskRay(i);
        }
      }

So we could end up in a situation where some of the bad rays have good data (block 2) and some have nothing (block 3). Block 3 rays would be the first block of bad rays. Is this a problem?

James






Archive powered by MHonArc 2.6.16.

Top of page