Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1341 - in trunk: Engine/Shadows Interface Model/Readers/glm scenes


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1341 - in trunk: Engine/Shadows Interface Model/Readers/glm scenes
  • Date: Thu, 12 Apr 2007 16:44:54 -0600 (MDT)

Author: bigler
Date: Thu Apr 12 16:44:53 2007
New Revision: 1341

Modified:
   trunk/Engine/Shadows/HardShadows.cc
   trunk/Interface/RayPacket.h
   trunk/Model/Readers/glm/glm.cc
   trunk/Model/Readers/glm/glm.h
   trunk/scenes/objviewer.cc
Log:

Engine/Shadows/HardShadows.cc

  Use RayPacket::rayIsMasked instead of looking at the material
  pointer directly.

Interface/RayPacket.h

  Since the ray mask is set via SSE as well, it should match for both
  32 and 64 bit versions.

  Added rayIsMasked function.

Model/Readers/glm/glm.cc
Model/Readers/glm/glm.h

  Added reflectivity extension.
  
scenes/objviewer.cc

  Added option to use ArcAmbient ambient term.  Doesn't look too
  different with a headlight light. ;)


Modified: trunk/Engine/Shadows/HardShadows.cc
==============================================================================
--- trunk/Engine/Shadows/HardShadows.cc (original)
+++ trunk/Engine/Shadows/HardShadows.cc Thu Apr 12 16:44:53 2007
@@ -232,7 +232,7 @@
         for(int i = shadowRays.begin();i<shadowRays.end();){
           int end = i+1;
           const Material* hit_matl = shadowRays.getHitMaterial(i);
-          if(shadowRays.wasHit(i) && hit_matl != (Material*)0xffffffff){
+          if(shadowRays.wasHit(i) && !shadowRays.rayIsMasked(i)){
             anyHit = true;
             rayAttenudated[i] = true;
             while(end < shadowRays.end() && shadowRays.wasHit(end) &&

Modified: trunk/Interface/RayPacket.h
==============================================================================
--- trunk/Interface/RayPacket.h (original)
+++ trunk/Interface/RayPacket.h Thu Apr 12 16:44:53 2007
@@ -426,8 +426,19 @@
       data->minT[which] = maxt;
     }
     void maskRay(int which) {
+#ifdef __x86_64
+      data->hitMatl[which] = (Material*)0xffffffffffffffff;
+#else
       data->hitMatl[which] = (Material*)0xffffffff;
+#endif
       data->minT[which] = -MAXT;
+    }
+    inline bool rayIsMasked(int which) {
+#ifdef __x86_64
+      return data->hitMatl[which] == (Material*)0xffffffffffffffff;
+#else
+      return data->hitMatl[which] == (Material*)0xffffffff;
+#endif
     }
     Real &getMinT(int which) const
     {

Modified: trunk/Model/Readers/glm/glm.cc
==============================================================================
--- trunk/Model/Readers/glm/glm.cc      (original)
+++ trunk/Model/Readers/glm/glm.cc      Thu Apr 12 16:44:53 2007
@@ -330,6 +330,7 @@
       model->materials[i].refraction = 1;
       model->materials[i].alpha      = 1;
       model->materials[i].shader     = GLM_FLAT_SHADE;
+      model->materials[i].reflectivity = 0;
     
       model->materials[i].diffuse[0] = 0.8;
       model->materials[i].diffuse[1] = 0.8;
@@ -387,6 +388,9 @@
         break;
       case 'i': // illum
         fscanf(file, "%d", &model->materials[nummaterials].shader);
+        break;
+      case 'r': // reflectivity
+        fscanf(file, "%f", &model->materials[nummaterials].reflectivity);
         break;
       case 'm':
         {

Modified: trunk/Model/Readers/glm/glm.h
==============================================================================
--- trunk/Model/Readers/glm/glm.h       (original)
+++ trunk/Model/Readers/glm/glm.h       Thu Apr 12 16:44:53 2007
@@ -52,6 +52,7 @@
                float shininess;                          // Ns specular 
exponent
     float refraction;       // Tr
     float alpha;            // d
+    float reflectivity;     // reflection
     int   shader;           // illum
 
     // Texture maps, zero length if not specified.

Modified: trunk/scenes/objviewer.cc
==============================================================================
--- trunk/scenes/objviewer.cc   (original)
+++ trunk/scenes/objviewer.cc   Thu Apr 12 16:44:53 2007
@@ -58,6 +58,7 @@
 #include <Model/Groups/GriddedGroup.h>
 #include <Model/Lights/HeadLight.h>
 #include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/AmbientLights/ArcAmbient.h>
 #include <Model/Backgrounds/ConstantBackground.h>
 #include <Model/Readers/glm/glm.h>
 #include <Model/Textures/CheckerTexture.h>
@@ -102,6 +103,7 @@
 bool bilinear_textures   = false;
 bool useTextureCoords    = false;
 bool debug               = false;
+bool use_arc_ambient     = false;
 
 enum {
     RealisticBvh_Build,
@@ -183,6 +185,9 @@
         else if (args[i] == "-debug") {
             debug = true;
         }
+        else if (args[i] == "-arc-amb") {
+          use_arc_ambient = true;
+        }
     }
 
     
///////////////////////////////////////////////////////////////////////////
@@ -234,8 +239,14 @@
 
     // Add a head light.
     LightSet *lights = new LightSet();
-    lights->add( new HeadLight( 0.0, Color(RGB(1.0,1.0,1.0)) ));
-    lights->setAmbientLight( new ConstantAmbient( Color(RGB(0.4,0.4,0.4) ) 
));
+    lights->add( new HeadLight( 1.0, Color(RGB(1.0,1.0,1.0)) ));
+    if (use_arc_ambient) {
+      lights->setAmbientLight( new ArcAmbient( Color(RGB(0.4,0.4,0.5)),
+                                               Color(RGB(0.1,0.1,0.1)),
+                                               Vector(0,1,0) ));
+    } else {
+      lights->setAmbientLight( new ConstantAmbient( Color(RGB(0.4,0.4,0.4) ) 
));
+    }
     scene->setLights( lights );
 
     Material* red=new Lambertian(Color(RGBColor(.6,0,0)));
@@ -334,6 +345,7 @@
         
//////////////////////////////////////////////////////////////////////
         // Copy out material attributes.
         string mtl_name(model->materials[i].name);
+        std::cerr << "Name ("<<mtl_name<<") ";
 
         // Color ambient (RGB( model->materials[i].ambient[0],
         //                     model->materials[i].ambient[1],
@@ -349,6 +361,7 @@
         float Ns     = model->materials[i].shininess;
         float Tr     = model->materials[i].refraction;
         float alpha  = model->materials[i].alpha;
+        float reflectivity = model->materials[i].reflectivity;
         int   shader = model->materials[i].shader;
 
         // Copy out texture names.
@@ -388,7 +401,8 @@
 
             // Create a dielectric shader.
             // material_array[index] = new Dielectric( n, nt, diffuse_map );
-            material_array[index] = new Dielectric(1.6, 1.0, Color(RGB(.9, 
.8, .8)));
+            //material_array[index] = new Dielectric(1.0, 1.0, Color(RGB(.9, 
.8, .8)));
+            material_array[index] = new Dielectric(new 
Constant<ColorComponent>(1), new Constant<ColorComponent>(1), diffuse_map);
 
         }
 
@@ -400,7 +414,7 @@
 
             Texture<Color> *diffuse_map  = check_for_texture( model_path, 
diffuse_map_name, diffuse, diffuse_map_scaling );
             Texture<Color> *specular_map = check_for_texture( model_path, 
specular_map_name, specular, specular_map_scaling );
-            Texture<ColorComponent> *reflection = new 
Constant<ColorComponent>( 0.0 );
+            Texture<ColorComponent> *reflection = new 
Constant<ColorComponent>( reflectivity );
 
             // Phong shader.
             material_array[index] = new Phong( diffuse_map, specular_map,




  • [MANTA] r1341 - in trunk: Engine/Shadows Interface Model/Readers/glm scenes, bigler, 04/12/2007

Archive powered by MHonArc 2.6.16.

Top of page