[name] generates instances of [page:BufferGeometry] from a Signed Distance Function Uses Mikola Lysenko's Isosurface
[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';
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
[example:webgl_geometry_sdf geometry / sdf ]
[page:WebGLRenderer renderer] -- The renderer used to render the scene.
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.
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/SDFGeometry.js examples/jsm/geometries/SDFGeometryGenerator.js]