Text archives Help
- From: arobison@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1757 - trunk/Engine/Renderers
- Date: Fri, 5 Oct 2007 16:37:54 -0600 (MDT)
Author: arobison
Date: Fri Oct 5 16:37:54 2007
New Revision: 1757
Modified:
trunk/Engine/Renderers/Raytracer.cc
Log:
Fixing performance issue and separating the two traceRays calls.
Shaders should call the three-argument version when they want
rays to be attenuated.
Modified: trunk/Engine/Renderers/Raytracer.cc
==============================================================================
--- trunk/Engine/Renderers/Raytracer.cc (original)
+++ trunk/Engine/Renderers/Raytracer.cc Fri Oct 5 16:37:54 2007
@@ -52,15 +52,6 @@
rays.resetHits();
context.scene->getObject()->intersect(context, rays);
-#if 0
- // grab the scene's importance cutoff for ray-tree attenuation
- Real cutoff = context.scene->getRenderParameters().importanceCutoff;
- if(cutoff > 0) {
- traceRays(context, rays, cutoff);
- return;
- }
-#endif
-
// Go through the ray packet and shade them. Group rays that hit the
// same object and material to shade with a single shade call
for(int i = rays.begin();i<rays.end();){
@@ -106,59 +97,24 @@
void Raytracer::traceRays(const RenderContext& context, RayPacket& rays,
Real cutoff)
{
- int debugFlag = rays.getAllFlags() & RayPacket::DebugPacket;
- rays.resetHits();
- context.scene->getObject()->intersect(context, rays);
-
- // Go through the ray packet and shade them. Group rays that hit the
- // same object and material to shade with a single shade call
- for(int i = rays.begin();i<rays.end();){
-
- // skip rays that are below the importance threshold
- if(rays.getImportance(i).luminance() < cutoff) {
- i++;
- continue;
- }
-
-
- if(rays.wasHit(i)){
- const Material* hit_matl = rays.getHitMaterial(i);
- int end = i+1;
- while(end < rays.end() && rays.wasHit(end) &&
- rays.getHitMaterial(end) == hit_matl &&
- rays.getImportance(end).luminance() >= cutoff)
+ for(int i = rays.begin(); i != rays.end();) {
+ if(rays.getImportance(i).luminance() > cutoff) {
+ int end = i + 1;
+ while(end < rays.end() && rays.getImportance(end).luminance() > cutoff)
end++;
- if (debugFlag) {
- rays.computeHitPositions();
- for (int j = i; j < end; ++j) {
- cerr << "raytree: ray_index "<<j
- << " depth " << rays.getDepth()
- << " origin "<< rays.getOrigin(j)
- << " direction "<< rays.getDirection(j)
- << " hitpos " << rays.getHitPosition(j)
- << "\n";
- }
- }
+
RayPacket subPacket(rays, i, end);
- hit_matl->shade(context, subPacket);
- i=end;
+ traceRays(context, subPacket);
+ i = end;
} else {
- int end = i+1;
- while(end < rays.end() && !rays.wasHit(end) &&
- rays.getImportance(end).luminance() >= cutoff)
- end++;
- if (debugFlag) {
- for (int j = i; j < end; ++j) {
- cerr << "raytree: ray_index "<<j
- << " depth " << rays.getDepth()
- << " origin "<< rays.getOrigin(j)
- << " direction "<< rays.getDirection(j)
- << "\n";
- }
+ // need to set the color to black
+ rays.setColor(i, Color::black());
+ int end = i + 1;
+ while(end < rays.end() && rays.getImportance(end).luminance() <=
cutoff) {
+ rays.setColor(end, Color::black());
+ end++;
}
- RayPacket subPacket(rays, i, end);
- context.scene->getBackground()->shade(context, subPacket);
- i=end;
+ i = end;
}
}
}
- [Manta] r1757 - trunk/Engine/Renderers, arobison, 10/05/2007
Archive powered by MHonArc 2.6.16.