Using meshes

A mesh is a collection of vertices, edges, and faces that define the shape of a solid object in 3D with flat faces and straight edges and the triangles that form the surface between the points.

A mesh can have many clusters of triangles that each have their own materials.

Using primitive meshes

In Kanzi Studio you can create primitive meshes. Kanzi creates primitive meshes from a set of parameters, while it stores imported meshes in vertex buffers. The main purpose of these primitives is to use them for prototyping. A primitive mesh always has only one cluster and thus only one material.

These primitive meshes are available in Kanzi:

  • Box is a cube mesh centered in its origin.

  • Sphere is a sphere mesh centered in the origin.

  • Plane is a filled planar mesh with four vertices centered in the origin.

To use a material with a normal map texture on a primitive mesh, in the Node Tree select the primitive mesh and in the Properties enable the Generate Tangents property.

../../_images/enable-generate-tangents1.png

Using imported meshes

You can import meshes you created with third-party tools.

Use the Model node to show the imported meshes in your Kanzi application.

See Importing 3D assets.

After you import meshes to your Kanzi Studio project, Kanzi Studio stores the imported meshes in the Library > Meshes. Kanzi Studio lists the file containing the meshes in the Library > Resource Files > 3D Assets (<ProjectName>/3D Assets on the hard drive). See 3D assets.

Kanzi loads the mesh data to memory only when it needs the mesh. When you change the loaded data, Kanzi saves the changes you made to the mesh.

In Kanzi Studio you can see the mesh data only for the meshes you imported. The parameters of the primitive meshes are specified in the properties of each mesh.

Note that a limitation of OpenGL ES 2.0 without extensions forces Kanzi to split a mesh that has more than 65536 vertices into sub-meshes. Kanzi splits meshes based on the material (Shading Groups in Maya and Multimaterial in 3dsmax) to avoid unnecessary shader switches when rendering a single model. Currently Kanzi Engine supports only 16-bit indices in meshes.

Attribute mappings

Attribute mappings is a mesh property that specifies how the attributes in the mesh vertex buffer are handled when rendering the geometry. Attribute mappings map the shader attributes to vertex buffer attributes. Attributes are usually automatically deduced using the semantic of vertex attribute. For example, position attributes of a vertex buffer are mapped to position attribute of the used shader. See Shader attributes.

When using more than one texture on a single mesh, you have to manually set which texture coordinate attribute in the vertex buffer maps to which shader attribute.

Using meshes in the API

For details, see the Mesh class in the Kanzi Engine API reference.

Mesh property types

For a list of the available property types for meshes, see Mesh.

Primitive mesh property types and messages

For lists of the available property types and messages for the primitive mesh nodes, see: