Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1862 - trunk/Engine/Renderers


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1862 - trunk/Engine/Renderers
  • Date: Tue, 20 Nov 2007 19:10:28 -0700 (MST)

Author: sparker
Date: Tue Nov 20 19:10:27 2007
New Revision: 1862

Modified:
   trunk/Engine/Renderers/KajiyaPathtracer.cc
Log:
Moved RR to always throw a direct illumination ray


Modified: trunk/Engine/Renderers/KajiyaPathtracer.cc
==============================================================================
--- trunk/Engine/Renderers/KajiyaPathtracer.cc  (original)
+++ trunk/Engine/Renderers/KajiyaPathtracer.cc  Tue Nov 20 19:10:27 2007
@@ -175,6 +175,39 @@
       i=end;
     }
 
+    for(int i=rays.begin();i<rays.end();i++){
+      for(int j=0;j<3;j++)
+        total_attenuation.colordata[j][i] *= reflectance.colordata[j][i];
+    }
+
+    // Cast shadow rays
+    ShadowAlgorithm::StateBuffer shadowState;
+    do {
+      RayPacketData shadowData;
+      RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0, depth, 
false);
+
+      // Call the shadowalgorithm(sa) to generate shadow rays.  We may not be
+      // able to compute all of them, so we pass along a buffer for the sa
+      // object to store it's state.
+      context.shadowAlgorithm->computeShadows(context, shadowState, 
context.scene->getLights(),
+                                              rays, shadowRays);
+
+      // We need normalized directions for proper dot product computation.
+      shadowRays.normalizeDirections();
+
+      for(int i=shadowRays.begin(); i < shadowRays.end(); i++){
+        if(!shadowRays.wasHit(i)){
+          // Not in shadow, so compute the direct lighting contributions.
+          Vector normal = rays.getFFNormal(i);
+          Vector light_dir = shadowRays.getDirection(i);
+          light_dir.normalize();
+          double weight=Dot(normal, light_dir);
+          Color light_color = shadowRays.getColor(i);
+          result.set(i, result.get(i) + total_attenuation.get(i) * 
light_color * weight);
+        }
+      }
+    } while(!shadowState.done());
+
     // Russian roulette and collapse
     bool do_russian_roulette = (depth > 0);
     if(do_russian_roulette){
@@ -238,48 +271,14 @@
           for(int j=0;j<3;j++)
             reflectance.colordata[j][i] *= scale;
           for(int j=0;j<3;j++)
-            total_attenuation.colordata[j][i] *= reflectance.colordata[j][i];
+            total_attenuation.colordata[j][i] *= scale;
         }
       
         rays.resize(rays.begin(), newEnd);
         if(rays.begin() == rays.end())
           break;
       }
-    } else {
-      for(int i=rays.begin();i<rays.end();i++){
-        for(int j=0;j<3;j++)
-          total_attenuation.colordata[j][i] *= reflectance.colordata[j][i];
-      }
     }
-
-
-    // Cast shadow rays
-    ShadowAlgorithm::StateBuffer shadowState;
-    do {
-      RayPacketData shadowData;
-      RayPacket shadowRays(shadowData, RayPacket::UnknownShape, 0, 0, depth, 
false);
-
-      // Call the shadowalgorithm(sa) to generate shadow rays.  We may not be
-      // able to compute all of them, so we pass along a buffer for the sa
-      // object to store it's state.
-      context.shadowAlgorithm->computeShadows(context, shadowState, 
context.scene->getLights(),
-                                              rays, shadowRays);
-
-      // We need normalized directions for proper dot product computation.
-      shadowRays.normalizeDirections();
-
-      for(int i=shadowRays.begin(); i < shadowRays.end(); i++){
-        if(!shadowRays.wasHit(i)){
-          // Not in shadow, so compute the direct lighting contributions.
-          Vector normal = rays.getFFNormal(i);
-          Vector light_dir = shadowRays.getDirection(i);
-          light_dir.normalize();
-          double weight=Dot(normal, light_dir);
-          Color light_color = shadowRays.getColor(i);
-          result.set(i, result.get(i) + total_attenuation.get(i) * 
light_color * weight);
-        }
-      }
-    } while(!shadowState.done());
 
     depth++;
     if(depth >= maxdepth)




  • [Manta] r1862 - trunk/Engine/Renderers, sparker, 11/20/2007

Archive powered by MHonArc 2.6.16.

Top of page