Menu - Top - Home - Donate to Me

Semantic

Back to documentation index.

new Semantic()

Contains constants for assigning semantics to vertex attributes found in mesh buffers and to data that is uniform throughout a particular geometry draw call.

Members

Semantic.BITANGENT (constant)

Attribute semantic for a bitangent vector.

Semantic.COLOR (constant)

Attribute semantic for a color. In general, each color consists of three components.

Semantic.CUSTOM (constant)

Attribute semantic for custom attributes.

Semantic.JOINT (constant)

Attribute semantic for a skinning joint.

Semantic.JOINTMATRIX (constant)

Uniform semantic for a joint matrix.

Semantic.MODEL (constant)

Uniform semantic for a model matrix.

Semantic.MODELVIEW (constant)

Uniform semantic for a model-view matrix.

Semantic.MODELVIEWINVERSETRANSPOSE (constant)

Uniform semantic for the inverse of the 3x3 transpose of the model-view matrix.

Semantic.MODELVIEWPROJECTION (constant)

Uniform semantic for a model-view-projection matrix.

Semantic.NORMAL (constant)

Attribute semantic for a vertex normal.

For 3D graphics libraries to calculate a mesh buffer's lighting and shading correctly, that mesh buffer must specify normals for all its vertices.

What are normals? A normal is a set of numbers (usually three numbers) describing a particular direction. Generally, a normal's direction is perpendicular to a surface's edges, and points up and away from the surface.

Normals are important in the lighting and shading model. When light hits an object's surface, how brightly the surface will be lit depends on how directly the light points to the surface. It will be lit the most brightly if the light is directly opposite to its normal, and not at all if the light is perpendicular to the normal or in the same direction as the normal.

In general, vertex normals are 3-dimensional and are defined for a mesh buffer only if it also contains vertex positions.

Semantic.POSITION (constant)

Attribute semantic for a vertex position. In general, vertex positions are 2-dimensional or 3-dimensional.

Semantic.PROJECTION (constant)

Uniform semantic for a projection matrix.

Semantic.TANGENT (constant)

Attribute semantic for a tangent vector.

Semantic.TEXCOORD (constant)

Attribute semantic for a tuple of texture coordinates.

If a texture (array of memory units) will be applied to a mesh buffer's geometry, then texture coordinates need to be specified for each vertex in that mesh buffer. In general, a texture coordinate is one of two numbers, called U and V, that map to a specific point in the texture. Each texture coordinate ranges from 0 to 1.

In most 3D graphics pipelines, U coordinates start at the left of the texture (0) and increase to the right (1). In some graphics pipelines, such as OpenGL, V coordinates start by default at the bottom of the texture (0) and increase to the top (1), while in others, such as WebGL, Vulkan, Metal, and DirectX, V coordinates start by default at the top of the texture and increase to the bottom. Thus, for example, in OpenGL by default, texture coordinates (0, 1) indicate the top left corner of the texture, and texture coordinates (0.5, 0.5) indicate the center of the texture.

In general, texture coordinates describe 2-dimensional points. However, for such texturing tasks as mapping a square to a trapezoid, trios of 3-dimensional texture coordinates (U, V, and Z) are useful to ensure the texturing remains perspective-correct. In this case, the 3-D texture coordinates are converted to 2-D by dividing the U and V components by the Z component. In a fragment shader or pixel shader, this can look like the following code: texCoord.xy/texCoord.z.

Semantic.VIEW (constant)

Uniform semantic for a view matrix.

Semantic.VIEWINVERSE (constant)

Uniform semantic for an inverse view matrix.

Semantic.WEIGHT (constant)

Attribute semantic for a skinning weight.

Back to documentation index.