OpenGL VRML Shockwave 3D
Home Tutorials Books Applications Tools Docs Models Textures

Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Box
Sphere
Cone
Cylinder
PointSet
IndexedLineSet
IndexedFaceSet
Extrusion
ElevationGrid
Example: Chessboard
Text
FontStyle
Appearance
Material
Textures
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Group
Transform
Collision
Anchor
Billboard
Switch
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Timers
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Interpolators
Color
Coordinate
Normal
Orientation
Position
Scalar
Example
Let the Music Play
Sound
AudioClip
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Background
Fog
Information about your world
WorldInfo
Definition for Auxiliary Nodes
Coordinate
Color
Normal

IndexedFaceSet Node


The IndexedFaceSet node specifies a set of planar faces in the local coordinate system.

The coord field specifies a Coordinate node. In this node a set of 3D coordinates are given.

The coordIndex field specifies a list of coordinate indexes defining the faces to be drawn. To separate the indexes from a face the marker -1 is used, i.e. an index of -1 indicates that the current face has ended and the next one begins.

Because the faces are always defined by closed polylines, you don't need to define the first point twice. Consider the following values for coord:
coord Coordinate{
point [ 0 0 0, 1 0 0, 1 1 0, 0 1 0]
}
Four points are defined, when you join the points you can make a square face. The coordIndex used for a square face could be:
coordIndex [ 0 1 2 3]
What the above coorIndex meaning is: Join the first point in the coordinate list to the second point, then join the second to the third, the third to the fourth, and finally the fourth to the first to close the region which defines the shape.

The color field defines a Color node. This node defines a list of colors to apply to the faces. The color is optional, the default values being applied if the field is not specified. If a Material node is specified the default color is the emissive color from this node. Note that both the default emissive color and background are black, so if no color is specified and the default background is used you won't be able to see the faces.

The colorIndex serves the same purpose as the coordIndex but regarding colors. IF colorIndex is not specified then coordIndex is used instead.

The colorPerVertex is a boolean field which defines how the colors are applied. The meaning is similar to the IndexedLineSet case.

texCoord specifies a TextureCoordinate node.

texCoordIndex has a similar meaning to coordIndex but applied to Textures.

There are 3 normal fields which have the same meaning than the color fields but applied to normals. The normal field defines a Normal node.

The ccw field specifies if the points which define a face are present counterclockwise, TRUE, or clockwise or unknown order, FALSE. A face has two sides and sometimes it is important to know which is the front side, and which is the back side. So let's assume you're defining a single face perpendicular to the Z axis and ccw is TRUE. If the face is defined counterclockwise then the front side is the side facing you. Otherwise the back side is facing you. If ccw is FALSE then the opposite occurs.

The solid field determines if the browser should draw both sides of a face or just the front side. VRML assumes by default, solid is TRUE that the faces in an IndexedFaceSet form a solid shape. In this case there is no need to draw the back sides of each face. If solid is FALSE then the browser will draw both sides of each face.

The convex field specifies if the faces being defined in coordIndex are convex or not. VRML can only draw convex faces. When presented with concave faces, the browser splits the face into smaller convex faces. This is a time consuming task. If you are sure that all your faces are convex then setting this field to TRUE tells the browser not to worry splitting the faces, and therefore saving time. The creaseAngle specifies an angle threshold. If two adjacent faces make an angle bigger than the creaseAngle then you'll see clearly where the two faces meet, the edge linking the two faces is sharp. Otherwise the edge linking the two faces will be smooth.

Syntax:
IndexedFaceSet {
coord NULL
coordIndex [ ]
color NULL
colorIndex [ ]
colorPerVertex TRUE
normal NULL
normalIndex [ ]
normalPerVertex TRUE
texCoord NULL
texCoordIndex [ ]
ccw TRUE
convex TRUE
solid TRUE
creaseAngle 0.0
}




Site designed and maintained by António Ramires Fernandes
Your comments, suggestions and references to further material are welcome!

Lighthouse 3D privacy statement