Text archives Help
- From: thiago@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1690 - in trunk: Engine/Shadows Model/Primitives
- Date: Wed, 29 Aug 2007 21:37:02 -0600 (MDT)
Author: thiago
Date: Wed Aug 29 21:37:02 2007
New Revision: 1690
Modified:
trunk/Engine/Shadows/NoShadows.cc
trunk/Model/Primitives/WaldTriangle.cc
Log:
Bug fixin
Engine/Shadows/NoShadows.cc:
Was doing lots of extra work, like normalizing the shadow ray dirs,
that didn't need to be done (normalizing was done again by shader
code anyway). More importantly, shadowRay packet was not resized
correctly, so it might have contained rays that were never valid.
Fixed that by using the same logic as in HardShadow. These fixes
make the no shadow code much faster (as it should be!).
Model/Primitives/WaldTriangle.cc:
One of the for loops was going over the wrong range and so doing
extra work.
Modified: trunk/Engine/Shadows/NoShadows.cc
==============================================================================
--- trunk/Engine/Shadows/NoShadows.cc (original)
+++ trunk/Engine/Shadows/NoShadows.cc Wed Aug 29 21:37:02 2007
@@ -43,6 +43,7 @@
}
// Compute the contribution for this light.
+ int first = -1;
int last = -1;
do {
lights->getLight(j)->computeLight(shadowRays, context, sourceRays);
@@ -51,25 +52,23 @@
// Check to see if the light is on the front face.
Vector dir = shadowRays.getDirection(i);
if(Dot(dir, sourceRays.getFFNormal(i)) > 0) {
+ // This is a version of resetHit that only sets the material
+ // to NULL and doesn't require us to also modify the hit
+ // distance which was set for us by the call to computeLight.
+ shadowRays.setHitMaterial(i, NULL);
- // If so normalize and compute length (to reset minT).
- // NOTE(boulos): Although we're not going to determine
- // occlusion, it is still probably useful to allow the caller
- // to know how far away the light would be.
- Real length = dir.normalize();
-
- shadowRays.scaleMinT(i, length);
- // Populate the direction and color only
- shadowRays.setDirection(i, dir );
- shadowRays.resetHit(i);
last = i;
+ if (first < 0)
+ first = i;
} else {
shadowRays.maskRay(i);
}
}
j++;
} while(last == -1 && j < nlights);
- shadowRays.resize (last+1);
+
+ if (last > 0)
+ shadowRays.resize (first, last + 1);
if(j == nlights){
stateBuffer.state = StateBuffer::Finished;
Modified: trunk/Model/Primitives/WaldTriangle.cc
==============================================================================
--- trunk/Model/Primitives/WaldTriangle.cc (original)
+++ trunk/Model/Primitives/WaldTriangle.cc Wed Aug 29 21:37:02 2007
@@ -307,7 +307,7 @@
f0 = n_d - (org_k + n_u * org_ku + n_v * org_kv);
}
- for (int i = ray_begin; i < sse_end; i++ )
+ for (int i = ray_begin; i < sse_begin; i++ )
{
const float nd0 = n_u * dir_ku[i] + n_v * dir_kv[i] + dir_k[i];
const float nd = 1.f/nd0;
- [Manta] r1690 - in trunk: Engine/Shadows Model/Primitives, thiago, 08/29/2007
Archive powered by MHonArc 2.6.16.