Meshes

Meshes are a subclass of objects. Meshes are different from objects of the other types in a sense that they have geometric structure that is visible in the scene. All objects user can see in a scene are either meshes or converted to meshes on export (like the CURVE, TEXT, METABALL and SURFACE type objects).

Blend4Web addon has several tools for mesh editing, including the normal editor.

This chapter provides an overview of the MESH type object parameters and settings, as well as the API functions to work with them.

Static and Dynamic Meshes

All MESH objects can be divided into static and dynamic.

Static meshes are meshes that can be merged together if they have the same material.

Dynamic meshes are meshes that cannot be combined with each other.

Merging of static meshes - so called batching - is performed automatically when the scene is loaded in order to optimize the number of draw calls. The conversion is performed even if there is just one object in the scene. The center of the resulting mesh is located in the origin.

Meshes that have animation, physics or a parent, which is a dynamic object, are considered dynamic.

Settings

Meshes have all settings of the objects and several additional settings.

Override Bounding Volumes

This section is used to override bounding volumes. Such volumes are used to check object’s visibility, to handle collisions and physics interaction. By editing them, you can achieve various effects.

_images/meshes_override_bounding_volumes.png

The Override Bounding Volumes section can be found on the Blend4Web panel (beside the normals editor.).

Show Boundings

_images/meshes_show_boundings.png

Show the bounding volumes in the Blender viewport. This option works only if the Override Mesh Boundings parameter is enabled. The volume can be rendered as a rectangular cuboid or as a combination of circles or ellipses. More than one method of rendering can be active at the same time (even all three methods can be enabled simultaneously).

Note

The selected rendering method does not affect the bounding volume shape, only the way it is represented in the viewport.


Override Mesh Boundings

_images/meshes_override_mesh_boundings.png

This button enables the override of the basic mesh boundings. The bounding volume always has the shape of a rectangular cuboid with a center in the object’s pivot point.

MinX and MaxX
The volume’s X dimensions. By default, MinX = -1, MaxX = 1
MinY and MaxY
The volume’s Y dimensions. By default, MinY = -1, MaxY = 1.
MinZ and MaxZ
The volume’s Z dimensions. By default, MinZ = -1, MaxZ = 1

Morphing

Morph targets can be added using Blender’s standard Mesh > Shape keys interface.

_images/meshes_morphing.png

The engine supports all shape key options under the “Relative” type.

To set a shape key value, use the apply_shape_key method of the geometry.js module.

Note

The object must have Export Shape Keys parameter enabled.

// ...
var obj = m_scenes.get_object_by_name("Object");
m_geometry.apply_shape_key(obj, "Key 1", 0.5);
// ...