Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1229 - in branches/Manta-knolla-isohack: Core/Math Model/Primitives scenes


Chronological Thread 
  • From: knolla@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1229 - in branches/Manta-knolla-isohack: Core/Math Model/Primitives scenes
  • Date: Sat, 28 Oct 2006 23:28:51 -0600 (MDT)

Author: knolla
Date: Sat Oct 28 23:28:48 2006
New Revision: 1229

Modified:
   branches/Manta-knolla-isohack/Core/Math/SSEDefs.h
   branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceGridVolume.h
   branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.cc
   branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.h
   branches/Manta-knolla-isohack/Model/Primitives/PrimitiveCommon.h
   branches/Manta-knolla-isohack/scenes/octisovol.cc
Log:
checking version for Manta octiso branch

Modified: branches/Manta-knolla-isohack/Core/Math/SSEDefs.h
==============================================================================
--- branches/Manta-knolla-isohack/Core/Math/SSEDefs.h   (original)
+++ branches/Manta-knolla-isohack/Core/Math/SSEDefs.h   Sat Oct 28 23:28:48 
2006
@@ -52,12 +52,14 @@
 {
     union sse_union
     {
+        MANTA_ALIGN(16);  
         sse_t sse;
         float f[4];
     };
     
     union sse_int_union
     {
+        MANTA_ALIGN(16);  
         __m128i ssei;
         int i[4];
     };    

Modified: 
branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceGridVolume.h
==============================================================================
--- branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceGridVolume.h     
  (original)
+++ branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceGridVolume.h     
  Sat Oct 28 23:28:48 2006
@@ -12,11 +12,11 @@
 #include <Model/Primitives/OctreeVolume.h>
 
 //generate the octree data
-#define TEST_OCTDATA
+//#define TEST_OCTDATA
 
 //test the octree data
-#define USE_OCTREE_DATA
-#define USE_OTD_NEIGHBOR_FIND  
+//#define USE_OCTREE_DATA
+//#define USE_OTD_NEIGHBOR_FIND        
 
 typedef unsigned char ST;
 

Modified: 
branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.cc
==============================================================================
--- branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.cc  
  (original)
+++ branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.cc  
  Sat Oct 28 23:28:48 2006
@@ -81,6 +81,11 @@
     
 
 static const int axis_table[] = {4, 2, 1};
+
+#ifdef IOV_STATS
+static int stat_cellsIntersected = 0;
+static int stat_cellsLookedUp = 0;
+#endif
     
 using namespace Manta;
 
@@ -93,6 +98,17 @@
 {
 }
 
+void IsosurfaceOctreeVolume::newFrame(void* data)
+{
+#ifdef IOV_STATS
+  cerr << "Previous frame:" << endl;
+  cerr << "cells looked up = " << stat_cellsLookedUp << endl;
+  cerr << "cells intersected = " << stat_cellsIntersected << endl;
+  stat_cellsIntersected = 0;
+  stat_cellsLookedUp = 0;
+#endif
+}
+
 void IsosurfaceOctreeVolume::preprocess( PreprocessContext const &context )
 {
     PrimitiveCommon::preprocess(context);
@@ -291,10 +307,16 @@
                                rho[0][0][0] = static_cast<float>(this_rho);
                                int prev_depth = depth-1;
                                Vec3i offset(0,0,child_bit);
+#ifdef IOV_STATS
+        stat_cellsLookedUp++;
+#endif
                                octvol_fill_cell(node, child_bit);
                                
                                if (octdata->get_isovalue() >= min_rho && 
octdata->get_isovalue() <= max_rho)
                                {
+#ifdef IOV_STATS
+          stat_cellsIntersected++;
+#endif          
                                        float hit_t;
                                        if 
(IsosurfaceImplicit::single_intersect(orig, dir, cmin, cmax, rho, 
                                                octdata->get_isovalue(), 
child_tenter, child_texit, hit_t))
@@ -443,8 +465,13 @@
             {
                 //try isosurface intersection
                 Vector cmin(child_cell.data[0], child_cell.data[1], 
child_cell.data[2]);
-                               Vector cmax(child_cell.data[0] + child_bit, 
child_cell.data[1] + child_bit, child_cell.data[2] + child_bit);
+                Vector cmax(child_cell.data[0] + child_bit, 
child_cell.data[1] + child_bit, child_cell.data[2] + child_bit);
 
+#ifdef IOV_STATS
+                stat_cellsLookedUp++;
+#endif
+                
+                
 #ifdef USE_OCTREE_DATA
                 //use octree data
                 float rho[2][2][2];
@@ -536,7 +563,7 @@
                 }
                 else
                     this_rho = scalar;
-                rho[0][1][0] = static_cast<float>(this_rho);                 
  
+                rho[0][1][0] = static_cast<float>(this_rho);                 
                  
 #else  
                 //use original grid data
                 float rho[2][2][2];
@@ -556,6 +583,10 @@
 #endif
                 if (octdata->get_isovalue() >= min_rho && 
octdata->get_isovalue() <= max_rho)
                 {
+#ifdef IOV_STATS
+                    stat_cellsIntersected++;
+#endif
+                  
                     float hit_t;
                     if (IsosurfaceImplicit::single_intersect_neubauer(orig, 
dir, cmin, cmax, rho, 
                         octdata->get_isovalue(), child_tenter, child_texit, 
hit_t))
@@ -679,7 +710,7 @@
 
         //try isosurface intersection in this node
         Vector cmin(child_cell.data[0], child_cell.data[1], 
child_cell.data[2]);
-               Vector cmax(child_cell.data[0] + 1, child_cell.data[1] + 1, 
child_cell.data[2] + 1);
+        Vector cmax(child_cell.data[0] + 1, child_cell.data[1] + 1, 
child_cell.data[2] + 1);
         
 #ifdef USE_OCTREE_DATA
         float rho[2][2][2];
@@ -688,7 +719,7 @@
         rho[0][0][0] = static_cast<float>(this_rho);
         int prev_depth = depth-1;
         Vec3i offset(0,0,1);
-               octvol_fill_cell(cap, 1);
+        octvol_fill_cell(cap, 1);
 #else  
         //use original grid data
         float rho[2][2][2];
@@ -706,8 +737,16 @@
             max_rho = MAX(this_rho, max_rho);
         }
 #endif
+        
+#ifdef IOV_STATS
+        stat_cellsLookedUp++;
+#endif
+        
         if (octdata->get_isovalue() >= min_rho && octdata->get_isovalue() <= 
max_rho)
         {
+#ifdef IOV_STATS
+          stat_cellsIntersected++;
+#endif          
             float hit_t;
             if (IsosurfaceImplicit::single_intersect_neubauer(orig, dir, 
cmin, cmax, rho, 
                 octdata->get_isovalue(), child_tenter, child_texit, hit_t))

Modified: 
branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.h
==============================================================================
--- branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.h   
  (original)
+++ branches/Manta-knolla-isohack/Model/Primitives/IsosurfaceOctreeVolume.h   
  Sat Oct 28 23:28:48 2006
@@ -31,6 +31,7 @@
             IsosurfaceOctreeVolume(OctreeVolume* _octdata, Material* _matl);
             ~IsosurfaceOctreeVolume();
             
+            void newFrame(void*);
             void preprocess( PreprocessContext const &context );
             void computeBounds( PreprocessContext const &context, BBox &box 
) const;
             void intersect( RenderContext const &context, RayPacket &rays ) 
const;

Modified: branches/Manta-knolla-isohack/Model/Primitives/PrimitiveCommon.h
==============================================================================
--- branches/Manta-knolla-isohack/Model/Primitives/PrimitiveCommon.h    
(original)
+++ branches/Manta-knolla-isohack/Model/Primitives/PrimitiveCommon.h    Sat 
Oct 28 23:28:48 2006
@@ -12,6 +12,8 @@
     // Empty default constructor (used for an array of some primitive)
     PrimitiveCommon() {  };
     virtual ~PrimitiveCommon();
+    
+    virtual void newFrame(void*){};
 
     // Note that this preprocess method sets up the activeLights for the 
associated
     // material (not sure what happens for shared materials)

Modified: branches/Manta-knolla-isohack/scenes/octisovol.cc
==============================================================================
--- branches/Manta-knolla-isohack/scenes/octisovol.cc   (original)
+++ branches/Manta-knolla-isohack/scenes/octisovol.cc   Sat Oct 28 23:28:48 
2006
@@ -49,6 +49,8 @@
     double isomin = 0;
     double isomax = 255;
     double isovalue = 100;
+
+    bool heptane = false;
        
        // Parse args.i
        for (int i=0;i<args.size();++i) {
@@ -87,7 +89,10 @@
         else if (args[i] == "-isomax") {
                        if (!getDoubleArg(i, args, isomin))
                                throw IllegalArgument("octisovol -isomax 
<isomax>", i, args);
-               }           
+               }        
+        else if (args[i] == "-heptane") {
+                       heptane = true;
+               }         
         else if (args[i] == "-isovalue") {
                        if (!getDoubleArg(i, args, isovalue))
                                throw IllegalArgument("octisovol -isovalue 
<isovalue>", i, args);
@@ -105,7 +110,8 @@
                        cerr << "  -mres_levels <mres_levels>" << endl;
                        cerr << "  -isomin <isomin>" << endl;
                        cerr << "  -isomax <isomax>" << endl;
-            cerr << "  -isovalue <isovalue>" << endl;
+                        cerr << "  -heptane (lighting/matl for heptane)" << 
endl;
+                        cerr << "  -isovalue <isovalue>" << endl;
                        throw IllegalArgument( "octisovol", i, args );
                }
        }
@@ -141,12 +147,15 @@
        Manta::BBox bounds;
 
     //Material* mat1 = new Phong(Color(RGBColor(0.05f, 0.3f, 0.6f)), 
Color(RGBColor(1.f, 1.f, 1.f)), 50);    
-//#define H300
-#ifdef H300    
-    Material* mat1 = new Lambertian(Color(RGBColor(0.8f, 0.4f, 1.f)));      
//purple   
-#else
-    Material* mat1 = new Lambertian(Color(RGBColor(0.05f, 0.3f, 0.6f)));     
 //blue
-#endif
+    Material* mat1;
+
+    if (heptane)
+      //mat1 = new Lambertian(Color(RGBColor(0.8f, 0.4f, 1.f)));      
//purple 
+      mat1 = new Lambertian(Color(RGBColor(.922f, .808f, .463f)));      
//salmon     
+    else
+      //mat1 = new Lambertian(Color(RGBColor(0.05f, 0.3f, 0.6f)));      
//blue
+      mat1 = new Lambertian(Color(RGBColor(0.50f, 0.5f, 0.75f)));      
//light purple
+
     IsosurfaceOctreeVolume* iov = new IsosurfaceOctreeVolume(ov, mat1);
     bounds = iov->getBounds();
     group->add(iov);
@@ -171,22 +180,22 @@
        LightSet *lights = new LightSet();
     float ldist = 10.f * (lookat-eye).length();
 
-#ifdef H300    
-    lights->add( new PointLight( Vector(lookat + ldist*(eye - 2*up)), 
Color(RGBColor(0.8,0.8,0.8)) ) );
-#else    
-    lights->add( new PointLight( Vector(lookat + ldist*up), 
Color(RGBColor(1,1,1)) ) );
-#endif    
+    if (heptane)
+      lights->add( new PointLight( Vector(lookat + ldist*(eye - 2*up)), 
Color(RGBColor(0.8,0.8,0.8)) ) );
+    else    
+      lights->add( new PointLight( Vector(lookat + ldist*up), 
Color(RGBColor(1,1,1)) ) );
+
        lights->setAmbientLight( new ConstantAmbient( 
Color(RGBColor(0.4,0.5,0.5) ) ));
        scene->setLights(lights);
 
        
        // Background.
-#ifdef H300
-    scene->setBackground( new ConstantBackground( Color(RGB(0,0,0)) ) );
-#else    
-    scene->setBackground( new ConstantBackground( Color(RGB(.96, 0.96, 
0.97)) ) );
-#endif
+    if (heptane)
+      //scene->setBackground( new ConstantBackground( Color(RGB(0,0,0)) ) );
+      scene->setBackground( new ConstantBackground( Color(RGB(.96, 0.96, 
0.97)) ) );
+    else
+      scene->setBackground( new ConstantBackground( Color(RGB(.97, 0.96, 
0.96)) ) );
        
-       return scene;
+    return scene;
 }
 




  • [MANTA] r1229 - in branches/Manta-knolla-isohack: Core/Math Model/Primitives scenes, knolla, 10/28/2006

Archive powered by MHonArc 2.6.16.

Top of page