Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] Debugging some shadows...?


Chronological Thread 
  • From: Abe Stephens <abe@sci.utah.edu>
  • To: "'manta@sci.utah.edu'" <manta@sci.utah.edu>
  • Subject: [MANTA] Debugging some shadows...?
  • Date: Wed, 01 Jun 2005 12:44:26 -0700

Hey,

I am trying to debug some shadow problems with our large datasets, and I've ended up making a simple material that starts off black and then colors a ray white if it is not in the shadow of at least one light source.  I added this material to scene 0 just to make sure it is working.

Here's my question, why are regions that are definitely in shadow on the spheres speckled when they should be just black? (see screen shots) I have tried a few different epsilons without luck and the problem isn't just on the grazing edges of the sphere either--I see false positive non-shadowed regions.

Thanks--
Abe


Here is the basic shader I am using (hacked up version of Lambertian):

    // Compute ambient contributions for all rays
    scene->getLights()->getAmbientLight()->computeAmbient(context, rays);
   
    // Compute the normals.
    rays.computeNormals( context );

    RayPacketData data;
    int start = 0;
   
    do {
        RayPacket shadowRays(data, 0, rays.getDepth(), 0);
       
        // Send the shadow ray.
        int end = context.shadowAlgorithm->computeShadows( context, scene->getLights(), rays, start, shadowRays );
       
        // Normalize the shadow ray directions.
        shadowRays.normalizeDirections();
       
        // Iterate over the ray packet.
        for(int i=start;i<end;i++) {
       
            RayPacket::Element& e = rays.get(i);
           
            // Color totalLight(e.ambientLight);
            Color totalLight(RGB(0.0f,0.0f,0.0f));
           
            // Iterate over the shadow ray packet for this ray (Is this usually one??)
            for(int j=e.shadowBegin;j<e.shadowEnd;j++){
                RayPacket::Element& s = shadowRays.get(j);
               
                // Check to see if the shadow ray hit something.
                if(!s.hitInfo.wasHit()){
                    // double cos_theta = Dot(s.ray.direction(), e.normal);
                    // totalLight += s.light*cos_theta;
                    // totalLight += Color(RGB(1,1,1));
                    totalLight = Color(RGB(1.0,1.0,1.0));
                }
               
            }
           
            // Set the result..
            rays.setResult( i, /*colors[i]**/totalLight );
        }
       
        start = end;
    } while(start < rays.getSize());


PNG image

PNG image

PNG image




Archive powered by MHonArc 2.6.16.

Top of page