Geodesic Polyhedra
Geodesic Polyhedron
Within Babylon.js, a geodesic polyhedron (GDP) is formed from an icosahedron base with its vertices mapped onto a sphere. An icosahedron is made of 20 faces, each a primary equilateral triangle. To form a GDP, each face is split into further equilateral triangles, forming an isometric grid. Before creating the GDP, this grid can be rotated by an angle determined by the values of two integer parameters, m and n. When n is 0, no rotation of the grid takes place, and the resulting GDP is an icosphere.
On this page we explain how to create a GDP directly. More information about GDP Mathematics and an outline of coding a GDP are available in the documentation workshop.
The format for creating a GDP closely matches that of CreatePolyhedron. A GDP can only be created with MeshBuilder.
MeshBuilder
usage :
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";const geodesic = MeshBuilder.CreateGeodesic("geodesic", options, scene); //scene is optional and defaults to the current scene| option | value | default value |
|---|---|---|
| m | (number) an integer > 0 | 1 |
| n | (number) a positive or zero integer <= m | 0 |
| size | (number) polyhedron size | 1 |
| sizeX | (number) X polyhedron size, overwrites the size property | 1 |
| sizeY | (number) Y polyhedron size, overwrites the size property | 1 |
| sizeZ | (number) Z polyhedron size, overwrites the size property | 1 |
| faceColors | (Color4[]) array of Color4, one per face | Color4(1, 1, 1, 1) for each side |
| faceUV | (Vector4[]) array of Vector4, one per face | UVs(0, 0, 1, 1) for each side |
| flat | (boolean) if false, a polyhedron has a single global face, faceUV and faceColors are ignored | true |
| updatable | (boolean) true if the mesh is updatable | false |
| sideOrientation | (number) side orientation | DEFAULTSIDE |
To understand how to set faceUV or faceColors, please read about Face Colors and Textures for a Box taking into account the right number of faces of your polyhedron.
Examples
Further reading
Icospheres
Learn how to create icospheres in Babylon.js.

Provided Polyhedra
Learn the provided polyhedra in Babylon.js.

Geodesic and Goldberg Polyhedra Code Design
The Math used to build Geodesic and Goldberg Polyhedra

Geodesic and Goldberg Polyhedra Mathematics
The Math used to build Geodesic and Goldberg Polyhedra
