# [name]

[name] generates instances of [page:BufferGeometry] from a Signed Distance Function Uses Mikola Lysenko's Isosurface

## Import

[name] is an add-on, and must be imported explicitly. See [link:#manual/introduction/Installation Installation / Addons].

`import { SDFGeometryGenerator } from 'three/addons/geometries/SDFGeometryGenerator.js';`

## Code Example

`const generator = new SDFGeometryGenerator( renderer ); const sdf = 'float dist( vec3 p ){ return length(p) - 0.5; }' // glsl const geometry = generator.generate( 64, sdf, 1 ); // ~> THREE.BufferGeometry`

## Examples

[example:webgl_geometry_sdf geometry / sdf ]

## Constructor

### [name]( [param:WebGLRenderer renderer] )

[page:WebGLRenderer renderer] -- The renderer used to render the scene.

## Methods

### [method:BufferGeometry generate]( [param:Int resolution], [param:String distanceField], [param:Int bounds] )

resolution - Int [ mandatory ] Amount of 'voxels' used for triangulation. Must be power of 2.
Gets heavy after 256, most machines won't be able to process over 512. Defaults to 64.

distanceField - String [ mandatory ] String with glsl distance function. Name of function must be 'dist', with a vec3 argument. ( see code above ). Defaults to a sphere distance.

bounds - Int [ optional ] Bounds in which signed distance field will be evaluated. Defaults to 1.

## Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/SDFGeometry.js examples/jsm/geometries/SDFGeometryGenerator.js]