Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r883 - in trunk: StandAlone UserInterface fox/disco_demo/Engine/Shaders fox/disco_demo/Interface scenes


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r883 - in trunk: StandAlone UserInterface fox/disco_demo/Engine/Shaders fox/disco_demo/Interface scenes
  • Date: Thu, 2 Feb 2006 23:53:47 -0700 (MST)

Author: abe
Date: Thu Feb  2 23:53:47 2006
New Revision: 883

Modified:
   trunk/StandAlone/manta_path_plot.pl
   trunk/UserInterface/CameraPathAutomator.cc
   trunk/fox/disco_demo/Engine/Shaders/AOShader.cc
   trunk/fox/disco_demo/Interface/TilePacket.h
   trunk/scenes/boeing777.cc
Log:

Updated filter heuristic.

M    scenes/boeing777.cc
M    StandAlone/manta_path_plot.pl
M    fox/disco_demo/Interface/TilePacket.h
M    fox/disco_demo/Engine/Shaders/AOShader.cc
M    UserInterface/CameraPathAutomator.cc


Modified: trunk/StandAlone/manta_path_plot.pl
==============================================================================
--- trunk/StandAlone/manta_path_plot.pl (original)
+++ trunk/StandAlone/manta_path_plot.pl Thu Feb  2 23:53:47 2006
@@ -369,7 +369,7 @@
     }
 
     # Run a macro
-    elsif (/^macro:\s*(\w*)\((\w*)\)/) {
+    elsif (/^macro:\s*(\w*)\(([0-9a-zA-Z_\.-]*)\)/) {
 
         my $name = $1;
         my $value = $2;

Modified: trunk/UserInterface/CameraPathAutomator.cc
==============================================================================
--- trunk/UserInterface/CameraPathAutomator.cc  (original)
+++ trunk/UserInterface/CameraPathAutomator.cc  Thu Feb  2 23:53:47 2006
@@ -352,7 +352,7 @@
 
       
////////////////////////////////////////////////////////////////////////
       // Sample by delta_t between the points.
-      for (Real t=0; t<(1-delta_t) && loop_behavior!=PATH_ABORT; t+=delta_t) 
{
+      for (Real t=0; t<=(1.0-delta_t) && loop_behavior!=PATH_ABORT; 
t+=delta_t) {
 
         // Evaluate the spline.
         // NOTE: operator & is overloaded by Vector to return (Real *)

Modified: trunk/fox/disco_demo/Engine/Shaders/AOShader.cc
==============================================================================
--- trunk/fox/disco_demo/Engine/Shaders/AOShader.cc     (original)
+++ trunk/fox/disco_demo/Engine/Shaders/AOShader.cc     Thu Feb  2 23:53:47 
2006
@@ -256,7 +256,8 @@
 
         // Count how many hit.
         for (int j=secondary_packet.begin();j<secondary_packet.end();++j) {
-          if (secondary_packet.wasHit(j)) {
+          if (secondary_packet.wasHit(j) &&
+              (secondary_packet.getMinT(j) < ambient_cutoff)) {
             total_hits[secondary_map[j]]++;
           }
         }
@@ -280,7 +281,8 @@
 
     // Count how many hit.
     for (int j=secondary_packet.begin();j<secondary_packet.end();++j) {
-      if (secondary_packet.wasHit(j)) {
+      if (secondary_packet.wasHit(j) &&
+          (secondary_packet.getMinT(j) < ambient_cutoff)) {
         total_hits[secondary_map[j]]++;
       }
     }
@@ -292,12 +294,13 @@
 
     TilePacket::Element &p = tile_packet.get( i - ray_packet.begin());
     
-    p.illuminance = ( (Real)total_hits[i] / (Real)task_size );
+    p.illuminance = (Real)1.0 -( (Real)total_hits[i] / (Real)task_size );
     
     // Copy over the material color and normal
     p.color  = ray_packet.getColor( i ); // Color(RGB(1,1,1));
     p.normal = ray_packet.getNormal( i );
     p.t      = ray_packet.getMinT( i );
+    p.point  = ray_packet.getHitPosition( i );
   }
 }
 
@@ -323,6 +326,8 @@
                                   DiscoTile *disco_tile,
                                   TilePacket &tile_packet ) {
 
+  
+  
   
/////////////////////////////////////////////////////////////////////////////
   // Filter the hit ratios from neighboring pixels.
   for (int i=0;i<tile_packet.getSize();++i) {
@@ -354,27 +359,31 @@
           
           if (neighbor.wasHit()) {
 
-            Real d = Abs(p.t-neighbor.t);
+            Real d = SCIRun::Abs( (p.point-neighbor.point).length2() );
             Real n = SCIRun::Max((Real)0.0,Dot( normal, neighbor.normal ));
-
-            if ((d < 0.1)) {
+            Real pixel_dist = SCIRun::Sqrt( x_offset*x_offset + 
y_offset*y_offset ) * p.t;
             
+            if ((n > 0) && (d <= 0.009*pixel_dist)) {
+
+
+              Real weight = (Real)1.0 / SCIRun::Sqrt( ((Real)1.0 - n) + 
(Real)0.001 );
+              
               // Look up the neighbor value.
-              Real hit_ratio = n * 
+              Real hit_ratio = weight * 
                 disco_tile->
                 get( x+x_offset,
                      y+y_offset ).illuminance;
               
               // Sum up all of the neighbors.
               sum += hit_ratio;
-              total += n;
-            }
+              total += weight;
+              }
           }
         }
       }
       
       // Color the pixel
-      sum = 1.0 - (sum/total);
+      sum = (sum/total);
       
       p.color = p.color * Color(RGB(sum,sum,sum));
     }

Modified: trunk/fox/disco_demo/Interface/TilePacket.h
==============================================================================
--- trunk/fox/disco_demo/Interface/TilePacket.h (original)
+++ trunk/fox/disco_demo/Interface/TilePacket.h Thu Feb  2 23:53:47 2006
@@ -62,6 +62,7 @@
       Real   illuminance;
       Real   t;
       Vector normal;
+      Point  point;
       
       // Result
       Color  color;

Modified: trunk/scenes/boeing777.cc
==============================================================================
--- trunk/scenes/boeing777.cc   (original)
+++ trunk/scenes/boeing777.cc   Thu Feb  2 23:53:47 2006
@@ -83,7 +83,8 @@
                         MTL_NORMAL,
                         MTL_SOLID_WIRE,
                         MTL_WIRE,
-                        MTL_RAYDIRECTION };
+                        MTL_RAYDIRECTION,
+                        MTL_LAMBERTIAN };
 enum TraversalType    { TRAVERSAL_SINGLE, TRAVERSAL_VERTICAL, TRAVERSAL_SSE 
};
 
 ///////////////////////////////////////////////////////////////////////////
@@ -146,6 +147,9 @@
     }
     else if (args[i] == "-normal") {
       material_type = MTL_NORMAL;
+    }
+    else if (args[i] == "-lambertian") {
+      material_type = MTL_LAMBERTIAN;
     }    
     else if (args[i] == "-flat") {
       material_type = MTL_FLAT;
@@ -198,6 +202,7 @@
                        cerr << "-alpha <alpha>"               << endl;
       cerr << "-phong <exp> <reflection> **default**" << endl;
       cerr << "-ambient <max dist> <secondary rays>"  << endl;
+      cerr << "-lambertian\n";
       cerr << "-normal   -- Use normal material.\n";
       cerr << "-flat\n";
       cerr << "-wire\n    -- wireframe only";
@@ -244,6 +249,9 @@
   case MTL_FLAT:
     kd_material = new Flat( new KDTreeTexture );
     break;
+  case MTL_LAMBERTIAN:
+    kd_material = new Lambertian( new KDTreeTexture );
+    break;    
     
   case MTL_NORMAL:
     kd_material = new Flat( new NormalTexture() );




  • [MANTA] r883 - in trunk: StandAlone UserInterface fox/disco_demo/Engine/Shaders fox/disco_demo/Interface scenes, abe, 02/02/2006

Archive powered by MHonArc 2.6.16.

Top of page