Built-in components
The engine and Cast share the built-in schemas. Use lowerCamelCase component keys in
concept files and import the component types from "molten" in Cast.
Transform
Every object has one.
| Field | Type | Default |
|---|---|---|
position |
dvec3 |
(0, 0, 0) |
rotation |
quat |
(0, 0, 0, 1) (identity). In files: euler(x, y, z) degrees or quat(...) |
scale |
vec3 |
(1, 1, 1). In files a single number is a uniform scale: scale: 0.5 |
A part's Transform is relative to its owner.
Transform.position stores double-precision coordinates. For parts, it is relative to the parent.
Mesh
| Field | Type | Default | Notes |
|---|---|---|---|
mesh |
asset | none | A glTF path |
texture |
asset | none | None: the mesh's own base color texture, or white |
shader |
asset | none | A .slang file; none: the basic lit material |
color |
vec4 |
(1, 1, 1, 1) |
Linear RGBA multiplier (color picker in devtools). Alpha is the opacity for blend: "alpha" |
emission |
float |
0 |
Adds albedo * emission regardless of lighting. Above 1 it glows with bloom |
roughness |
float |
0.8 |
0 mirror .. 1 matte |
metallic |
float |
0 |
0 dielectric (plastic, wood, stone) .. 1 metal |
normalMap |
asset | none | Tangent-space normal map (OpenGL convention, +Y up). Name the file *_n.png or *_normal.png so it imports as linear data |
blend |
MeshBlend |
"opaque" |
"opaque", "alpha" (glass, smoke), "additive" (glows, rain, sparks). Transparent meshes draw after opaque ones, sorted far to near, and cast no shadows |
doubleSided |
bool |
false |
Draw back faces too (thin glass, leaves, flags) |
castShadows |
bool |
true |
Opaque meshes only |
instances |
int |
1 |
1-1,048,576 copies in one draw; a custom shader places each by SV_InstanceID (Shaders) |
params |
vec4 |
(0, 0, 0, 0) |
Four numbers for a custom shader (drawPush.params) |
ormMap |
asset | none | Occlusion (R), roughness (G), metallic (B), linear. Its G and B are multiplied by roughness and metallic above, so set both to 1 to use the map as is. Name the file *_data.png (or *_arm_data.jpg) so it imports as linear data |
emissionMap |
asset | none | Emitted color (sRGB), added unlit |
bakedLighting |
bool |
false |
Scenery that never moves: it gets a lightmap when the level is baked (Baked lighting) |
instanceData |
asset | none | A .instances file of per-instance transforms (Large scenes); instances then comes from it |
lodBias |
float |
1 |
Larger keeps the detailed levels of detail (LODs) longer; meshes over 2,000 triangles get LODs when imported |
alphaCutoff |
float |
0 |
Cut-out material (M20): base color alpha below this is a hole, in the picture, the shadows and ray tracing. 0 = the glTF's own cutoff when its alphaMode is MASK, else none. Opaque meshes only |
rayTraced |
bool |
true |
In the ray tracing scene at the cinematic tier (Ray-traced GI); transparent meshes never are |
mesh: "models/x.gltf" is shorthand for mesh: { mesh: "models/x.gltf" }.
A glTF brings its own material: base color, normal, metallic-roughness, occlusion and emissive
textures and factors are imported with it and used when the matching field above is empty. A
glTF's own ORM map is multiplied by the glTF's factors (the Mesh's roughness / metallic
then do nothing), so a scanned asset from Poly Haven or ambientCG renders with its real
material without setup.
Cut-outs (M20). A glTF material with alphaMode: "MASK" cuts holes where its base color
alpha is below its alphaCutoff (leaves, fences, scanned tree and grass cards); set
alphaCutoff on the Mesh to do the same with any texture. Cut-outs stay opaque everywhere else:
they write depth, need no sorting and work with TAA. Their shadows have the holes too (a custom
shader needs a shadowMain, Shaders). A card that is a thin box
casts the shadow of both its faces.
Camera
The scene is drawn from the first object with a Camera, looking down its local -Z axis with +Y up.
| Field | Type | Default |
|---|---|---|
fovYDegrees |
float |
60 (range 1-179) |
nearPlane |
float |
0.1 |
farPlane |
float |
1000 |
Cast and concept files share these names, for example
obj.camera.fovYDegrees = 60 and camera: { fovYDegrees: 60 }.
Light
Directional and spot lights shine down their local -Z axis. The first directional light is
the sun: it has the shadows and the ambient light. Up to 64 point and spot lights
nearest the camera light each frame. A level's environment.sunDirection creates a sun for
you.
| Field | Type | Default | Notes |
|---|---|---|---|
kind |
LightKind |
"directional" |
"directional", "point", "spot" |
color |
vec3 |
(1, 1, 1) |
|
intensity |
float |
1 |
Range 0-100. Point and spot light falls off with distance squared, so lamps need 5-50 |
range |
float |
10 |
Point/spot: meters where the light fades to zero |
spotAngle |
float |
45 |
Spot: full outer cone in degrees (the inner, full-brightness cone is 80% of it) |
ambient |
vec3 |
(0.08, 0.08, 0.1) |
Sun: ambient light from above |
groundAmbient |
vec3 |
(0.08, 0.08, 0.1) |
Sun: ambient light from below |
shadows |
bool |
true |
Sun: cast shadows (4 cascades of 2048 x 2048). Point and spot lights: cast shadows when the scene has an Environment |
shadowDistance |
float |
100 |
Sun: meters from the camera that get shadows |
bakeBounce |
bool |
false |
Point and spot lights: bake their bounced light (keep such a lamp on; baked light cannot switch off) |
sourceRadius |
float |
0 |
With an Environment: how big the light is, for soft shadows. Point and spot: radius in meters (0 means 0.05). Sun: angular radius in degrees (0 means the real sun, 0.27) |
Point and spot lights cast shadows only when the scene has an Environment: up to 16 lights (nearest first) and 64 shadow maps of 512 x 512 (a spot light uses one, a point light six). A light's shadow is redrawn only when the light or something within its reach moves.
PostProcess
How the HDR frame becomes the picture. The first object that has one is used; put it on a camera rig or a director object. Without one: exposure 1, clamping, no bloom, no FXAA.
| Field | Type | Default | Notes |
|---|---|---|---|
exposure |
float |
1 |
Multiplier before tone mapping |
toneMapping |
ToneMapping |
"none" |
"none" (clamp) or "aces" (filmic: keeps highlights, richer contrast) |
bloom |
float |
0 |
0-4; glow around pixels brighter than bloomThreshold |
bloomThreshold |
float |
1 |
HDR brightness where bloom starts |
antialiasing |
Antialiasing |
"none" |
"none", "fxaa", or "taa" (temporal: smooth edges and fine detail by blending jittered frames; the best choice with an Environment) |
effect1 .. effect4 |
asset | none | Post effect shaders, run in order (Shaders) |
autoExposure |
bool |
false |
Adapt the exposure to the scene's brightness, like an eye walking from sun into shade. exposure still multiplies |
exposureMin, exposureMax |
float |
-2, 16 |
The adaptation range in EV100. Molten's light units are relative, so most scenes settle between EV 0 and 6 |
exposureSpeed |
float |
3 |
How fast it adapts, in EV per second |
effect1Scale .. effect4Scale |
float |
1 |
0.5 runs that effect at half resolution and upsamples it (faster fog, clouds) |
Environment
The sky, light from the sky, ambient occlusion, reflections and volumetric fog (M17). The
first object that has one is used. Having one also turns on shadows for point and spot lights
and soft shadows. Everything here is ignored at graphics quality low
(Graphics tiers).
| Field | Type | Default | Notes |
|---|---|---|---|
sky |
SkyMode |
"color" |
"color": the sun's ambient / groundAmbient light the scene, the clear color stays behind it. "physical": a real atmosphere for the sun's direction (blue day, orange sunset; the sun's light is tinted by it). "texture": an HDR sky image |
skyTexture |
asset | none | An equirectangular .hdr image for sky: "texture" |
skyIntensity |
float |
1 |
Scales the sky and its light |
ambientOcclusion |
float |
0 |
0-1: darkens corners and contact points (ambient light only) |
reflections |
ReflectionMode |
"none" |
"none": the sky only. "probes": ReflectionProbes. "ssr": probes plus screen-space reflections (what is on screen) |
fog |
float |
0 |
Fog density per meter (0.01 light haze .. 0.1 thick). Lit by the sun with its shadows (sun shafts) and by lamps |
fogColor |
vec3 |
(0.9, 0.92, 0.95) |
Scattering color |
fogHeight |
float |
0 |
World height where the height fog starts thinning |
fogFalloff |
float |
0.1 |
Thinning per meter above fogHeight (0 = the same everywhere) |
fogAnisotropy |
float |
0.6 |
-1 .. 1: how strongly fog glows when looking toward a light |
fogTemporal |
bool |
true |
Smooth the fog over frames |
wind |
vec3 |
(0, 0, 0) |
Wind in m/s: sways foliage and shaders that call windSway |
ReflectionProbe
Captures its surroundings into a reflection map used by surfaces inside its box, for rooms
and covered areas where the sky would be the wrong reflection. Needs environment.reflections
"probes" or "ssr". Up to 32 per frame; one probe is captured per frame at most.
| Field | Type | Default | Notes |
|---|---|---|---|
size |
vec3 |
(10, 4, 10) |
Box size in meters (times the Transform's scale) |
blend |
float |
1 |
Meters over which it fades out at the box edge |
boxProjection |
bool |
true |
Correct reflections for the box's walls (rooms) |
update |
ProbeUpdate |
"once" |
"once", "always" (one probe per frame in turn), "onChange" (when objects inside move, appear or disappear) |
FogVolume
Extra fog in a box: a smoky room, mist in a hollow, a storm cell. Needs an Environment.
| Field | Type | Default | Notes |
|---|---|---|---|
size |
vec3 |
(10, 10, 10) |
Box size in meters (rotated and scaled by the Transform) |
density |
float |
0.1 |
Per meter |
color |
vec3 |
(1, 1, 1) |
Scattering color |
densityShader |
asset | none | A compute shader that sets the density itself, for clouds and moving smoke (Shaders) |
Baked lighting
Light that bounces between surfaces (a sunlit wall brightening the floor beside it, an
arcade lit by the courtyard in front of it) can be baked into the level (M18). Mark the
scenery that never moves with mesh: { ..., bakedLighting: true }, then bake: in devtools
Level > Bake lighting, or molten-bake <game folder> <level>. The bake path-traces the
sky and the sun's (and bakeBounce lamps') light bouncing between the baked meshes and
writes:
assets/lighting/<level>/*.lightmap.hdr: what each baked mesh receives (it replaces the sky's light on them), andprobes.hdr: a grid of light probes that light everything else (props, characters, moving objects) with the same bounced light;levels/<level>/lighting.bake: which object uses which part of which lightmap.
Direct sunlight, lamps and shadows stay real time. Baked lighting needs an environment
and is ignored at quality low. Edit the level and the old bake still loads but is
reported stale (in the console and in the devtools viewport) until you bake again. Bake
with the sun where the level places it; a sun that moves at run time makes the bounce wrong.
Bake
Bake settings for the level it is placed in (all optional).
| Field | Type | Default | Notes |
|---|---|---|---|
texelsPerMeter |
float |
8 |
Lightmap detail |
samples |
int |
256 |
Rays per lightmap texel (fewer: faster, noisier) |
bounces |
int |
3 |
|
probeSpacing |
float |
2 |
Meters between light probes |
Lightmap (texture, scaleOffset) and LightProbes (texture, origin, spacing,
countX, countY, countZ) are added by the engine from the bake and are read-only.
Ray-traced global illumination
At the cinematic tier (graphics = "cinematic" in game.toml, on a GPU that traces rays), a
giVolume lights everything inside its box with light that bounces off the scene, updated
every frame: a moving sun, a lamp switched on or a door opened changes the bounce within a
fraction of a second, with no bake (M20). It works by a grid of light probes that trace rays
into the scene each frame (DDGI). At the standard tier the volume is ignored and baked lighting
or the sky lights the scene as before, so a cinematic game should still bake its levels.
export default object({
giVolume: { size: vec3(22, 7, 22), probeSpacing: 1.5 },
});
Inside the volume its light replaces lightmaps, baked probes and the sky's light on surfaces;
ambient occlusion darkens it half as much as usual. It needs an environment and is off at
quality low (at medium it traces fewer rays). One volume per scene (the first). Reflections
are unchanged (sky, probes, SSR) until ray-traced reflections arrive (M22).
GiVolume
| Field | Type | Default | Notes |
|---|---|---|---|
size |
vec3 |
(20, 8, 20) |
The box around the object, in meters |
probeSpacing |
float |
2 |
Meters between probes. Smaller is more detailed and slower; widened to keep within 64 x 32 x 64 and 32,768 probes |
raysPerProbe |
int |
128 |
Rays per probe update (16-512) |
hysteresis |
float |
0.97 |
How much of its last value a probe keeps each update. Lower reacts faster and flickers more |
intensity |
float |
1 |
Multiplies the bounced light |
normalBias |
float |
0.2 |
Meters; raise it if walls show dark blotches |
viewBias |
float |
0.1 |
Meters |
What rays see: every opaque mesh with rayTraced (its base color texture and factor, and its
emission), terrain (as its first layer's average color) and foliage with rayTraced: true.
Custom vertex shaders are not reflected in rays (the mesh's rest shape is used). Probes that end
up inside geometry turn themselves off. Devtools shows the probes with View > GI probes.
Large scenes
M19 adds what large outdoor levels need. Every mesh is culled against the view (and each
shadow cascade) on the CPU, and meshes over 2,000 triangles get up to 3 simpler levels of
detail when imported, picked by how big the mesh is on screen (Mesh.lodBias).
Per-instance transforms. mesh: { mesh: "models/rock.gltf", instanceData: "scatter/rocks.instances" }
draws the mesh once per transform in the file. The .instances format: the bytes MINS
(as a little-endian uint32), uint32 version 1, uint32 count, uint32 0, then count
transforms of 12 floats: the rows of a 3 x 4 matrix (rotation and scale, translation in
the 4th column) relative to the object.
Terrain
A heightmap terrain: a square of size meters centered on its object, with collision (a
static height field) and four painted ground layers. Make the heightmap a 16-bit grayscale
PNG (8-bit works, in coarser steps; pixel (0, 0) is the -X -Z corner) and the splat map an
RGBA PNG named *_data.png (red = layer 0, green = 1, blue = 2, alpha = 3). Edit both with
devtools' Terrain tool (T), or in any image editor; the game reloads them.
| Field | Type | Default | Notes |
|---|---|---|---|
heightmap |
asset | none | 16-bit grayscale PNG, square |
size |
float |
256 |
Meters, the square's side |
height |
float |
40 |
Meters for white |
splatMap |
asset | none | Where each layer shows; none = layer 0 everywhere |
layer0Texture ... layer3Texture |
asset | none | Base color |
layer0Normal ... layer3Normal |
asset | none | Normal map (*_n.png) |
layer0Orm ... layer3Orm |
asset | none | Occlusion, roughness, metallic (*_data.png) |
layer0Tiling ... layer3Tiling |
float |
4 |
Meters per texture repeat |
Layers blend by the splat weights, sharpened by each layer's brightness so stones poke through grass. Terrain is not part of baked lighting yet.
Foliage
Scatters a mesh over the terrain under the object (deterministically: the same files give the same instances). Use one foliage object per kind (grass, trees, rocks).
| Field | Type | Default | Notes |
|---|---|---|---|
mesh |
asset | none | |
texture |
asset | none | none = the mesh's own |
density |
float |
0.5 |
Instances per square meter |
layer |
int |
-1 |
The splat layer it grows on (its weight is the chance); -1 = everywhere |
scale |
vec2 |
(0.8, 1.2) |
Random scale between |
slopeLimit |
float |
35 |
Degrees; steeper ground stays bare |
heightRange |
vec2 |
everything | Terrain heights (m) it grows between, for a treeline |
radius |
float |
0 |
Meters around the object; 0 = the whole terrain |
seed |
int |
1 |
|
wind |
float |
1 |
How much it sways in environment.wind (the mesh's base stays put) |
drawDistance |
float |
150 |
Meters from the camera |
rayTraced |
bool |
false |
In the cinematic tier's ray tracing scene (M20). Off by default: grass is many instances for little bounced light |
Decal
Projects a texture along the object's -Z (turn it to face the surface: rotation: euler(-90, 0, 0) points it down) onto the opaque surfaces inside its box, before lighting:
tire tracks, puddles, cracks, dirt. Up to 64 (the nearest) per frame; not drawn at quality
low.
| Field | Type | Default | Notes |
|---|---|---|---|
texture |
asset | none | Base color; alpha is the coverage |
normalMap |
asset | none | |
ormMap |
asset | none | Occlusion, roughness, metallic (a low roughness makes a puddle) |
size |
vec3 |
(1, 1, 1) |
The box, meters (z is the projection depth) |
opacity |
float |
1 |
Particles
A GPU particle emitter. Particles leave along the object's -Z (rotation: euler(90, 0, 0)
points it up), live on the GPU, and keep going when you edit the fields (except
maxParticles). Alpha-blended emitters are sorted back to front.
| Field | Type | Default | Notes |
|---|---|---|---|
rate |
float |
20 |
Per second |
burst |
int |
0 |
Emitted at once when the emitter appears |
lifetime |
vec2 |
(1, 2) |
Seconds, min and max |
speed |
vec2 |
(1, 2) |
m/s, min and max |
spread |
float |
20 |
Cone in degrees around -Z |
gravity |
float |
0 |
Times 9.81 m/s2 down (negative rises) |
drag |
float |
0 |
Per second |
size |
vec2 |
(0.2, 0.4) |
Meters at birth and death |
colorStart, colorEnd |
vec4 |
white, transparent white | Linear RGBA over the lifetime |
emission |
float |
0 |
Glow (with bloom) |
texture |
asset | none | none = a soft dot |
blend |
"alpha" / "additive" |
"alpha" |
Additive for fire and sparks |
maxParticles |
int |
1024 |
1-65,536 |
local |
bool |
false |
Particles move with the object |
lit |
bool |
true |
Lit by the sun, sky and lamps (smoke); false for fire |
Parent
Added by the engine to parts. object (a handle, read-only) is the owner. An object whose
parent is destroyed is destroyed too. A Cast behavior can query Parent to find parts.
AudioSource
| Field | Type | Default | Notes |
|---|---|---|---|
asset |
asset | none | A WAV or Ogg Vorbis path |
bus |
AudioBus |
"effects" |
"master", "music", "effects", "ui" |
volume |
float |
1 |
Range 0-4 |
pitch |
float |
1 |
Range 0.125-4 |
pan |
float |
0 |
-1 left to 1 right |
minDistance, maxDistance |
float |
1, 30 |
Spatial attenuation is linear between them |
loop |
bool |
false |
|
autoplay |
bool |
false |
Starts when the object becomes active (or its asset changes) |
spatial |
bool |
false |
Positioned at the object |
RigidBody
Needs a Collider on the same object. Put physics components on root objects (not parts).
| Field | Type | Default | Notes |
|---|---|---|---|
motion |
BodyMotion |
"static" |
"static", "dynamic", "kinematic" |
layer |
int |
0 |
0-31, for query masks. All layers collide with each other |
mass |
float |
1 |
Kilograms |
friction |
float |
0.5 |
|
restitution |
float |
0 |
0-1, bounciness |
linearDamping, angularDamping |
float |
0.05 |
|
gravityFactor |
float |
1 |
Collider
A collider without a RigidBody is static.
| Field | Type | Default | Notes |
|---|---|---|---|
shape |
ColliderShape |
"box" |
"box", "sphere", "capsule", "cylinder", "mesh" (static triangle mesh), "convexHull" |
size |
vec3 |
(1, 1, 1) |
Full size in local space. Round shapes use X as the diameter and Y as the total height. The object's scale applies |
offset |
vec3 |
(0, 0, 0) |
Center relative to the origin |
mesh |
asset | none | For "mesh" and "convexHull"; none uses the object's Mesh |
trigger |
bool |
false |
Reports contacts without pushing anything |
CharacterController
An upright capsule with its origin at the feet. Move it with characterMove every tick.
| Field | Type | Default | Notes |
|---|---|---|---|
height |
float |
1.8 |
|
radius |
float |
0.3 |
|
maxSlope |
float |
50 |
Degrees, 0-89 |
stepHeight |
float |
0.3 |
|
speed |
float |
5 |
m/s; characterMove velocity is capped to it |
jumpSpeed |
float |
5 |
m/s |
How physics and Transform interact
- Dynamic bodies write position and rotation back to
Transformafter each step. Writing their Transform yourself teleports them. - Static bodies follow their Transform; kinematic bodies move to their Transform each tick.
- Characters take horizontal velocity from
characterMoveand write back their feet position. - Editing physics fields (in files, devtools or code) updates the body in place, keeping dynamic velocities. An invalid value keeps the last valid body.