ElevationGrid Node

The ElevationGrid node specifies a grid of points, each with a used defined height. This node is useful to create meshes, see Lighting, or to build a terrain. 

An ElevationGrid is built in the XZ plane, starting from the origin and expanding in the positive direction of the axes. The shape of an ElevationGrid is defined by the following fields: 
  • xDimension: the number of points in the grid along the X axis.
  • zDimension: the number of grid points in the Z axis.
  • xSpacing: the distance between two adjacent points in the X axis direction.
  • zSpacing: the distance between two adjacent points in the Z axis direction.
  • height: a list of floating point values specifying the height for each point in the grid. The points are ordered left to right and top to bottom.



  • The other fields for this node are: 

    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 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. 

    There are 2 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 s 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: 
    ElevationGrid{ 
    xDimension 0
    xSpacing 0.0
    zDimension 0
    zSpacing 0.0
    height [ ]
    color NULL 
    colorPerVertex TRUE 
    normal NULL 
    normalPerVertex TRUE 
    texCoord NULL 
    ccw TRUE 
    convex TRUE 
    solid TRUE 
    creaseAngle 0.0
    The following figure depicts the grid built using this node using a list of heights with all elements equal to 0.0.