Expand description
threers — a drop-in three.js replacement for Rust and WebAssembly.
Implements the three.js architecture and API surface: a scene graph of
Object3Ds, BufferGeometry with named attributes, Materials,
cameras, and a Renderer that walks the graph and draws. Backed by
wgpu on native and WebGPU in the browser.
§Crates and targets
rlib: native desktop / tooling (cargo run --example cube)cdylib: wasm32 WebAssembly (wasm-pack build)
§Web usage
Import web/threejs-shim.js for a drop-in THREE.* API over the wasm
bindings. Existing three.js r165-style apps can swap in with minimal changes.
§Feature flags
The core — math, the scene graph, geometry, materials, lights, cameras,
controls, loaders and exporters — is unconditional, and depends on log,
slotmap and web-time and nothing else: no GPU stack, and none of the
other threers crates. Everything below is a self-contained subsystem
behind a feature, the renderer included: turning one off removes its
module and its re-exports and touches nothing else.
# The core alone: scene graph, geometry and loaders, no GPU
threers = { version = "0.0.12", default-features = false }
# The renderer and nothing else
threers = { version = "0.0.12", default-features = false, features = ["render"] }§Leaf features
| Feature | Default | Role | Extra deps |
|---|---|---|---|
render | on | The wgpu renderer and everything that draws: Renderer, headless and windowed rendering, post-processing, marks, volumes, GPU textures | wgpu, bytemuck, pollster |
captions | on | Subtitles — SRT + WebVTT, on-screen and burned in | threers-captions |
sketch | on | sketch() and the winit-window WindowRenderer (implies render); off, winit is not built | winit |
mesh-bvh | Accelerated raycast / shapecast | — | |
raytrace | Path tracer: global illumination, area lights, refraction, DoF; CPU + wgpu-compute backends (implies render) | — | |
bvh-csg | Constructive solid geometry (implies mesh-bvh) | — | |
openscad | .scad front end + Solid DSL + exact-CSG kernel (implies bvh-csg) | — | |
manifold | Optional Manifold kernel behind OpenSCAD booleans (implies openscad) | manifold-rust | |
planet | Planets, moons, starfields, map generation | — | |
fluid | Interactive 2D and 3D fluids on the GPU, as render passes (runs on WebGL2; implies render) | — | |
softbody | Soft bodies that tear and regrow, with a WebGPU compute solver (implies render) | threers-softbody | |
usd | Universal Scene Description — .usda, .usdc, .usdz, read and written | — | |
native-codec | Pure-Rust video encoders, audio decoders and containers (wasm-safe) | threers-codec | |
native-decode | Pure-Rust H.264, HEVC, VP9 and AV1 decoders (implies native-codec). Decodes on every core, and in hardware where there is some (VideoToolbox, NVDEC, VAAPI, loaded at run time); video on meshes and video export are the threers-video crate | threers-codec | |
metal | A second renderer on Metal directly, via the Objective-C runtime (macOS/iOS; implies render) | — | |
visionos | CompositorServices frame loop + ARKit world tracking, stereo and reverse-Z (implies metal) | — | |
videotoolbox | In-process VideoToolbox encode and decode (macOS) | — | |
nvidia | NVENC encode and NVDEC decode on NVIDIA GPUs (Linux/Windows, driver loaded at run time) | — | |
vaapi | VAAPI HEVC encode and H.264/HEVC/VP9/AV1 decode on Linux (AMD, Intel; libva loaded at run time) | — | |
parallel | rayon-backed CSG/BVH work and frame-parallel encoding (native; a no-op on wasm32) | rayon | |
async | tokio runtime for callers driving loaders concurrently (native) | tokio | |
rlx | Tensors ↔ geometry and pixels, graph runner, convolution, mesh smoothing, fitted colour grades, palettes | rlx | |
rlx-geo | Exact Delaunay + adaptive refinement + Voronoi cell textures | rlx-geo | |
nurbs | NURBS curves/surfaces: derivatives, knots, tessellation | — | |
brep | Analytic surface provenance on geometry (implies nurbs) | — | |
brep-csg | Closed-form SSI fast paths in the CSG kernel (implies brep + openscad) | — | |
brep-kernel | True B-rep topology, boolean, fillets (implies brep-csg) | — | |
step | STEP AP203/214 import + export (implies brep-kernel) | — | |
assembly-check | Assembly motion checks (body correspondence, axis recovery, swept volume) | — | |
learned-denoise | Trained U-Net denoiser beside À-Trous (implies raytrace) | — | |
learned-denoise-metal, learned-denoise-gpu | The same network on Metal or wgpu (imply learned-denoise) | — | |
webgl | WebGL2 in the browser through wgpu’s GL backend, where WebGPU is missing (implies render) | — |
§Meta bundles
| Bundle | Enables |
|---|---|
cad | openscad + nurbs + brep + brep-csg + parallel |
media | native-decode + native-codec + gif + captions |
gi | raytrace + learned-denoise |
apple | metal + videotoolbox |
full | cad + media + gi + planet + fluid + usd + rlx + rlx-geo + assembly-check + async + step + brep-kernel |
wasm-full | Browser kitchen sink: captions + openscad + native-codec + nurbs + planet + raytrace + fluid + usd + softbody |
# CAD stack in one flag
threers = { version = "0.0.10", features = ["cad"] }
# everything
threers = { version = "0.0.10", features = ["full"] }
# browser wasm kitchen sink
threers = { version = "0.0.10", features = ["wasm-full"] }
# nothing but the renderer
threers = { version = "0.0.10", default-features = false }Rigid-body physics lives in the companion crate
threers-physics. Language bindings:
see docs/bindings.md
(wasm ESM, napi-rs Node native, PyO3).
§Modules
| Module | Role |
|---|---|
prelude | One glob import for the types nearly every scene uses; nested modules for controls / animation / … |
core | Scene graph, geometry, raycaster |
math | Vectors, matrices, colours, bounds, Delaunay, geographic coordinates — the threers-math crate |
audio | Audio sources, listeners and positional audio as scene nodes — the threers-audio crate (audio) |
origami | Rigid origami: crease patterns, degree-4 kinematics, folded meshes |
renderer | wgpu draw + post-processing; headless offscreen (native) |
raytrace | Path-traced rendering — global illumination, on CPU or GPU (raytrace) |
postprocessing | three.js EffectComposer and passes (native and browser) |
loaders | glTF, OBJ, HDR, … |
extras | PMREM, noise, marching cubes, … |
geometries::lattice | 35 lattice generators, and what they are worth: stiffness, conductivity, strength, porosity, pore size |
materials | PBR materials and ShaderMaterial |
captions | subtitles — SRT + WebVTT, on-screen and burned in (captions) |
planet | Planets, moons, starfields (planet feature) |
mesh_bvh | Opt-in BVH (mesh-bvh feature) |
csg | Opt-in CSG (bvh-csg feature) |
nurbs / brep / step | CAD surface stack (feature-gated) |
codec | Opt-in media codecs (native-codec feature) |
rlx | Opt-in RLX bridge (rlx, rlx-geo features) |
Re-exports§
pub use fur::FurGroom;pub use fur::FurMaterial;pub use animation::AnimationAction;pub use animation::AnimationClip;pub use animation::AnimationMixer;pub use animation::Interpolation;pub use animation::KeyframeTrack;pub use animation::TrackTarget;pub use brep::retessellate;breppub use brep::retessellate;breppub use brep::Surface;breppub use brep::SurfaceTable;breppub use cameras::Camera;pub use cameras::OrthographicCamera;pub use cameras::PerspectiveCamera;pub use cameras::ScreenProjector;pub use cameras::ViewOffset;pub use captions::CaptionFont;captionspub use captions::CaptionOverlay;captionspub use captions::CaptionPainter;captionspub use controls::ArcballControls;pub use controls::DragControls;pub use controls::FirstPersonControls;pub use controls::GlobeControls;pub use controls::MapControls;pub use controls::OrbitControls;pub use controls::PointerEvent;pub use controls::PointerLockControls;pub use controls::TrackballControls;pub use core::Bone;pub use core::BufferAttribute;pub use core::BufferGeometry;pub use core::Clock;pub use core::InstancedMesh;pub use core::Intersection;pub use core::Layers;pub use core::LineSegments;pub use core::Mesh;pub use core::MorphAttributes;pub use core::MorphTarget;pub use core::Object3D;pub use core::ObjectArena;pub use core::ObjectId;pub use core::ObjectKind;pub use core::Points;pub use core::Raycaster;pub use core::Skeleton;pub use core::SkinnedMesh;pub use core::Sprite;pub use core::DEFAULT_INFER_QUADS_ANGLE;pub use curves::parse_svg_subpaths;pub use curves::segments_to_path_data;pub use curves::CatmullRomCurve3;pub use curves::CubicBezierCurve;pub use curves::CubicBezierCurve3;pub use curves::Curve2;pub use curves::Curve3;pub use curves::CurvePath;pub use curves::EllipseCurve;pub use curves::LineCurve;pub use curves::LineCurve3;pub use curves::NURBSCurve;pub use curves::NURBSSurface;pub use curves::Path;pub use curves::PathSegment;pub use curves::QuadraticBezierCurve;pub use curves::QuadraticBezierCurve3;pub use curves::Shape;pub use curves::SplineCurve;pub use curves::SvgPathError;pub use extras::CcdIkSolver;pub use extras::IkBone;pub use extras::MarchingCubes;pub use extras::Octree;pub use extras::PmremGenerator;pub use extras::SimplexNoise;pub use extras::PMREM_MIP_LEVELS;pub use geometries::NurbsGeometry;nurbspub use geometries::BoxGeometry;pub use geometries::BoxLineGeometry;pub use geometries::CapsuleGeometry;pub use geometries::ChiralRule;pub use geometries::CircleGeometry;pub use geometries::Conductivity;pub use geometries::ConeGeometry;pub use geometries::Conform;pub use geometries::ConvexGeometry;pub use geometries::Cuboct;pub use geometries::CuboctAssembly;pub use geometries::CuboctAssemblyPlan;pub use geometries::CuboctAssemblyStep;pub use geometries::CuboctFrame;pub use geometries::CuboctJoint;pub use geometries::CuboctJointKind;pub use geometries::CylinderGeometry;pub use geometries::DecalGeometry;pub use geometries::DodecahedronGeometry;pub use geometries::EdgesGeometry;pub use geometries::ExtrudeGeometry;pub use geometries::Field;pub use geometries::FrameMaterial;pub use geometries::FrameResponse;pub use geometries::Glyph;pub use geometries::Hand;pub use geometries::IcosahedronGeometry;pub use geometries::Infill;pub use geometries::KirigamiAssembly;pub use geometries::KirigamiCell;pub use geometries::KirigamiCoreLattice;pub use geometries::KirigamiCrease;pub use geometries::KirigamiCreaseKind;pub use geometries::KirigamiExpandedMiura;pub use geometries::KirigamiFace;pub use geometries::KirigamiFaceKind;pub use geometries::KirigamiMesh;pub use geometries::KirigamiNet;pub use geometries::KirigamiNetPanel;pub use geometries::KirigamiPreset;pub use geometries::LatheGeometry;pub use geometries::Lattice;pub use geometries::LatticeGeometry;pub use geometries::LatticeKind;pub use geometries::LatticeMetrics;pub use geometries::LatticeStyle;pub use geometries::OctahedronGeometry;pub use geometries::ParametricGeometry;pub use geometries::PlaneGeometry;pub use geometries::PolygonGeometry;pub use geometries::PolyhedronGeometry;pub use geometries::QuadGeometry;pub use geometries::Region;pub use geometries::RingGeometry;pub use geometries::ScaleRich;pub use geometries::ScaleRichAngles;pub use geometries::ScaleRichLigament;pub use geometries::ScaleRichNet;pub use geometries::SeedLayout;pub use geometries::SolidMaterial;pub use geometries::Solver;pub use geometries::SphereGeometry;pub use geometries::Stiffness;pub use geometries::Stochastic;pub use geometries::Strength;pub use geometries::Strut;pub use geometries::TetrahedronGeometry;pub use geometries::TextGeometry;pub use geometries::TorusGeometry;pub use geometries::TorusKnotGeometry;pub use geometries::Tpms;pub use geometries::TubeGeometry;pub use geometries::WireframeGeometry;pub use geometries::KIRIGAMI_NET_VARIANT;pub use helpers::ArrowHelper;pub use helpers::AxesHelper;pub use helpers::BoxHelper;pub use helpers::CameraHelper;pub use helpers::DirectionalLightHelper;pub use helpers::GridHelper;pub use helpers::HemisphereLightHelper;pub use helpers::PointLightHelper;pub use helpers::PolarGridHelper;pub use helpers::SkeletonHelper;pub use helpers::SpotLightHelper;pub use helpers::VertexNormalsHelper;pub use helpers::VertexTangentsHelper;pub use lights::AmbientLight;pub use lights::DirectionalLight;pub use lights::HemisphereLight;pub use lights::Light;pub use lights::PointLight;pub use lights::RectAreaLight;pub use lights::ShadowSettings;pub use lights::ShadowType;pub use lights::SpotLight;pub use loaders::AlembicArchive;pub use loaders::AlembicError;pub use loaders::ColladaError;pub use loaders::ColladaLoader;pub use loaders::DracoError;pub use loaders::DracoHeader;pub use loaders::ExrError;pub use loaders::ExrLoader;pub use loaders::FbxError;pub use loaders::FbxLoader;pub use loaders::FbxScene;pub use loaders::GcodeLoader;pub use loaders::GcodeToolpath;pub use loaders::GltfError;pub use loaders::GltfImages;pub use loaders::GltfLoader;pub use loaders::GltfScene;pub use loaders::HdrError;pub use loaders::HdrLoader;pub use loaders::Ktx2;pub use loaders::Ktx2Error;pub use loaders::MeshoptError;pub use loaders::ObjLoader;pub use loaders::PlyLoader;pub use loaders::PolyMesh;pub use loaders::StlLoader;pub use loaders::TtfError;pub use loaders::TtfFont;pub use loaders::TtfGlyph;pub use origami::book_cardinal_cp;pub use origami::book_cardinal_stages;pub use origami::classic_bird_cp;pub use origami::classic_bird_stages;pub use origami::eagle_cp;pub use origami::eagle_stages;pub use origami::frog_cp;pub use origami::frog_stages;pub use origami::giang_cardinal_cp;pub use origami::giang_cardinal_stages;pub use origami::AssembledBird;pub use origami::Assignment;pub use origami::BirdKind;pub use origami::BookCardinalStage;pub use origami::ClassicBirdStage;pub use origami::ClosureReport;pub use origami::CreasePattern;pub use origami::Degree4;pub use origami::EagleStage;pub use origami::Edge;pub use origami::EdgeKind;pub use origami::FoldedBirdPart;pub use origami::FoldedState;pub use origami::FrogStage;pub use origami::GiangCardinalStage;pub use origami::PartPose;pub use origami::VertexMode;pub use origami::TWIST_ALPHA;pub use loaders::scene_to_glb;pub use loaders::scene_to_gltf;pub use loaders::GltfExportOptions;pub use materials::MirrorMaterial;pub use materials::AtmosphereMaterial;pub use materials::BasicMaterial;pub use materials::DepthMaterial;pub use materials::LambertMaterial;pub use materials::LineBasicMaterial;pub use materials::MatcapMaterial;pub use materials::Material;pub use materials::MaterialKind;pub use materials::MaterialTextureSlots;pub use materials::NormalMaterial;pub use materials::PhongMaterial;pub use materials::PhysicalMaterial;pub use materials::PointsMaterial;pub use materials::ShaderMaterial;pub use materials::SpriteMaterial;pub use materials::StandardMaterial;pub use materials::ToonMaterial;pub use materials::TransparencyMode;pub use materials::Blending;pub use materials::DepthFunc;pub use materials::RenderState;pub use nurbs::NurbsCurve;nurbspub use nurbs::NurbsSurface;nurbspub use nurbs::TessellationOptions;nurbspub use postprocessing::BloomPass;renderpub use postprocessing::CopyPass;renderpub use postprocessing::EffectComposer;renderpub use postprocessing::FilmPass;renderpub use postprocessing::FxaaPass;renderpub use postprocessing::GlitchPass;renderpub use postprocessing::OutlinePass;renderpub use postprocessing::OutputPass;renderpub use postprocessing::Pass;renderpub use postprocessing::RenderPass;renderpub use postprocessing::ShaderPass;renderpub use postprocessing::SsaoPass;renderpub use postprocessing::SsrPass;renderpub use postprocessing::UnrealBloomPass;renderpub use renderer::headless::GpuVendor;renderand non-WebAssemblypub use renderer::headless::HeadlessBuilder;renderand non-WebAssemblypub use renderer::headless::HeadlessConfig;renderand non-WebAssemblypub use renderer::headless::HeadlessRenderer;renderand non-WebAssemblypub use renderer::headless::MappedFrame;renderand non-WebAssemblypub use renderer::halton;renderpub use renderer::stratified_jitter;renderpub use renderer::RenderBackend;renderpub use renderer::RenderTarget;renderpub use renderer::Renderer;renderpub use renderers::svg_from_rgba;pub use renderers::Css2dRenderer;pub use renderers::Css3dRenderer;pub use renderers::SvgOptions;pub use renderers::SvgRenderer;pub use renderers::SvgShading;pub use scene::Scene;pub use stats::Stats;pub use textures::pack_rgba16f;pub use textures::AstcBlock;pub use textures::Compression;pub use textures::CubeTexture;pub use textures::DataTexture;pub use textures::DepthTexture;pub use textures::Texture;pub use textures::TextureFilter;pub use textures::TextureFormat;pub use textures::TextureWrap;pub use utils::png::decode_png;pub use utils::png::encode_png;pub use utils::png::encode_png_with_dpi;pub use utils::png::PngImage;pub use volume::Data3DTexture;renderpub use time_smear::TimeSmear;pub use utils::center as center_geometry;pub use utils::compute_tangents;pub use utils::compute_vertex_normals;pub use utils::merge_geometries;pub use utils::scale as scale_geometry;pub use mesh_bvh::BuildOptions as MeshBvhBuildOptions;mesh-bvhpub use mesh_bvh::BvhHit;mesh-bvhpub use mesh_bvh::BvhNodeView;mesh-bvhpub use mesh_bvh::MeshBvh;mesh-bvhpub use mesh_bvh::SerializedMeshBvh;mesh-bvhpub use mesh_bvh::AVERAGE;mesh-bvhpub use mesh_bvh::CENTER;mesh-bvhpub use mesh_bvh::CONTAINED;mesh-bvhpub use mesh_bvh::INTERSECTED;mesh-bvhpub use mesh_bvh::NOT_INTERSECTED;mesh-bvhpub use mesh_bvh::SAH;mesh-bvhpub use raytrace::intersect_box;raytracepub use raytrace::Aov;raytracepub use raytrace::BackgroundMode;raytracepub use raytrace::CpuBackend;raytracepub use raytrace::RaytraceBackend;raytracepub use raytrace::RaytraceError;raytracepub use raytrace::RaytraceRenderer;raytracepub use raytrace::RaytraceScene;raytracepub use raytrace::RaytraceSettings;raytracepub use csg::evaluate_hierarchy;bvh-csgpub use csg::CsgBrush;bvh-csgpub use csg::CsgEvaluator;bvh-csgpub use csg::CsgNode;bvh-csgpub use csg::CsgOperation;bvh-csgpub use csg::CsgOperationGroup;bvh-csgpub use csg::TriangleIntersection;bvh-csgpub use csg::ADDITION;bvh-csgpub use csg::DIFFERENCE;bvh-csgpub use csg::HOLLOW_INTERSECTION;bvh-csgpub use csg::HOLLOW_SUBTRACTION;bvh-csgpub use csg::INTERSECTION;bvh-csgpub use csg::REVERSE_SUBTRACTION;bvh-csgpub use csg::SUBTRACTION;bvh-csgpub use exact_csg::report::mesh_report;openscadpub use exact_csg::report::DefectCluster;openscadpub use exact_csg::report::MeshReport;openscadpub use openscad::export::geometry_to_3mf;openscadpub use openscad::export::geometry_to_glb;openscadpub use openscad::export::geometry_to_obj;openscadpub use openscad::export::geometry_to_off;openscadpub use openscad::export::geometry_to_ply;openscadpub use openscad::export::parts_to_glb;openscadpub use openscad::freecad::fcstd_meshes;openscadpub use openscad::freecad::fcstd_to_geometry;openscadpub use openscad::freecad::fcstd_to_solid;openscadpub use openscad::freecad::geometry_to_fcstd;openscadpub use openscad::freecad::geometry_to_fcstd_with;openscadpub use openscad::freecad::parse_mesh_kernel;openscadpub use openscad::freecad::parse_mesh_kernel_full;openscadpub use openscad::freecad::parts_to_fcstd;openscadpub use openscad::freecad::parts_to_fcstd_with;openscadpub use openscad::freecad::FcstdDocument;openscadpub use openscad::freecad::FcstdDocumentMeta;openscadpub use openscad::freecad::FcstdError;openscadpub use openscad::freecad::FcstdLoader;openscadpub use openscad::freecad::FcstdMesh;openscadpub use openscad::freecad::FcstdMeshSpec;openscadpub use openscad::freecad::FcstdPlacement;openscadpub use openscad::freecad::FcstdReadOptions;openscadpub use openscad::freecad::FcstdSkipped;openscadpub use openscad::freecad::FcstdWriteOptions;openscadpub use openscad::freecad::FcstdWriteReport;openscadpub use openscad::freecad::FcstdWriter;openscadpub use openscad::mechanism::DriveSpec;openscadpub use openscad::mechanism::MateSpec;openscadpub use openscad::mechanism::MateSpecKind;openscadpub use openscad::mechanism::MechanismSpec;openscadpub use openscad::mechanism::PartFit;openscadpub use openscad::mechanism::PartSpec;openscadpub use openscad::scad::clear_files;openscadpub use openscad::scad::parse_scad;openscadpub use openscad::scad::parse_scad_at;openscadpub use openscad::scad::parse_scad_file;openscadpub use openscad::scad::parse_scad_file_at;openscadpub use openscad::scad::parse_scad_file_for_parts;openscadpub use openscad::scad::parse_scad_file_with;openscadpub use openscad::scad::parse_scad_mechanism;openscadpub use openscad::scad::parse_scad_mechanism_at;openscadpub use openscad::scad::parse_scad_mechanism_file;openscadpub use openscad::scad::parse_scad_mechanism_file_at;openscadpub use openscad::scad::parse_scad_with;openscadpub use openscad::scad::parse_scad_with_base;openscadpub use openscad::scad::register_file;openscadpub use openscad::scad::scad_file_values;openscadpub use openscad::scad::scad_value;openscadpub use openscad::scad::scad_values;openscadpub use openscad::scad::scad_values_in;openscadpub use openscad::schematic::schematic_project;openscadpub use openscad::schematic::schematic_project_view;openscadpub use openscad::schematic::schematic_to_rgba;openscadpub use openscad::schematic::schematic_to_svg;openscadpub use openscad::schematic::Schematic;openscadpub use openscad::schematic::SchematicOptions;openscadpub use openscad::schematic::View;openscadpub use openscad::build_nema17;openscadpub use openscad::build_printer;openscadpub use openscad::cone;openscadpub use openscad::cube;openscadpub use openscad::cylinder;openscadpub use openscad::difference_all;openscadpub use openscad::frustum;openscadpub use openscad::geometry_bounds;openscadpub use openscad::geometry_to_stl;openscadpub use openscad::hull;openscadpub use openscad::intersection_all;openscadpub use openscad::linear_extrude;openscadpub use openscad::linear_extrude_holes;openscadpub use openscad::polyhedron;openscadpub use openscad::rotate_extrude;openscadpub use openscad::rotate_extrude_fn;openscadpub use openscad::set_origin;openscadpub use openscad::solid;openscadpub use openscad::sphere;openscadpub use openscad::sphere_fn;openscadpub use openscad::union_all;openscadpub use openscad::Origin;openscadpub use openscad::Solid;openscadpub use planet::generate_earth_maps;planetpub use planet::generate_starfield;planetpub use planet::Atmosphere;planetpub use planet::HeightField;planetpub use planet::MapBuffer;planetpub use planet::Planet;planetpub use planet::PlanetHandles;planetpub use planet::PlanetMaps;planetpub use planet::Starfield;planetpub use planet::EarthTextures;planetand non-WebAssemblypub use planet::MapSources;planetand non-WebAssemblypub use threers_audio as audio;audiopub use wgpu;renderpub use threers_codec as codec;native-codec
Modules§
- animation
- Keyframe animation. Mirrors three.js’s
AnimationClip/AnimationMixer/AnimationAction/KeyframeTrackmodel. - assembly
assembly-check - Generic checks for assemblies that move.
- brep
brep - Analytic surface provenance — every triangle knows what it came from.
- cameras
- Cameras: position/orientation in world space plus a projection matrix.
- captions
captions - Subtitles and captions — a timed-text track you can burn into exported
video, ship as a sidecar
.srt/.vtt, mux as a soft subtitle track, or draw on screen over a live render. - controls
- Camera + interaction controls.
- core
- Scene-graph and geometry primitives.
- csg
bvh-csg - Constructive solid geometry — Rust port of three-bvh-csg@0.0.16.
- curves
- Parametric curves. Mirror three.js’s curve hierarchy:
Curvebase + 2D and 3D concretes +CurvePath/Path/Shape. - easing
- Easing curves.
- exact_
csg openscad - Robust mesh-arrangement boolean kernel — the watertight path that replaces the three-bvh-csg float kernel for OpenSCAD-parity work.
- exporters
- Mesh exporters — Wavefront OBJ, STL (ASCII and binary) and Stanford PLY
(ASCII and binary) — written to match three.js r165’s
examples/jsm/exporters/{OBJ,STL,PLY}Exporter.jsbyte for byte. - extras
- Extras — algorithms ported from three.js’s
examples/jsm/utils,examples/jsm/animation, etc. - fluid
fluidormetal-fluid - An interactive 2D fluid, on the GPU.
- fur
- Fur by shells: a mesh drawn as a stack of offset copies of itself, each cut down to the cross-sections of procedural strands.
- fx
- Interactive effects on 2D elements: glossy liquids that react to the pointer, on buttons, figures and anything else with a shape.
- geometries
- Built-in geometry generators, mirroring three.js’s geometry module.
- gpu
render - Getting a device, and the limits you have to ask for.
- helpers
- Visual debug helpers.
- kinematics
- Inverse kinematics, servo physics, and gear-train simulation.
- lights
- Lights. Mirror three.js’s light hierarchy: ambient, directional, point,
spot, hemisphere, rect-area. Lights live in the scene graph as
ObjectKind::Lightvariants and contribute to the renderer’s per-frame lighting uniform buffer. - loaders
- Asset loaders. Hand-written parsers, zero binary-crate deps.
- marks
render - Data-driven marks: points, lines, arcs, instanced shapes, text labels and density fields, drawn from columns of per-instance data.
- materials
- Materials. Mirrors three.js’s
Materialfamily, includingShaderMaterialfor custom WGSL fragments. - math
- Math primitives. Mirrors three.js’s math module.
- mesh_
bvh mesh-bvh - BVH-accelerated raycasting for
BufferGeometry(three-mesh-bvh compatible). - nurbs
nurbs - NURBS curves and surfaces — the surface primitive the B-rep layer stands on.
- openscad
openscad - OpenSCAD-style solid modeling front end (Cargo feature
openscad). - origami
- Rigid origami from a planar crease pattern.
- overlay
- Immediate-mode 2D drawing over the 3D view — p5’s
rect,circle,lineandtext, for HUDs, labels, axes, plots and debug read-outs. - particles
- Particles: emitters, a physical simulation, and the things built on it — falling and settling snow, pouring and drifting sand, and presets for fire, smoke, sparks, rain, dust and fountains.
- planet
planet - Planets, moons and starfields — behind the
planetfeature. - postprocessing
render - Post-processing: three.js’s
EffectComposerand its passes. - prelude
- One import for the things nearly every scene uses.
- raytrace
raytrace - A physically-based path tracer, beside the rasteriser rather than inside it.
- renderer
render - wgpu rendering: scene traversal, material pipelines, shadows, and post-fx.
- renderers
- Alternate renderers. The primary
Rendererlives incrate::rendererand uses wgpu. This module exposes lightweight DOM-overlay renderers (CSS2D / CSS3D) — their drawing surface is HTML, so on native they are data-only descriptors that an integrator can pump into web_sys when compiled for wasm — plusSvgRenderer, which produces a complete SVG document and so needs no host at all. - scene
- sdf
- Signed distance fields: primitives, the operators that join them, and the same library in WGSL so a shader and the CPU agree on every shape.
- sketch
winit_window - A window, a scene and a loop, in one call — p5’s
setup/draw. - stats
- Stats panel data. Mirrors three.js’s
Stats(FPS + frame time + memory ring buffers). DOM rendering is left to the integrator; this struct just tracks the running averages. - step
step - STEP — ISO 10303 AP203/AP214 advanced B-rep exchange.
- strict_
float - IEEE float arithmetic in GPU shaders, for bit-level comparisons.
- textures
- Texture sources. CPU-side: own the pixel data (or a reference to it) plus
sampler/format metadata. The renderer uploads them on demand and caches the
resulting
wgpu::TexturebyArcpointer identity. - time_
smear - Time smear: every moving thing gets echoes of itself at other moments in time — before it arrives as well as after it has gone.
- utils
- Helper utilities mirroring three.js’s
BufferGeometryUtilsand assorted stand-alone math helpers (centroid, merge, normal/tangent computation). - views
render - Many cameras at once: named cameras, viewed side by side or one at a time, switched or blended between, and seen as textures — on a screen in the scene, inside another view, or inside themselves.
- volume
render - Volumes: 3D textures, and cross-sections through them.
- wgsl
- WGSL with its comments and spare blanks taken out at compile time.
Macros§
- difference
openscad - n-ary difference —
difference, ordifference!(vec_of_solids). - hull
openscad - Convex hull of solids —
hull![a, b, c]orhull!(vec_of_solids). - intersection
openscad - n-ary intersection —
intersection![a, b, c]orintersection!(vec_of_solids). - log
Non-WebAssembly - passes
- Write full-screen passes once for wgpu and the native Metal backend. See
shared_passes. - scad
openscad - Build a
Solidfrom an OpenSCAD-shaped tree. See the module docs for the grammar. - shader
- Write a shader once for wgpu and the native Metal backend. See
shared_shader. - shader_
functions - Write shader functions once for wgpu and the native Metal backend. See
ShaderFunctions. - union
openscad - n-ary union —
union![a, b, c]orunion!(vec_of_solids). - visionos_
app - Makes an [
xr::App] the Apple Vision Pro app: exportsthreers_app_run, which the SwiftUI shell (templates/visionos-app) calls with itsCompositorLayer’s layer renderer, to run the app withxr::visionos::run. Expands to nothing on other targets, so the crate still builds (and tests) on a Mac. - wgsl
- A constant WGSL source — a literal,
include_str!,concat!of those, or any other constant&strexpression — as a&'static strwithout its comments, stripped at compile time (seewgsl!).
Structs§
- Animation
Encode Options native-codec - Options for
encode_animation_rgba. - Animation
Export Progress native-codec - Progress tick for browser animation encoding.
- Apng
Encoder native-codec - Builds an APNG from RGBA frames.
- Audio
audio - Non-positional audio source. Holds shared PCM data and playback parameters.
- Audio
Analyser audio - Convenience helper computing FFT-band magnitudes from raw samples. Mirrors
three.js’s
AudioAnalyserfor the things downstream code uses (visualizer bar heights, beat detection, etc.). The actual FFT is left to the caller — this struct just holds the result vector and provides convenience accessors. - Audio
Listener audio - Receiver of positional audio. One per scene; the renderer (or the user)
updates
position/forward/upto match the camera each frame. - Box2
- Axis-aligned bounding box in 2D. Mirrors three.js’s
Box2. - Box3
- Axis-aligned bounding box in 3D. Mirrors three.js’s
Box3. - Caption
Style captions - Look, placement, and wrapping of burned-in / on-screen captions.
- Caption
Track captions - An ordered list of
Cues plus the metadata a subtitle track carries. - Color
- Color
Parse Error - What went wrong parsing a CSS colour.
- Color
Ramp - A gradient: colours at positions, blended between.
- Color
Scale - A mapping from numbers to colours.
- Cue
captions - One timed caption: a time range plus the text shown during it.
- Cylindrical
- Cylindrical coordinates (radius around Y, theta around Y, height y).
Matches three.js’s
Cylindrical. - Euler
- Euler angles in radians plus their axis order — three.js’s
Euler. - Frustum
- View frustum as six planes (right, left, bottom, top, far, near).
Mirrors three.js’s
Frustum. - GifDecoder
gif - Indexed GIF reader with lazy or eager frame decoding.
- GifEncoder
gif - Builds an animated GIF from RGBA frames.
- GifFrame
gif - One composited full-canvas frame.
- GifFrame
Meta gif - Per-frame descriptor metadata (before LZW decode / compositing).
- GifInfo
gif - Logical-screen metadata from a GIF file.
- GifOptions
gif - Tunables for
GifEncoder/GifWriter/encode_gif. - GifWriter
gif - Incremental GIF writer using per-frame local palettes.
- H264
Encoder native-codec - A from-scratch H.264 encoder (IDR-only,
I_PCM). - Hevc
Encoder native-codec - A from-scratch HEVC encoder (milestone 3: IDR-only,
I_PCM). - Line3
- Line segment in 3D. Mirrors three.js’s
Line3. - Matrix3
- A 3x3 column-major matrix (same layout as three.js’s
Matrix3). - Matrix4
- A 4x4 column-major matrix (same layout as three.js’s
Matrix4). - Noop
Backend audio - Palette
- Distinct colours for categories: d3’s
scaleOrdinalwith a scheme. Not interpolated — category 3 is the fourth colour, and past the end the colours repeat. - Plane
- Plane in Hessian-normal form: dot(normal, p) + constant == 0.
Mirrors three.js’s
Plane. - Positional
Audio audio - Spatial audio source. Inherits all
Audioparameters plus a distance model. Attach one withObject3D::audioin threers; it points along the node’s +Z, as in three.js. - Quaternion
- Ray
- Mirrors three.js’s
Ray. - Reconstruction
native-codec - Reconstruction a conformant decoder produces.
- Spatial
Mix audio - How a source sounds from a listener.
- Sphere
- Bounding sphere. Mirrors three.js’s
math::Sphere(distinct fromSphereGeometry). - Spherical
- Spherical coordinates with
phifrom +Y (polar) andthetaaround Y (azimuth). Matches three.js’sSpherical. - Transparent
Encoder native-codec - Encodes transparent frames and muxes them into an Apple-compatible container.
- Triangle
- Mirrors three.js’s
Triangle. - Vector2
- Vector3
- Vector4
- Webm
Frame native-codec - One coded frame to place in the stream.
- Webm
Params native-codec - Parameters for
mux_webm. - Yuv420
Frame native-codec - A planar 4:2:0 (
yuv420p) picture at display resolution.width/heightmust be even (chroma is subsampled 2×2).yiswidth × height;u/vare(width/2) × (height/2).
Enums§
- Animation
Encode Error native-codec - Errors produced while encoding a browser animation.
- Animation
Export Phase native-codec - Progress phase for
encode_animation_rgba_with_progress. - Browser
Codec native-codec - Browser-friendly animation containers (no ffmpeg).
- Caption
Align captions - Horizontal alignment of caption lines within the caption box.
- Caption
Anchor captions - Which edge of the frame the caption block is anchored to.
- Caption
Error captions - Why parsing a subtitle file failed.
- Caption
Format captions - Timed-text file format.
- Color
Space - A space to interpolate colours in — see
Color::mix. - Disposal
Method gif - How the decoder treats the canvas after displaying a frame (GCE field).
- Disposal
Mode gif - How a frame’s pixels are disposed before the following frame.
- Distance
Model audio - How gain falls with distance: the three models of Web Audio’s
PannerNode, which three.js’sPositionalAudiohands them to. - Euler
Order - The axis order of an
Euler— three.js’s'XYZ','YXZ', … — naming the intrinsic rotation order:XYZrotates about X, then the new Y, then the new Z, i.e. the matrixRx · Ry · Rz. - GifError
gif - Why a GIF could not be decoded.
- GifVersion
gif - GIF version from the six-byte signature.
- LzwClear
Mode gif - Policy used to clear the GIF LZW dictionary during compression.
- Palette
Mode gif - How the color table(s) are chosen.
- Quantizer
Kind gif - Quantization algorithm for reducing opaque colors.
- Scale
Kind - How a
ColorScaleturns a value into a position on its ramp. - Scheme
Kind - What a named scheme is for.
- Tone
Mapping - How the renderer compresses linear HDR radiance into displayable range.
- Webm
Codec native-codec - The video codec carried by the track (selects the Matroska
CodecID).
Traits§
- Audio
Backend audio - Audio playback backend. The default
NoopBackenddoes nothing; users can plug in cpal/rodio natively or web_sys::AudioContext on wasm by implementing this trait themselves.
Functions§
- decode_
gif gif - Decode an entire GIF into logical-screen metadata and composited RGBA frames.
- encode_
animation_ rgba native-codec - Encode tightly-packed RGBA8 frames into a browser-friendly animation.
- encode_
animation_ rgba_ with_ progress native-codec - Like
encode_animation_rgba, with encode-phase progress callbacks. - encode_
gif gif - Encode RGBA frames to a GIF byte stream (same options as
GifEncoder). - encode_
gray_ webm native-codec - Encode
frame_countsolid mid-gray VP9 keyframes and mux them into a.webm. Uses the nativecrate::vp9encoder — no ffmpeg, no C bindings — so it runs on native andwasm32. - encode_
inter_ frame native-codec - Encode a P-frame with per-block SAD motion search + 4×4 DCT residual.
- encode_
inter_ frame_ altref native-codec - Like
encode_inter_frame_golden, also allowing ALTREF per block. - encode_
inter_ frame_ compound native-codec - Like
encode_inter_frame_altref, but every block is LAST+ALTREF compound (REFERENCE_MODE= compound; prediction is the average of the two refs). - encode_
inter_ frame_ golden native-codec - Like
encode_inter_frame, but each block may also predict fromgolden. - encode_
inter_ frame_ refresh native-codec - LAST-only ME P-frame with a custom
refresh_frame_flagsbitmask. - encode_
inter_ newmv_ residual native-codec - Encode a NEWMV P-frame with 4×4 DCT residual against LAST.
- encode_
inter_ newmv_ skip native-codec - Encode a showable P-frame: NEWMV + skip with a constant MV in 1/8-pel luma.
- encode_
inter_ residual native-codec - Encode a ZEROMV P-frame with 4×4 DCT residual against LAST.
- encode_
inter_ zeromv_ skip native-codec - Encode a showable P-frame that copies
reference(ZEROMV + skip on LAST). - encode_
intra_ frame native-codec - Encode one VP9 intra keyframe (4×4 DCT residual). Returns
(bitstream, recon). - encode_
intra_ gray native-codec - Encode a solid-gray VP9 intra keyframe of
width × height(currently only 64×64 — a single superblock — is supported). - encode_
mp4 native-codec - Encode
framesof YUV420 pictures into an MP4 byte stream. - encode_
mp4_ with_ captions native-codec - Like
encode_mp4, optionally muxing a softtx3gcaption track. - encode_
webm native-codec - Encode VP9 keyframes from planar YUV (optional alpha) and mux into a
.webm. - format_
animation_ progress native-codec - Ready-to-display animation progress line.
- mux_
webm native-codec - Mux the frames into a single-track
.webmbyte stream.
Type Aliases§
- Decoded
Frame Deprecated gif - The old name of
GifFrame. - Ramp
Space - How a ramp blends between its stops: any
ColorSpace. OkLab by default — perceptually even, the midpoint of two colours the one a person would name; linear light is right for a ramp standing in for light; sRGB is what CSS gradients and d3’s default do; OkLCh and LCh keep a ramp between saturated colours saturated.