Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r972 - in trunk: Model/Materials scenes


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r972 - in trunk: Model/Materials scenes
  • Date: Sat, 4 Mar 2006 23:55:21 -0700 (MST)

Author: boulos
Date: Sat Mar  4 23:55:20 2006
New Revision: 972

Added:
   trunk/Model/Materials/NDotL.cc
   trunk/Model/Materials/NDotL.h
   trunk/scenes/perf.cc
Modified:
   trunk/Model/Materials/CMakeLists.txt
   trunk/scenes/CMakeLists.txt
Log:
Adding a simpler scene for performance testing.
Adding a simpler local shading model for perf 
testing as well.


Modified: trunk/Model/Materials/CMakeLists.txt
==============================================================================
--- trunk/Model/Materials/CMakeLists.txt        (original)
+++ trunk/Model/Materials/CMakeLists.txt        Sat Mar  4 23:55:20 2006
@@ -16,6 +16,8 @@
      Materials/MaterialTable.cc
      Materials/MetalMaterial.h
      Materials/MetalMaterial.cc
+     Materials/NDotL.h
+     Materials/NDotL.cc
      Materials/Phong.h
      Materials/Phong.cc
      Materials/Transparent.cc

Added: trunk/Model/Materials/NDotL.cc
==============================================================================
--- (empty file)
+++ trunk/Model/Materials/NDotL.cc      Sat Mar  4 23:55:20 2006
@@ -0,0 +1,82 @@
+
+
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005
+  Scientific Computing and Imaging Institute, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#include <Model/Materials/NDotL.h>
+
+#include <Interface/RayPacket.h>
+#include <Interface/Context.h>
+
+#include <Model/Textures/Constant.h>
+
+using namespace Manta;
+
+
+NDotL::NDotL(const Vector& d, const Color& color) : direction(d.normal())
+{
+  colortex = new Constant<Color>(color);
+}
+
+NDotL::NDotL(const Vector& d, const Texture<Color>* colortex) : 
direction(d.normal()), colortex(colortex)
+{
+}
+
+NDotL::~NDotL()
+{
+}
+
+void NDotL::preprocess(const PreprocessContext&)
+{
+}
+
+Vector FaceForward(const Vector& N, const Vector& V)
+{
+    if (Dot(N,V) > 0)
+        return N;
+    else
+        return -N;
+}
+
+void NDotL::shade(const RenderContext& context, RayPacket& rays) const
+{
+    rays.computeNormals(context);
+    // Compute colors
+    Color colors[RayPacket::MaxSize];
+    colortex->mapValues(context, rays, colors);
+
+    // Copy the colors into the ray packet.
+    for(int i=rays.begin();i<rays.end();i++)
+    {
+        float cosine = Dot(FaceForward(rays.getNormal(i), 
rays.getDirection(i)),
+                           direction);
+        if (cosine < 0)
+            cosine = 0;
+        rays.setColor( i, colors[i] * cosine );
+    }
+}

Added: trunk/Model/Materials/NDotL.h
==============================================================================
--- (empty file)
+++ trunk/Model/Materials/NDotL.h       Sat Mar  4 23:55:20 2006
@@ -0,0 +1,56 @@
+
+#ifndef Manta_Model_NDotL_h
+#define Manta_Model_NDotL_h
+
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005
+  Scientific Computing and Imaging Institute, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#include <Core/Color/Color.h>
+#include <Core/Geometry/Vector.h>
+#include <Interface/Material.h>
+#include <Interface/Texture.h>
+
+namespace Manta
+{
+  class NDotL : public Material
+  {
+  public:
+      NDotL(const Vector& d, const Color& color);
+      NDotL(const Vector& d, const Texture<Color>* colortex);
+      virtual ~NDotL();
+
+      virtual void preprocess(const PreprocessContext&);
+      virtual void shade(const RenderContext& context, RayPacket& rays) 
const;
+
+  private:
+      const Vector& direction;
+      Texture<Color> const *colortex;
+  };
+}
+
+#endif

Modified: trunk/scenes/CMakeLists.txt
==============================================================================
--- trunk/scenes/CMakeLists.txt (original)
+++ trunk/scenes/CMakeLists.txt Sat Mar  4 23:55:20 2006
@@ -72,3 +72,8 @@
    TARGET_LINK_LIBRARIES(scene_objviewer ${MANTA_SCENE_LINK})
 ENDIF(SCENE_OBJVIEWER)
 
+SET(SCENE_PERF 0 CACHE BOOL "Perf Test Scene.")
+IF(SCENE_PERF)
+   ADD_LIBRARY(scene_perf perf.cc)
+   TARGET_LINK_LIBRARIES(scene_perf ${MANTA_SCENE_LINK})
+ENDIF(SCENE_PERF)
\ No newline at end of file

Added: trunk/scenes/perf.cc
==============================================================================
--- (empty file)
+++ trunk/scenes/perf.cc        Sat Mar  4 23:55:20 2006
@@ -0,0 +1,84 @@
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005-2006
+  Scientific Computing and Imaging Institute, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#include <Core/Color/ColorDB.h>
+#include <Core/Geometry/Vector.h>
+#include <Core/Exceptions/IllegalArgument.h>
+#include <Core/Util/Args.h>
+#include <Interface/Context.h>
+#include <Interface/LightSet.h>
+#include <Interface/MantaInterface.h>
+#include <Interface/Scene.h>
+#include <Model/Backgrounds/ConstantBackground.h>
+#include <Model/Groups/Group.h>
+#include <Model/AmbientLights/ConstantAmbient.h>
+#include <Model/Lights/PointLight.h>
+#include <Model/Materials/Lambertian.h>
+#include <Model/Materials/NDotL.h>
+#include <Model/Materials/MetalMaterial.h>
+#include <Model/Materials/Flat.h>
+#include <Model/Primitives/Sphere.h>
+#include <Model/Primitives/Triangle.h>
+#include <Model/Textures/CheckerTexture.h>
+#include <Model/Textures/NormalTexture.h>
+#include <Core/Geometry/AffineTransform.h>
+#include <Core/Util/NotFinished.h>
+
+#include <Model/MiscObjects/CuttingPlane.h>
+
+#include <sgi_stl_warnings_off.h>
+#include <iostream>
+#include <sgi_stl_warnings_on.h>
+
+#include <math.h>
+#include <string.h>
+
+using namespace Manta;
+using namespace std;
+
+extern "C"
+Scene* make_scene(const ReadContext& context, const vector<string>& args)
+{
+  Group* world = new Group();
+
+  Material* matte_yellow= new NDotL(Vector(1,1,1), Color(RGB(.78,.78,.1)));
+  Material* matte_blue  = new NDotL(Vector(1,1,1), Color(RGB(.1, .1, .78)));
+
+  // Add a simple sphere to the scene
+  world->add(new Sphere( matte_yellow, Vector(0, 0, 0), 1.0 ) );
+  world->add(new Triangle(matte_blue, 
Vector(-1,-1,-1),Vector(-1,-1,1),Vector(1,-1,1)));
+  world->add(new Triangle(matte_blue, 
Vector(1,-1,1),Vector(-1,-1,-1),Vector(1,-1,-1)));
+  Scene* scene = new Scene();
+  scene->setBackground(new 
ConstantBackground(ColorDB::getNamedColor("SkyBlue3")));
+  scene->setObject(world);
+  LightSet* lights = new LightSet();
+
+  lights->setAmbientLight(new ConstantAmbient(Color::white()));
+  scene->setLights(lights);
+  return scene;
+}




  • [MANTA] r972 - in trunk: Model/Materials scenes, boulos, 03/04/2006

Archive powered by MHonArc 2.6.16.

Top of page