Methods
(static) cube(options)
Shortcut for a simple cube .obj model
Parameters:
Name
Type
Description
options
object
Model options
Properties
Name
Type
Attributes
Description
position
vec3
Position
rotation
vec3
<optional>
Rotation per axis in radians.
scale
vec3
|
number
<optional>
A vec3 representing scale per axis or a single number by which to scale all directions with.
smoothShading
bool
<optional>
If true use smooth shading instead of flat. Defaults to true.
doubleSided
bool
<optional>
Shade both sides of each triangle (you probably want this if your model has "holes"). Defaults to false.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
displacementMap
module:textures~geometryNormalMap
<optional>
A texture used as a normal map for the geometry.
Source:
(static) diamond(options)
Shortcut for a diamond .obj model
Parameters:
Name
Type
Description
options
object
Model options
Properties
Name
Type
Attributes
Description
position
vec3
Position
rotation
vec3
<optional>
Rotation per axis in radians.
scale
vec3
|
number
<optional>
A vec3 representing scale per axis or a single number by which to scale all directions with.
smoothShading
bool
<optional>
If true use smooth shading instead of flat. Defaults to true.
doubleSided
bool
<optional>
Shade both sides of each triangle (you probably want this if your model has "holes"). Defaults to false.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
displacementMap
module:textures~geometryNormalMap
<optional>
A texture used as a normal map for the geometry.
Source:
(static) objModel(options)
Wavefront .obj model geometry (no MTL support!)
Parameters:
Name
Type
Description
options
object
Model options
Properties
Name
Type
Attributes
Description
url
string
Model url
position
vec3
Position
rotation
vec3
<optional>
Rotation per axis in radians.
scale
vec3
|
number
<optional>
A vec3 representing scale per axis or a single number by which to scale all directions with.
smoothShading
bool
<optional>
If true use smooth shading instead of flat.
doubleSided
bool
<optional>
Shade both sides of each triangle (you probably want this if your model has "holes"). Defaults to false.
flipNormals
bool
<optional>
Flip model normals
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
displacementMap
module:textures~geometryNormalMap
<optional>
A texture used as a normal map for the geometry.
Source:
(static) plane(options)
Shortcut for a simple plane .obj model
Parameters:
Name
Type
Description
options
object
Model options
Properties
Name
Type
Attributes
Description
position
vec3
Position
rotation
vec3
<optional>
Rotation per axis in radians.
scale
vec3
|
number
<optional>
A vec3 representing scale per axis or a single number by which to scale all directions with.
smoothShading
bool
<optional>
If true use smooth shading instead of flat. Defaults to true.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
doubleSided
bool
<optional>
Shade both sides of each triangle (you probably want this if your model has "holes"). Defaults to false.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
displacementMap
module:textures~geometryNormalMap
<optional>
A texture used as a normal map for the geometry.
Source:
(static) sdf(domainopt , sdfData)
SDF geometry wrapper. All sdf geometries & operations need to be wrapped by this function call.
Parameters:
Name
Type
Attributes
Description
domain
domain
<optional>
Optional domain operation to apply to the whole final geometry
sdfData
sdfGeometry
|
sdfOperation
An sdf geometry or sdf operation consisting of multiple geometries.
Source:
Examples
geometries = [
sdf(
sdfSphere({
material: 'mat1',
radius: 2,
position: {x: 0, y: 0, z: 0}
})
),
// ...
];
geometries = [
sdf(
sdfSphere({
radius: 2,
material: 'mat1'
position: {x: 0, y: 0, z: 0}
})
|> opUnionRound(({radius: 0.5}), #,
sdfBox({
dimensions: {
x: 2,
y: 3,
z: 1,
},
position: {x: 1, y: 0, z: 4},
material: 'mat1'
})
)
),
// ...
];
(static) sdfBox(options)
SDF box geometry
Parameters:
Name
Type
Description
options
object
Box options
Properties
Name
Type
Attributes
Description
position
vec3
Position
dimensions
vec3
Box dimensions
rotation
vec3
<optional>
Box rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfCapsule(options)
SDF capsule geometry
Parameters:
Name
Type
Description
options
object
Capsule options
Properties
Name
Type
Attributes
Description
position
vec3
Position
radius
number
Capsule radius
height
number
Capsule height
rotation
vec3
<optional>
Capsule rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfCone(options)
SDF cone geometry
Parameters:
Name
Type
Description
options
object
Cone options
Properties
Name
Type
Attributes
Description
position
vec3
Position
radius
number
Cone radius
height
number
Cone height
rotation
vec3
<optional>
Cone rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfCylinder(options)
SDF cylinder geometry
Parameters:
Name
Type
Description
options
object
Cylinder options
Properties
Name
Type
Attributes
Description
position
vec3
Position
radius
number
Cylinder radius
height
number
Cylinder height
rotation
vec3
<optional>
Cylinder rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfEllipsoid(options)
SDF ellipsoid geometry
Parameters:
Name
Type
Description
options
object
Ellipsoid options
Properties
Name
Type
Attributes
Description
position
vec3
Position
radius
vec3
Ellipsoid radii per axis
rotation
vec3
<optional>
Ellipsoid rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfLine(options)
SDF line segment between two points
Parameters:
Name
Type
Description
options
object
Line options
Properties
Name
Type
Attributes
Description
position
vec3
Position
start
vec3
Line starting point
end
vec3
Line end point
thickness
number
The thickness of the line
rotation
vec3
<optional>
Pyramid rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfLink(options)
SDF chain link geometry
Parameters:
Name
Type
Description
options
object
Chain link options
Properties
Name
Type
Attributes
Description
position
vec3
Position
radius
number
Chain link end radius
height
number
Chain link height
thickness
number
The thickness of the link
rotation
vec3
<optional>
Capsule rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfPyramid(options)
SDF pyramid geometry
Parameters:
Name
Type
Description
options
object
Pyramid options
Properties
Name
Type
Attributes
Description
position
vec3
Position
base
number
Pyramid bottom base dimension
height
number
Pyramid height
rotation
vec3
<optional>
Pyramid rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfRoundedCone(options)
SDF cone geometry
Parameters:
Name
Type
Description
options
object
Cone options
Properties
Name
Type
Attributes
Description
position
vec3
Position
bottomRadius
number
Cone bottom radius
topRadius
number
Cone radius
height
number
Cone height
rotation
vec3
<optional>
Cone rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfSphere(options)
SDF sphere geometry
Parameters:
Name
Type
Description
options
object
Sphere options
Properties
Name
Type
Attributes
Description
radius
number
The sphere radius
position
vec3
Position
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sdfTorus(options)
SDF torus geometry
Parameters:
Name
Type
Description
options
object
Torus options
Properties
Name
Type
Attributes
Description
position
vec3
Position
innerRadius
number
Torus inner radius
outerRadius
number
Torus outer radius
rotation
vec3
<optional>
Torus rotation per axis in radians.
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
domain
module:geometries~domain
<optional>
A domain operation that should be applied on this geometry.
displacementMap
module:textures~geometryDisplacementMap
<optional>
A texture used as a displacement map for the geometry.
displacementFunc
string
<optional>
The name of a in this scene defined displacement func to use as displacement data.
Source:
(static) sphere(options)
A sphere geometry
Parameters:
Name
Type
Description
options
object
Sphere options
Properties
Name
Type
Attributes
Description
position
vec3
Position
radius
number
Sphere radius
material
string
The name of the material to use. If omitted the geometry will default to the first declared material.
texture
module:textures~geometryTexture
<optional>
A texture to apply on the geometry. Textures on SDF geometries are applied using triplanar mapping.
displacementMap
module:textures~geometryNormalMap
<optional>
A texture used as a normal map for the geometry.
Source:
(static) volume(options)
Parameters:
Name
Type
Description
options
object
Volume options
Properties
Source:
Examples
volume({
material: 'iso-volume',
minCoords: {
x: 0,
y: 0,
z: 0
},
maxCoords: {
x: 20,
y: 20,
z: 20
},
});
volume({
material: 'aniso-volume-material',
texture: 'volume-texture',
minCoords: {
x: -155,
y: 0.0,
z: -155
},
maxCoords: {
x: 155,
y: 80.0,
z: 155
}
});
Type Definitions
domain :object
Properties:
Name
Type
Attributes
Description
domainOp
'repeat'
|
'repeatBounded'
|
'bend'
|
'twist'
Operation type
size
number
Size of the side of the cube of space to apply the operation on if repeating. The magnitude of the operation otherwise.
bounds
vec3
<optional>
NOTE: only required for bounded repetitions. Number of repetitions along each axis. Should be renamed :)
axis
'x'
|
'y'
|
'z'
|
'xy'
|
'xz'
|
'yz'
|
'xyz'
<optional>
NOTE: only required for repeat operations. Along which axes to repeat.
Source: