Mesh Geometry¶
- The following section deals with
Object
which are of type ‘MESH’, containing Mesh Data(Mesh-Object) - Each
Object
is exported as a combination ofNiTriShape
andNiNode
. - The
Mesh
is exported to aNiTriShape
’sNiTriShapeData
.
Example:
- Start Blender and empty the scene.
- Create any Mesh-Object to the scene, eg. cube primitive:
- Give the Object an appropriate name.
- In the Object Tab
- Generic names are automatically generated, unique names helps distingush objects,
- The Nif format only supports triangle based geometry.
- Blender quads and n-gons are exported as triangles, which may lead to differences in rendered geometry.
- Strips (
NiTriStrips
) are available but not developer supported as they are unnecessary for current hardware.
Double Sided Mesh¶
- Each triangle is composed of 3 vertices, edges and a face.
- To decide which way the face is pointing a vector(normal), perpendecular to the face is used.
- This normal vector can be flipped to either side of the triangle; a common source for triangles appearing to not render.
Sometimes you want to allow the mesh to ignore the normal and render both sides, eg a cloak.
- In the Properties Editor, in the Object Data Tab
- Enable/Disable Double Sided, see notes for more detail.
- Double Sided Mesh - Adds a
NiStencilProperty
or similiar, - see Properties - Stencil Property for more info.
UV Unwrapping/Mapping¶
- UV-unwrapping is the process of unfolding all the faces onto a flat plane, see Cube Unwrap.
- The UV-unwrapping process creates a UV Map layer.
- The UV Map Layer is used to layer connect a
Texture
toMesh
and allows visual representation of where each face is located on texture. - Each
TextureSlot
requires that the user select the UV Map Layer that was generated by unwrapping, See Textures Section.
Example: #. Create a mesh-object. #. In Edit Mode, select the faces you want to unwrap. #. Press U``, select Unwrap > Smart UV Project.
Notes:
- UV-unwrapping adds a
MeshTextureFaceLayer
to the Object. - Although Blender allows multiple
MeshTextureFaceLayer
, most versions of the Nif format only support one UV layer
Vertex Color¶
Example:
- Create a mesh-object.
- Switch to Vertex Paint mode, this automatically adds a base vertex color layer.
- Apply the desired vertex colors evenly to the vertex.
- Ensure you have added a material.
Notes:
- The Nif format only supports a single color per vertex, whereas Blender vertex color per face vertex.
- Blender treats the vertex as if the faces had been split apart, each face can have a different color for that vertex.
- This image should clarify per-face vertes coloring
- On export the scripts will take an average of colors.
Vertex Alpha¶
Vertex alpha is handled in the same way as vertex color. The only difference is that vertex alpha use grey scale.
Example:
- Create a mesh-object.
- Switch to Vertex Paint mode, If there are no vertex color layers this will create a new layer.
- you will need to add a second layer manually by clicking the + button in the vertex colors control panel located in the object data menu.
- In the brush menu on the left side of the screen, leave the color selector in the center and
- use the slider on the right side to change the level of shading with white being fully visible and black being fully transparent.
- Apply the shading to the vertices just as you would for Vertex Color
Notes:
- Vertex alpha must use the second vertex color layer, even if there is no color applied in first color layer the default color layer must be in place.