Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1765 - trunk/scenes


Chronological Thread 
  • From: arobison@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1765 - trunk/scenes
  • Date: Sun, 7 Oct 2007 14:04:08 -0600 (MDT)

Author: arobison
Date: Sun Oct  7 14:04:07 2007
New Revision: 1765

Modified:
   trunk/scenes/complexitytest.cc
   trunk/scenes/softshadow.cc
Log:
scenes/complexitytest.cc
   adding option for no instancing (-no_instances).

scenes/softshadow.cc
   adding an option to use a masking texture on the floor
   plane (-use_tex)


Modified: trunk/scenes/complexitytest.cc
==============================================================================
--- trunk/scenes/complexitytest.cc      (original)
+++ trunk/scenes/complexitytest.cc      Sun Oct  7 14:04:07 2007
@@ -44,6 +44,7 @@
 #include <Model/Groups/Group.h>
 #include <Model/Groups/Mesh.h>
 #include <Model/Groups/ObjGroup.h>
+#include <Model/Groups/GriddedGroup.h>
 #include <Model/Lights/PointLight.h>
 #include <Model/Materials/Checker.h>
 #include <Model/Materials/Dielectric.h>
@@ -142,6 +143,7 @@
   string object_type = "sphere";
   string object_material = "constant";
   string acc_struct = "DynBVH";
+  bool no_instances = false;
 
   for(size_t i = 0; i < args.size(); ++i) {
     string arg = args[i];
@@ -169,6 +171,8 @@
       acc_struct = "DynBVH";
     } else if (arg == "-CGT") {
       acc_struct = "CGT";
+    } else if (arg == "-no_instances") {
+      no_instances = true;
     } else {
       cerr << "Valid options for complexitytest:\n"
            << "  -num - number of objects to render\n"
@@ -201,6 +205,7 @@
     }
   }
 
+
   Group* group = new Group();
 
   Object* object = NULL;
@@ -229,24 +234,32 @@
   }
 
   cerr << "Generating " << num_objects << " instances...\n";
+  Material* no_instance_matl = new NullMaterial();
   for(unsigned int i = 0; i < num_objects; ++i) {
+    if(no_instances) {
+      Vector origin = Vector(drand48(), drand48(), drand48())*cube_scale;
+      Color color = Color(RGB(drand48(), drand48(), drand48()));
+      
+      group->add(new Sphere(no_instance_matl, origin, object_scale));
+
+    } else {
+      Vector origin = Vector(drand48(), drand48(), drand48())*cube_scale;
+      Vector rotation_axis = Vector(drand48(), drand48(), 
drand48()).normal();
+      Real rotation_amount = drand48()*M_PI*2.0;
+
+      Color color = Color(RGB(drand48(), drand48(), drand48()));
 
-    Vector origin = Vector(drand48(), drand48(), drand48())*cube_scale;
-    Vector rotation_axis = Vector(drand48(), drand48(), drand48()).normal();
-    Real rotation_amount = drand48()*M_PI*2.0;
-
-    Color color = Color(RGB(drand48(), drand48(), drand48()));
-
-    AffineTransform t;
-    t.initWithIdentity();
-    t.scale(Vector(object_scale, object_scale, object_scale));
-    t.rotate(rotation_axis, rotation_amount);
-    t.translate(origin);
+      AffineTransform t;
+      t.initWithIdentity();
+      t.scale(Vector(object_scale, object_scale, object_scale));
+      t.rotate(rotation_axis, rotation_amount);
+      t.translate(origin);
 
-    Instance* instance = new Instance(object, t);
-    instance->overrideMaterial( getMaterial(object_material, color) );
+      Instance* instance = new Instance(object, t);
+      instance->overrideMaterial( getMaterial(object_material, color) );
 
-    group->add(instance);
+      group->add(instance);
+    }
   }
 
 
@@ -254,6 +267,7 @@
   scene->setBackground(new LinearBackground(Color(RGB(0.2, 0.4, 0.9)),
                                             Color(RGB(0.0,0.0,0.0)),
                                             Vector(0,1,0)));
+
   AccelerationStructure* as = getAS(acc_struct);
   as->setGroup(group);
   as->rebuild();

Modified: trunk/scenes/softshadow.cc
==============================================================================
--- trunk/scenes/softshadow.cc  (original)
+++ trunk/scenes/softshadow.cc  Sun Oct  7 14:04:07 2007
@@ -95,11 +95,24 @@
 }
 
 
-void addFloor(Group* group)
+void addFloor(Group* group, bool use_tex)
 {
-  Material* white = new Lambertian(Color::white() * 0.8);
+  Material* floor_matl = NULL;
+  if(use_tex) {
+    Texture<Color>* floor_tex = new 
MarbleTexture<Color>(Color(RGB(.2,.8,.1)),
+                                                         Color(RGB(.5,.1,0)),
+                                                         30,
+                                                         2.4,
+                                                         3.1,
+                                                         5,
+                                                         3.2,
+                                                         .7);
+    floor_matl = new Lambertian(floor_tex);
+  } else {
+    floor_matl = new Lambertian(Color::white() *0.8);
+  }
 
-  Object* floor=new Rect(white,
+  Object* floor=new Rect(floor_matl,
                          Vector(-100,-100,-20),
                          Vector(320,0,0),
                          Vector(0,320,0));
@@ -153,6 +166,7 @@
 {
   int num_lights = 16;
   double width_scale= 1.0;
+  bool use_tex = false;
 
   for(size_t i = 0; i < args.size(); ++i) {
     string arg = args[i];
@@ -163,8 +177,11 @@
     } else if (arg == "-width_scale") {
       if(!getDoubleArg(i, args, width_scale))
         throw IllegalArgument("scene softshadow -width_scale", i , args);
+    } else if (arg == "-use_tex") {
+      use_tex = true;
     } else {
       cerr << "Valid options for softshadow:\n"
+           << "  -use_tex - add a masking texture to the floor\n"
            << "  -num - number of point lights\n"
            << "  -width_scale - multiplier for light width\n" ;
       throw IllegalArgument("scene complexitytest", i, args);
@@ -175,7 +192,7 @@
   Group* group = new Group();
 
   addFence(group);
-  addFloor(group);
+  addFloor(group, use_tex);
 
   Scene* scene = new Scene();
   scene->setBackground(new ConstantBackground(Color(RGB(0.1, 0.1, 0.1))));
@@ -186,8 +203,8 @@
 
   LightSet* lights = new LightSet();
   addLights(lights, num_lights, width_scale);
-  Color cup(RGB(0.5, 0.5, 0));
-  Color cdown(RGB(0.1, 0.1, 0.7));
+  Color cup(RGB(0.2, 0.2, .2));
+  Color cdown(RGB(0.2, 0.2, 0.2));
   Vector up(0,0,1);
   //  Vector up(0,1,0);
   lights->setAmbientLight(new ArcAmbient(cup, cdown, up));




  • [Manta] r1765 - trunk/scenes, arobison, 10/07/2007

Archive powered by MHonArc 2.6.16.

Top of page