##Ribbons in Detail By looking in detail a clearer understanding can be gained.
The ribbon is a very simple and versatile shape. As it is very elementary, you can model almost any shape using a ribbon or many merged ribbons. It is formed using one or more paths. A path is simply an array of at least two points Vector3 points (four points if you provide a single path).
Below shows the construction of a ribbon using two paths A and B each having five points.
##Length of Paths
It's not mandatory that all the ribbon paths have the same length, but it is not recommended.
The best way to emulate different lengths for some parts of your mesh is then to simply use many ribbons.
In this example -
##Single Path Ribbon
First construct the single path. Single Path to be Used for Ribbon -
Now create the ribbon around this path. Ribbon from Single Path -
Since the offset is set to 20 the ribbon is created by joining each point p in the path array to the point p + 20, where
point p + 20 exists. Changing the offset results in different ribbons. The above Ribbon with offset set to 5 -
##Closed shapes : normals or textures ?
The ribbon mesh provides two ways to automatically close an unclosed shape.
Start with an unclosed ribbon -
var ribbon = BABYLON.MeshBuilder.CreateRibbon("ribbon", { pathArray: paths }, scene );
The same closed ribbon with closeArray set to true -
var ribbon = BABYLON.MeshBuilder.CreateRibbon("ribbon", { pathArray: paths, closeArray: true }, scene );
Notice that the texture isn't stretched on the surface added by the automatic closing but applied independently. The reason of this behavior is that, with ribbon closeXXX parameters, priority is given on normals (the tools that compute light reflection) over textures. If you don't care about continuous light reflection but you do want your texture to be stretched along the whole surface, you just have to forget automatic closing and close the ribbon by yourself. A simple way to do this is just to re-push the first path at the end of the pathArray
paths.push(paths[0]);
var ribbon = BABYLON.MeshBuilder.CreateRibbon("ribbon", { pathArray: paths }, scene );
The same rules and workarounds apply to the closePath parameter.
Example with closePath set to true -
Parametric Shapes Polyhedra Shapes