Tutorial: More Understanding the IndexedFaceSet (IFS)

"Tutorial: More Understanding the IndexedFaceSet (IFS) -
The ccw Flag" >Page 1, 2

The ccw Flag

The following VRML file (in it's entirety) specified a red box:

#VRML V2.0 utf8
WorldInfo {
 title "Spazz3D"
 info [
  "This VRML World brought to you by Sandy Ressler at:"
  "web3d.about.com, using Spazz3D"
 ]
}

      DEF Box1 Shape {
       appearance Appearance {
        material DEF Red_mat Material {
         ambientIntensity 0.200
         shininess 0.200
         diffuseColor 1.0 0.0 0.0
         emissiveColor 0.0 0.0 0.0
         specularColor 0.0 0.0 0.0
        }
       }
       geometry IndexedFaceSet {
        solid TRUE
	ccw	TRUE
        convex FALSE
        creaseAngle 1.047
        coord Coordinate {
         point [
          -0.50000 0.50000 -0.50000
          -0.50000 0.50000 0.50000
          0.50000 0.50000 0.50000
          0.50000 0.50000 -0.50000
          -0.50000 -0.50000 0.50000
          0.50000 -0.50000 0.50000
          0.50000 -0.50000 -0.50000
          -0.50000 -0.50000 -0.50000
         ]
        }
        coordIndex [
          0 1 2 3 
          -1 1 4 5 
          2 -1 2 5 
          6 3 -1 3 
          6 7 0 -1 
          0 7 4 1 
          -1 5 4 7 
          6 -1 
        ]
       }
      }
    
}

Notice the ccw flag is set to TRUE. The resulting VRML file create an image like:

If we change the ccw flag to FALSE. The resulting image looks really odd:

This strange oddity is because we have "incorrectly" told the VRML browser that the order of the points that make the polygons is reversed. The result is that what was once the inside is now the outside and visa versa. The odd looking cube looks odd because we can see inside of it.

The ccw flag is most useful in cases where you are starting with data produced, for example, by a CAD program or some translator software. If the faces look odd it may be that the translator produced the data in an order different that you expect and fixing it may be a matter of reversing the ccw flag.

This concludes our IFS lesson for the week, we now return you to your regularly scheduled Web browsing.

ZZZNEWSLETTERSIGNUP1ZZZ
[Tutorials] [Web3D Technology Comparison] [Virtual Humans]
[Virtual Reality] [Art] [People of Web3D]
[Panoramic Imaging] [FAQs] [Companies]

Previous Features

Previous page

>Page 1, 2