Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1522 - in trunk: Model/Groups SwigInterface


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1522 - in trunk: Model/Groups SwigInterface
  • Date: Fri, 20 Jul 2007 17:17:31 -0600 (MDT)

Author: abe
Date: Fri Jul 20 17:17:31 2007
New Revision: 1522

Modified:
   trunk/Model/Groups/ObjGroup.h
   trunk/SwigInterface/objviewer.py
Log:

Changes to objviewer.py to disable using vertex normals. There appears
to be a problem with DynBVH which causes incorrect barycentric
coordinates to be used for normal interpolation, with certain complex
models.

M    SwigInterface/objviewer.py
M    Model/Groups/ObjGroup.h


Modified: trunk/Model/Groups/ObjGroup.h
==============================================================================
--- trunk/Model/Groups/ObjGroup.h       (original)
+++ trunk/Model/Groups/ObjGroup.h       Fri Jul 20 17:17:31 2007
@@ -14,6 +14,8 @@
   public:
     ObjGroup( const char *filename ) throw (InputError);
     virtual ~ObjGroup();
+
+    void discardVertexNormals() { normal_indices.clear(); }
     
   private:
     void create_materials( Glm::GLMmodel *model );

Modified: trunk/SwigInterface/objviewer.py
==============================================================================
--- trunk/SwigInterface/objviewer.py    (original)
+++ trunk/SwigInterface/objviewer.py    Fri Jul 20 17:17:31 2007
@@ -38,6 +38,7 @@
 from pycallback import *
 
 filename = ""
+ignore_vn = False
 
 # Re-create the default scene using the example texture.
 def initialize_scene( frame, engine ):
@@ -48,7 +49,7 @@
 
     # Load an obj file
     
-    global filename
+    global filename, ignore_vn
     print "File: " + filename
     
     try:
@@ -56,6 +57,10 @@
     except InputError,e:
         print "Error: " + e.message()
         exit(1)
+
+    # Turn off vertex normals (code appears broken in some models)
+    if (ignore_vn):
+        obj.discardVertexNormals();
         
     # Create a bvh.
     bvh = manta_new( DynBVH() )
@@ -79,6 +84,7 @@
     print "Where options contains one or more of:"
     print "-n --np=<threads>"
     print "-f --file=<filename"
+    print "   --ignore_vn   Ignore vertex normals in file."
 
 def main():
 
@@ -88,13 +94,13 @@
     # Parse command line options. Note these have to conform to getopt
     # So -np would be parsed as -n <space> p. Use --np=<threads> instead.
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["np=","file="] )
+        opts, args = getopt.getopt(sys.argv[1:], "n:f:", 
["np=","file=","ignore_vn"] )
 
     except getopt.GetoptError:
         usage()
         sys.exit(2)
 
-    global filename
+    global filename, ignore_vn
         
     for o, a in opts:
         if o in ("-n", "--np"):
@@ -106,6 +112,8 @@
                 
         if o in ("-f", "--file"):
             filename = a
+        if o in ("--ignore_vn"):
+            ignore_vn = True;
 
         # Add additional command line args here.
         




  • [MANTA] r1522 - in trunk: Model/Groups SwigInterface, abe, 07/20/2007

Archive powered by MHonArc 2.6.16.

Top of page