Vertex

From ActiveWiki
Revision as of 08:37, 12 February 2019 by Chris (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Usage

    Vertex x y z  [normal nx ny nx] [UV uv] [prelight r g b] 

Note: [ ] denotes optional arguments.

Note: Vertex and VertexExt commands are equivalent and may be used interchangeably.

Description

This command creates a new vertex and adds it to the current clump under construction. The vertex can have optional additional parameters.

The position of the vertex is transformed by the transformation matrix currently in effect.

Argument

x y z specifies the 3D coordinates of the vertices.

normal nx ny nx specifies the normal at this point. Pre-calculated normals may be used for special light effects, and safe time loading the geometry and calculating standard normals.

uv specifies the texture coordinates for this vertice. uv coordinates determine how textures applied to the object are mapped to each particular vertice. A vertice without a uv value will take on the color of the current clump.

prelight r g b specifies a pre-lit color to be used as a starting point at this vertice before lighting is calculated by the browser. Pre-lit colors allow for very subtle control over the effects of lighting on an object. The values for color components should be specified in the range 0.0 to 1.0. r is the red value, g is the green value, and b is the blue value.

Once a vertice in a clump has been assigned a prelight color, all vertices in that clump become pre-lit as well. If prelight has not been specified on the other vertices, they default to the last previously specified prelight value on that clump (or 0.0 0.0 0.0 if no previous prelight has been specified). This can be useful for assigning multiple sequential vertices the same prelight value without having to individually specify a prelight value for each vertex.

The normal and the prelight options are Activeworlds specific extensions to the RenderWare eXchange format and can be prefaced with #! in case the RWX file is intended to work with other software.

Examples

Vertex Example

Vertex usage using UV coordinates:

 ModelBegin
  ClumpBegin
   Surface 0.7 0.9 0.0
   Color 0.5882 0.5882 0.5882
   LightSampling Vertex
   Texture rock001
   Vertex -0.5 0 0.5 UV 0 1.0 #1
   Vertex -0.5 0 0 UV 0 0.5 #2
   Vertex -0.5 0 -0.5 UV 0 0 #3
   Vertex 0 0 0.5 UV 0.5 1.0 #4
   Vertex 0 0 0 UV 0.5 0.5 #5
   Vertex 0 0 -0.5 UV 0.5 0 #6
   Vertex 0.5 0 0.5 UV 1.0 1.0 #7
   Vertex 0.5 0 0 UV 1.0 0.5 #8
   Vertex 0.5 0 -0.5 UV 1.0 0 #9
   Triangle 2 1 5
   Triangle 4 5 1
   Triangle 5 4 8
   Triangle 7 8 4
   Triangle 3 2 6
   Triangle 5 6 2
   Triangle 6 5 9
   Triangle 8 9 5
  ClumpEnd
 ModelEnd

Alternate way using prototypes to create the exact same object:

 ModelBegin
  ProtoBegin walkway
   Ambient 0.7
   Diffuse 0.9
   Color 0.5882 0.5882 0.5882
   LightSampling Vertex
   Texture wrock001
   Vertex -0.5 0 0.5 UV 0 1.0 #1
   Vertex -0.5 0 0 UV 0 0.5 #2
   Vertex -0.5 0 -0.5 UV 0 0 #3
   Vertex 0 0 0.5 UV 0.5 1.0 #4
   Vertex 0 0 0 UV 0.5 0.5 #5
   Vertex 0 0 -0.5 UV 0.5 0 #6
   Vertex 0.5 0 0.5 UV 1.0 1.0 #7
   Vertex 0.5 0 0 UV 1.0 0.5 #8
   Vertex 0.5 0 -0.5 UV 1.0 0 #9
   Triangle 2 1 5
   Triangle 4 5 1
   Triangle 5 4 8
   Triangle 7 8 4
   Triangle 3 2 6
   Triangle 5 6 2
   Triangle 6 5 9
   Triangle 8 9 5
  ProtoEnd
  ClumpBegin
   ProtoInstance walkway
  ClumpEnd
 ModelEnd

resulting in

Prelight Example 1

The following example is the same as the previous object except that we have changed the comment(#) on the 5th Vertex command to add a prelight with a red value of 0.9. On the 6th Vertex command we added a prelight command that changes it back to default values so that the prelight does not leak into another vertice.

 ModelBegin
  ClumpBegin
   Surface 0.7 0.9 0.0
   Color 0.5882 0.5882 0.5882
   LightSampling Vertex
   Texture rock001
   Vertex -0.5 0 0.5 UV 0 1.0 #1
   Vertex -0.5 0 0 UV 0 0.5 #2
   Vertex -0.5 0 -0.5 UV 0 0 #3
   Vertex 0 0 0.5 UV 0.5 1.0 #4
   Vertex 0 0 0 UV 0.5 0.5 #!prelight .9 0 0
   Vertex 0 0 -0.5 UV 0.5 0 #!prelight 0 0 0
   Vertex 0.5 0 0.5 UV 1.0 1.0 #7
   Vertex 0.5 0 0 UV 1.0 0.5 #8
   Vertex 0.5 0 -0.5 UV 1.0 0 #9
   Triangle 2 1 5
   Triangle 4 5 1
   Triangle 5 4 8
   Triangle 7 8 4
   Triangle 3 2 6
   Triangle 5 6 2
   Triangle 6 5 9
   Triangle 8 9 5
  ClumpEnd
 ModelEnd

resulting in

Prelight Example 2

The following example is the same as the first object except that we have changed the comment(#) on the 1st Vertex command to add prelight values of 1 to all three colors to create white. On the 2nd Vertex command we added a prelight command that changes it back to default values so that the prelight does not leak into the next vertice.

 ModelBegin
  ClumpBegin
   Surface 0.7 0.9 0.0
   Color 0.5882 0.5882 0.5882
   LightSampling Vertex
   Texture rock001
   Vertex -0.5 0 0.5 UV 0 1.0 #!prelight 1 1 1
   Vertex -0.5 0 0 UV 0 0.5 #!prelight 0 0 0
   Vertex -0.5 0 -0.5 UV 0 0 #3
   Vertex 0 0 0.5 UV 0.5 1.0 #4
   Vertex 0 0 0 UV 0.5 0.5 #5
   Vertex 0 0 -0.5 UV 0.5 0 #6
   Vertex 0.5 0 0.5 UV 1.0 1.0 #7
   Vertex 0.5 0 0 UV 1.0 0.5 #8
   Vertex 0.5 0 -0.5 UV 1.0 0 #9
   Triangle 2 1 5
   Triangle 4 5 1
   Triangle 5 4 8
   Triangle 7 8 4
   Triangle 3 2 6
   Triangle 5 6 2
   Triangle 6 5 9
   Triangle 8 9 5
  ClumpEnd
 ModelEnd

resulting in

Prelight Example 3

The following example is the same as the first object except that we have changed the comment(#) on the 6th Vertex command to add prelight values of 1 to all three colors to create white. We did not add any additional prelight commands, so each Vertex command after the 6th vertice will also be pre-lit with the color white.

 ModelBegin
  ClumpBegin
   Surface 0.7 0.9 0.0
   Color 0.5882 0.5882 0.5882
   LightSampling Vertex
   Texture rock001
   Vertex -0.5 0 0.5 UV 0 1.0 #1
   Vertex -0.5 0 0 UV 0 0.5 #2
   Vertex -0.5 0 -0.5 UV 0 0 #3
   Vertex 0 0 0.5 UV 0.5 1.0 #4
   Vertex 0 0 0 UV 0.5 0.5 #5
   Vertex 0 0 -0.5 UV 0.5 0 #!prelight 1 1 1
   Vertex 0.5 0 0.5 UV 1.0 1.0 #7
   Vertex 0.5 0 0 UV 1.0 0.5 #8
   Vertex 0.5 0 -0.5 UV 1.0 0 #9
   Triangle 2 1 5
   Triangle 4 5 1
   Triangle 5 4 8
   Triangle 7 8 4
   Triangle 3 2 6
   Triangle 5 6 2
   Triangle 6 5 9
   Triangle 8 9 5
  ClumpEnd
 ModelEnd

resulting in