SphereGeometry - Verge3D User Manual - Soft8Soft
Description: Learn how to use SphereGeometry in your interactive 3D apps made with Verge3D

BufferGeometry →

# SphereGeometry

A class for generating sphere geometries.

## Code Example

`const geometry = new v3d.SphereGeometry(3); const material = new v3d.MeshStandardMaterial({ color: 0x5b5ea6 }); const sphere = new v3d.Mesh(geometry, material); app.scene.add(sphere);`

## Constructor

### SphereGeometry(radius : Float, widthSegments : Integer, heightSegments : Integer, phiStart : Float, phiLength : Float, thetaStart : Float, thetaLength : Float)

- radius — sphere radius. Default is `1`.
- widthSegments — number of horizontal segments. Minimum value is `3`, and the default is `32`.
- heightSegments — number of vertical segments. Minimum value is `2`, and the default is `16`.
- phiStart — specify horizontal starting angle. Default is `0`.
- phiLength — specify horizontal sweep angle size. Default is 2π (`2*Math.PI`).
- thetaStart — specify vertical starting angle. Default is `0`.
- thetaLength — specify vertical sweep angle size. Default is π (`Math.PI`).

Procedural geometry is fun. However, in real life applications this feature is rarely needed. It would be more efficient do design spheres in the preferred modelling suite and export/load to Verge3D via glTF.

The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to "sphere slices") can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices.

## Properties

See the base BufferGeometry class for inherited properties.

### # .parameters : Object

An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.

## Methods

See the base BufferGeometry class for inherited methods.

## Puzzles

The create object puzzle can be used to create spheres in a code-less manner.

## Source

For more info on how to obtain the source code of this module see this page.