Global

Methods

scene(scene)

The main scene call
Parameters:
Name Type Description
scene sceneDescription The scene declaration
Source:

Type Definitions

camera :object

Camera settings for the scene. Note that camera position is auto updated in real time mode.
Properties:
Name Type Description
lookFrom vec3 Camera position
lookAt vec3 Position camera is pointing at
vfov number Vertical field of view in degress
aperturre number Apterture
velocity number Camera movement velocity in real time mode
Source:

rendererSettings :object

Renderer settings for the scene
Properties:
Name Type Attributes Default Description
renderMode 'raytrace' | 'sdf' <optional>
'raytrace' Render scene using raytracing or a much more performant (but visually crass) "sdf render mode"
hitDepth number <optional>
4 Number of raytraced bounces when raytracing a static image
realtimeHitDepth number <optional>
2 Number of raytraced bounces when raytracing in real time
tMax number <optional>
5000 Maxiumum hit T for the raytracing renderer
maxSphereTracingStep number <optional>
255 Max no. of steps for raymarched geometries
resolution number <optional>
0.5 Renderer resolution before scale up. "0.5" means the resolution will be 50% of browser viewport (and thus will be scaled up 50% in the app)
Source:

sceneDescription :object

The main scene object / declaration
Properties:
Name Type Attributes Description
rendererSettings rendererSettings <optional>
Renderer settings
camera camera <optional>
Camera settings. If no camera is provided a default will be injected (sic) into the source. Note that camera position is auto updated in real time mode.
background string | Array.<string> A hex color string or an array of length 2 with hex color strings for the scene background
sdfExportSettings sdfExportSettings <optional>
Default sdf export settings.
geometries Array | Array.<Array> The scene geometries. An array of objects created by any of the geometry functions will do. NOTE: the geometry array can contain nested arrays of geometries. The array is flattened upon parsing.
materials Array The scene materials. An array of objects created by any of the material functions will do.
textures Array The scene textures. Any object created by the texture functions will do.
displacements Array.<sdfDisplacement> <optional>
SDF displacement function definitions
Source:

sdfDisplacement :object

Defines a GLSL displacement function
Properties:
Name Type Description
name string The name/id of the displacement function
src string THe GLSL source code for the displacement
Source:
Example
{
    name: 'sinus-displacement',
    src: `
        float offset = ${glslFloat(random(100))};
        float d = sin(1.*(p.x+offset)) * sin(1.*(p.y+offset)) * sin(1.*(p.z+offset));
        dDist = d;
    `
}

sdfExportSettings :object

Default settings for the SDF exporter
Properties:
Name Type Description
resolution number Marching cubes export resolution
minCoords vec3 Min coords of the bounding box
maxCoords vec3 Max coords of the bounding box
Source:
To Do:
  • Make the sdf exporter dialog offer the option to save these to source when exporting.

vec2 :object

2d coordinates / 2d vector
Properties:
Name Type Description
x number
y number
Source:

vec3 :object

3d coordinates / 3d vector
Properties:
Name Type Description
x number
y number
z number
Source: