Syllabus   Blank Homework   Quizzes  
Notes   Labs   Scores   Blank

Lecture Notes
Dr. Tong Lai Yu, 2010
    1. Introduction
    2. OpenGL Shading Language ( GLSL ) I
    3. GLSL II
    4. Curve and Surface Design
    5. Modeling Shapes with Polygonal Meshes
    6. Texture Mapping
    7. Casting Shadows
    8. Tools for Raster Display
    9. Parsing External Objects

    Parsing External Files

    1. Popular 3D Graphics Object File Formats

    2. 3DS - 3D Studio
    3. BLEN - BLENDER
    4. DAE - COLLADA
    5. DXF - AutoCAD
    6. LWO - Lightwave
    7. OBJ - Wavefront Technologies
    8. SKP - Google sketchup
    9. WRL - VRML
    10. See http://edutechwiki.unige.ch/en/3D_file_format

    11. Collada

      See http://collada.org

    12. Collada, short for COLLAborative Design Activity, is mananged by The Khronos Group.

    13. A royalty-free XML schema.

    14. Enables digital asset exchange within the interactive 3D industry.

    15. Supports

    16. geometry, materials, textures, lights, camera, animations, instantiations, and scenes
    17. skinning and morphing for character animation
    18. some popular shader(e.g Cg, GLSL, OpenGL ES 1.1 ... )
    19. physics properties for rigid bodies, and the associated analytical shapes, and constrained joint systems.
    20. Validate a COLLADA document against the COLLADA schema:

      • Use xmlint which is part of libxml:

        xmllint --noout --schema http://www.khronos.org/files/collada_schema_1_4 cube.dae

        or

        xmllint --noout --schema colladaSchema.xsd cube.dae

        "--noout" is used to prevent superfluous output

      • Uxe libxml in a C/C++ application:

        #include "libxml/xmlschemas.h"
        
        // libxml error handler
        void schemaErrorCallback(void*, const char* message, ...) {
          va_list varArgs;
          va_start(varArgs, message);
          vfprintf(stdout, message, varArgs);
          va_end(varArgs);
        }
        
        // libxml warning handler
        void schemaWarningCallback(void* callbackData, const char* message, ...) {
        }
        
        // Returns true if file validated successfully, false otherwise
        bool validate(const string& uri) {
          bool result = false;
          if (xmlSchemaParserCtxt* schemaParser = 
             xmlSchemaNewParserCtxt("http://www.khronos.org/files/collada_schema_1_4")) {
            if (xmlSchema* schema = xmlSchemaParse(schemaParser)) {
              if (xmlSchemaValidCtxt* validityContext = xmlSchemaNewValidCtxt(schema)) {
                xmlSchemaSetValidErrors(validityContext,
                                       schemaErrorCallback,
                                       schemaWarningCallback,
                                       /* callback data */ 0);
        
                // Returns 0 if validation succeeded
                result = xmlSchemaValidateFile(validityContext, uri.c_str(), 0) == 0;
                xmlSchemaFreeValidCtxt(validityContext);
              }
              xmlSchemaFree(schema);
            }
            xmlSchemaFreeParserCtxt(schemaParser);
          }
        
          return result;
        }
        	

    21. Reading Geometry Data

      Some Nodes:

      	1. <library geometries>:
      	This node is a library that contains geometry type nodes that define geometries in the
      	scene.
      	2. <mesh>:
      	This nodes contains the geometry data of the mesh. It usually contains a few<source>
      	child nodes that define the data of vertices, normals and texture.
      	3. <source>:
      	This node contains child nodes such as <float array> and <technique_common>
      	that define the geometry data.
      	4. <float_array>:
      	This node contains floating point for defining various attributes, which are described
      	by a sibling node of type <technique_common>.
      	5. <technique_common>:
      	This node’s <accessor> child node specifies the data usage for the arrays defined in
      	<float_array> or <Name_array>.
          
      Example:
      	<source id="example1" name="Positions">
      	  <float_array id="values" count="6"> 0.2 0.5 0.6 0.2 0.3 0.9 
      	    <technique_common>
      	      <accessor source="#values" count="2" stride="3">
      	 	<param name="X" type="float"/>
      		<param name="Y" type="float"/>
      		<param name="Z" type="float"/>
      	      </accessor>
      	    </technique_common>
      	</source>
      	
      The example shows 2 vertices, (X, Y, Z) with values (0.2, 0.5, 0.6), and (0.2, 0.3, 0.9)
    22. Blender

      See http://www.blender.org/

    23. A free open source 3D content creation suite.
    24. Used for creating animated films, visual effects, interactive 3D applications or video games.
    25. Features include 3D modeling, UV unwrapping, texturing, skinning, particle simulation, animating, rendering, video editing and compositing.

    26. Blender 2.61

    27. XML Parser

      http://xmlsoft.org/

    28. Libxml2 is the XML C parser and toolkit developed for the Gnome project.
    29. General Information

      You may download the pdf file here