# Creating A Sphere

> Learn how to create a sphere in Babylon.js.

Source: https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/sphere

## Sphere

The created sphere has its origin at the center of the sphere. Using different values for _diameterX_, _diameterY_, and _diameterZ_ lets you create an ellipsoid.

## MeshBuilder

Example :

```javascript
const sphere = BABYLON.MeshBuilder.CreateSphere("sphere", options, scene); //scene is optional and defaults to the current scene
```

| option          | value                                                                 | default value      |
| --------------- | --------------------------------------------------------------------- | ------------------ |
| segments        | _(number)_ number of horizontal segments                              | 32                 |
| diameter        | _(number)_ diameter of the sphere                                     | 1                  |
| diameterX       | _(number)_ diameter on X axis, overwrites _diameter_ option           | diameter           |
| diameterY       | _(number)_ diameter on Y axis, overwrites _diameter_ option           | diameter           |
| diameterZ       | _(number)_ diameter on Z axis, overwrites _diameter_ option           | diameter           |
| arc             | _(number)_ ratio of the circumference (latitude) between 0 and 1      | 1                  |
| slice           | _(number)_ ratio of the height (longitude) between 0 and 1            | 1                  |
| updatable       | _(boolean)_ true if the mesh is updatable                             | false              |
| sideOrientation | _(number)_ side orientation                                           | DEFAULTSIDE        |
| frontUVs        | _(Vector4)_ **ONLY WHEN sideOrientation:BABYLON.Mesh.DOUBLESIDE set** | Vector4(0, 0, 1,1) |
| backUVs         | _(Vector4)_ **ONLY WHEN sideOrientation:BABYLON.Mesh.DOUBLESIDE set** | Vector4(0, 0, 1,1) |

### Examples

- [Playground: Create a Sphere](https://playground.babylonjs.com/#WIR77Z) - Simple example of creating a sphere.

- [Playground: Create an Ellipsoid](https://playground.babylonjs.com/#WIR77Z#1) - Simple example of creating an ellipsoid.

- [Playground: Create an Arc](https://playground.babylonjs.com/#WIR77Z#2) - Simple example of creating an arc.

- [Playground: Create an Arc and Slice](https://playground.babylonjs.com/#WIR77Z#3) - Simple example of creating an arc and slice.

## Mesh

Usage :

```javascript
const sphere = BABYLON.MeshBuilder.CreateSphere("sphere", { segments, diameter }, scene);
```

It is only possible to create a sphere with this method; for an ellipsoid, you need to use scaling.
