scene library
3D rendering for Flutter, built on Flutter GPU and Impeller.
The entry points most applications need are:
- Scene — the scene graph root and renderer. Construct one, attach
Nodes, and call Scene.render from a
CustomPainter(or anydart:uiCanvas). - Node — a transform in the scene graph that may carry a Mesh and
child nodes. Load 3D content with loadScene (preprocessed
.fscenebpackages, by source path) or Node.fromGlbBytes / Node.fromGlbAsset (runtime glTF binary). - Camera / PerspectiveCamera — view configuration passed to Scene.render.
- Material, PhysicallyBasedMaterial, UnlitMaterial,
Environment— shading. - Animation, AnimationClip, AnimationPlayer — playback and blending of imported animations.
Flutter Scene currently requires the Flutter master channel because it depends on the Flutter GPU API.
Classes
- AmbientOcclusionSettings Rendering
- Screen-space ambient occlusion settings for a Scene.
- Animation Animation
- A reusable description of an animation, parsed from a model.
- AnimationClip Animation
- An instance of an Animation that has been bound to a specific Node.
- AnimationPlayer Animation
- Drives playback and blending for the AnimationClips on a single node subtree.
- BasicCollider Physics
- Pure-Dart Collider implementation registered with the ancestor BasicPhysicsWorld on mount.
- BasicKinematicBody Physics
- Pure-Dart RigidBody implementation. Always BodyType.kinematic; the user moves the owning node's transform directly and the body records velocity for components that read it. There is no dynamics solver in the basic backend, so force and impulse APIs are no-ops.
- BasicPhysicsWorld Physics
- Pure-Dart PhysicsWorld suitable for picking, area triggers, and kinematic-only gameplay.
- BezierPath Geometry
- A path of joined cubic Bezier segments.
- BloomSettings Rendering
- Makes bright areas bleed light into their surroundings. Computed in a chain of HDR passes and added back to the scene before tone mapping.
- BoxShape Physics
- An axis-aligned box of the given halfExtents centered at the collider's local origin.
- Camera Scene graph
- A view onto a scene: a world-space eye position and orientation paired with a lens projection, used by Scene.render to map the scene into clip space.
- CameraComponent Scene graph
- An engine Component that places a Camera in the scene.
- CameraProjection Scene graph
- A lens projection that maps view-space coordinates into clip space.
- CapsuleShape Physics
- A capsule aligned with the local Y axis. halfHeight is the half length of the cylindrical section, excluding the hemispherical caps.
- CatmullRomPath Geometry
- A smooth curve passing through every one of a list of points.
- ChromaticAberrationSettings Rendering
- Splits the red and blue channels toward the edges, like a simple lens. Sampled from the scene color before grading and tone mapping.
- Collider Physics
- Common surface for a collision volume attached to a Node.
- CollisionBegan Physics
- Fired the first step a pair of solid colliders touch.
- CollisionEnded Physics
- Fired the step a previously-touching solid pair separates.
- CollisionEvent Physics
- Base type for collision lifecycle events streamed by a physics world.
- ColorGradingSettings Rendering
- Color grading applied to the linear HDR scene color, before exposure and tone mapping.
- Component Scene graph
- A unit of data or behavior attached to a Node.
- CompoundChild Physics
- One child of a CompoundShape: a shape positioned by localPose relative to the compound's origin.
- CompoundShape Physics
- A union of children, each positioned by its own local pose.
- ContactPoint Physics
- One contact point in a CollisionBegan event.
- ConvexHullShape Physics
-
The convex hull of points, stored as packed
xyztriplets. - CuboidGeometry Geometry
-
An axis-aligned box geometry spanning
-extents/2to+extents/2on each axis, with flat per-face normals. - CylinderShape Physics
- A cylinder aligned with the local Y axis. halfHeight is half the total height.
- DashPattern Geometry
- A repeating dash-and-gap pattern for a PolylineGeometry, measured in scene units along the line's arc length.
- DirectionalLight Lighting and environment
- An infinitely-distant light source (e.g. the sun) that illuminates the whole scene from a single direction.
- DirectionalLightComponent Scene graph
- An engine Component that places a DirectionalLight in the scene.
- EnvironmentMap Lighting and environment
- A source of image-based lighting: diffuse irradiance plus prefiltered specular radiance, both derived from an equirectangular environment.
- EnvironmentSkySource Lighting and environment
- Shows the scene's image-based-lighting environment as the background, optionally blurred.
- ExtrudeGeometry Geometry
- An arbitrary closed 2D profile swept along a ScenePath.
- FilmGrainSettings Rendering
- Adds animated noise over the final image, after tone mapping.
- FixedJoint Physics
- Welds two bodies together with zero degrees of freedom.
- FmatMaterialRegistry Materials
-
Resolves and loads
.fmatmaterials registered through DataAssets. - GenericJoint Physics
- A fully configurable six-degree-of-freedom joint.
- Geometry Geometry
- Vertex (and optional index) data along with the vertex shader used to transform it.
- GeometryBuilder Geometry
- Assembles a MeshGeometry one vertex and triangle at a time.
- GradientSkySource Lighting and environment
- A stylized gradient sky: zenith, horizon, and ground colors with an HDR sun disk.
- HeightFieldShape Physics
- A row-major heightfield of width x depth samples, scaled by scale. Heights are sampled in the local XZ plane and offset along Y.
- InstancedMesh Scene graph
- Many copies of one Geometry / Material pair, each placed by its own model transform.
- InstancedMeshComponent Scene graph
- An engine Component that draws an InstancedMesh.
- Joint Physics
- A constraint linking the owning node's rigid body to another body.
- JointAxisConfig Physics
- The configuration of one of a GenericJoint's six axes.
- JointMotor Physics
- A spring-damper drive on a single GenericJoint axis.
- Lighting Lighting and environment
- The lighting state handed to a Material when it binds for a draw.
- Material Materials
- Base class for shading a MeshPrimitive.
- MaterialParameters Materials
- Type-checked, name-addressed parameters for a custom material.
- Mesh Geometry
- Defines the shape and appearance of a 3D model in the scene.
- MeshComponent Scene graph
- An engine Component that draws a Mesh.
- MeshGeometry Geometry
- A triangle mesh built at runtime from vertex attribute arrays.
- MeshPrimitive Geometry
- Represents a single part of a Mesh, containing both Geometry and Material properties.
- Node Scene graph
-
A
Noderepresents a single element in a 3D scene graph. - NodeCamera Scene graph
-
A Camera whose view comes from a node's world transform: the
+Zaxis is the look direction,+Yis up, and the translation is the eye. This is the inverse of the eye/target/up convention PerspectiveCamera builds, so a node placed atinverse(camera.getViewMatrix())yields the same view. - OverlapHit Physics
- One collider returned by an overlap query (sphere or box).
- PerspectiveCamera Scene graph
- A standard pinhole-style perspective camera.
- PerspectiveProjection Scene graph
- A standard pinhole perspective projection.
- PhysicallyBasedMaterial Materials
- A glTF-style metallic-roughness physically based material with image-based lighting.
- PhysicalSkySource Lighting and environment
- A physically based daylight sky: an analytic single-scattering atmosphere (Rayleigh and Mie terms) with an HDR sun disk, producing plausible day, sunset, and twilight skies from a sun direction.
- PhysicsMaterial Physics
- Surface properties (friction, restitution, density) of a collider.
- PhysicsWorld Physics
- The simulation world for a subtree of the scene graph.
- PlaneGeometry Geometry
-
A flat rectangular grid in the XZ plane, centered on the origin, with
its surface facing
+Y. - PolylineGeometry Geometry
- A thick, camera-facing line through a list of points.
- PolylinePath Geometry
- A path of straight segments connecting a list of points.
- PostEffect Rendering
- A custom, user-authored post-processing effect: a fragment shader that reads the current color and writes a new one.
- PostProcessSettings Rendering
- Built-in post-processing settings for a Scene.
- PreprocessedMaterial Materials
-
A material driven by a
.fmatcustom-material shader and its sidecar metadata (produced at build time bybuildMaterials). - PreprocessedSky Lighting and environment
-
A sky driven by a
.fmatsky shader (sky { vec3 Sky(vec3 direction) }) and its sidecar metadata (produced at build time bybuildMaterials). - PrismaticJoint Physics
- A slider: one translational degree of freedom along a shared axis.
- RaycastHit Physics
-
The closest collider intersected by a
Ray, or one entry of a raycast-all result list. - RenderTexture Rendering
-
An offscreen render target a
RenderViewcan render into. - RenderTextureSampling Rendering
- Sampling options used when a material samples a RenderTexture.
- RenderTextureUpdate Rendering
- When a RenderTexture re-renders.
- RenderTextureView
- Displays a live RenderTexture in the widget tree.
- RenderView Rendering
-
One view of a
Scene: a camera plus where and how its image is drawn. - RevoluteJoint Physics
- A hinge: one rotational degree of freedom around a shared axis.
- RibbonGeometry Geometry
- A flat strip of constant width swept along a ScenePath.
- RigidBody Physics
- A simulated rigid body attached to a Node.
- Scene Scene graph
- Represents a 3D scene, which is a collection of nodes that can be rendered onto the screen.
- ScenePath Geometry
- A curve through 3D space, independent of any geometry or rendering.
- ScenePathFrame Geometry
- An oriented coordinate frame at a point along a ScenePath.
- ScenePointer Picking and input
- A programmatic pointer into a scene: a crosshair, a gamepad-driven cursor, a VR laser, or the built-in pointer behind automatic widget input.
- SceneRaycastHit Picking and input
-
A render-geometry intersection from raycastNode (or
Scene.raycast). - SceneRegistry Assets and loading
-
Resolves DataAssets-backed
.fscenebfiles by source path, the.fscenecounterpart ofModelRegistry. - SceneScope
- Exposes the active Scene (and the per-frame elapsed time) to descendants of a SceneView.
- SceneView
- A widget that renders a Scene and drives its per-frame repaint.
- ShaderMaterial Materials
- A Material backed by a caller-supplied fragment shader.
- ShaderSkySource Lighting and environment
- Draws a custom sky from a fragment shader.
- ShadowCascade Lighting and environment
- One cascade of a cascaded shadow map, produced by DirectionalLight.computeCascades.
- Shape Physics
- Geometric description of a collider's volume.
- ShapeCastHit Physics
- The first collider intersected by a shape cast, with the same fields as RaycastHit plus the cast direction's hit distance.
- Skin Geometry
- A skeletal binding used by skinned meshes for animation.
- SkinnedGeometry Geometry
- Geometry whose vertices use the skinned 80-byte layout: the unskinned attributes followed by 4 joint indices and 4 joint weights.
- Skybox Lighting and environment
- The visible background drawn behind a Scene.
- SkyEnvironment Lighting and environment
-
Drives
Scene.environmentfrom a sky on a refresh policy. - SkySource Lighting and environment
- A source of skybox color as a function of world-space view direction.
- SphereGeometry Geometry
- A UV sphere centered on the origin.
- SphereShape
- A sphere centered at the collider's local origin.
- SphericalJoint
- A ball-and-socket joint: three rotational degrees of freedom, zero translational.
- Surface Rendering
- Manages the swapchain color textures a Scene composites onto the Flutter canvas, plus the pools of transient render-graph attachments.
- TriggerEntered Physics
- Fired the first step a non-trigger collider overlaps a trigger volume.
- TriggerExited Physics
- Fired the step a previously-overlapping pair stops overlapping a trigger volume.
- TriMeshShape Physics
-
A triangle mesh defined by vertices (packed
xyztriplets) and indices (groups of three vertex indices forming one triangle each). - TubeGeometry Geometry
- A round cross-section of constant radius swept along a ScenePath.
- UnlitMaterial Materials
- A material that draws geometry with a flat color or texture, ignoring scene lighting.
- UnskinnedGeometry Geometry
-
Geometry whose vertices use the unskinned 48-byte layout: position
(
vec3), normal (vec3), tex coords (vec2), color (vec4). - VignetteSettings Rendering
- Darkens the image toward the edges, after tone mapping.
- WedgeGeometry Geometry
-
A triangular-prism wedge (a ramp), centered on the origin in X and Z
with its base on the
y = 0plane. - WidgetComponent
- A live widget subtree on a scene surface.
- WidgetTexture
- Hosts a live widget subtree and streams its visual output into a WidgetTextureController's texture for sampling inside a scene.
- WidgetTextureController
- Owns the gpu.Texture a WidgetTexture streams its child into.
- WidgetUpdatePolicy
-
When a WidgetTexture (or a
WidgetComponent) re-captures its child.
Enums
- AlphaMode Materials
-
How a PhysicallyBasedMaterial's alpha channel is interpreted,
matching glTF's
alphaMode. - AntiAliasingMode Scene graph
- Anti-aliasing strategy used when rendering a Scene.
- BodyType Physics
- Simulation mode for a RigidBody.
- CombineRule Physics
- How a per-contact friction or restitution value is derived from the two participating materials.
- GeometryStorage Geometry
- How a MeshGeometry manages its GPU buffers over its lifetime.
- JointAxis Physics
- One of the six degrees of freedom a GenericJoint constrains. The linear axes are translations along, and the angular axes rotations about, the joint frame's local X / Y / Z (oriented by the joint's local bases on each body).
- JointAxisMotion Physics
- Whether a GenericJoint axis is locked, free, or limited.
- JointMotorModel
- How a JointMotor turns its drive parameters into a force.
- PolylineCap Geometry
- How a PolylineGeometry finishes its two end points.
- PolylineWidthMode Geometry
- How a PolylineGeometry's width is measured.
- PostInsertion Rendering
- Where in the post-processing chain a PostEffect runs.
- RibbonAlignment Geometry
- How a RibbonGeometry orients its strip across the path.
- SkyEnvironmentRefresh Lighting and environment
- When a SkyEnvironment re-bakes the sky into the scene's lighting.
- SpecularAmbientOcclusionMode Rendering
- How AmbientOcclusionSettings occludes indirect specular reflections.
- ToneMappingMode Rendering
- Tone mapping operator applied when resolving the linear HDR scene color to the display-referred image (see Scene.toneMapping).
- WidgetInput
- How a WidgetComponent receives pointer input.
Mixins
- SceneGraph Scene graph
-
Defines a common interface for managing a scene graph, allowing the addition and removal of
Nodes.
Extensions
- QuaternionSlerp on Quaternion Scene graph
-
Spherical interpolation helpers on
Quaternion. - Vector3Lerp on Vector3 Scene graph
-
Per-component arithmetic helpers on
Vector3.
Constants
- kDiffuseShCoefficientCount → const int Lighting and environment
- Number of L2 spherical-harmonic coefficients used for diffuse irradiance (bands 0..2).
- kRenderLayerAll → const int Rendering
- A layer mask that selects every layer (the default render-view mask).
- kRenderLayerDefault → const int Rendering
- The default layer a Node occupies (bit 0).
Properties
- baseShaderLibrary → ShaderLibrary Assets and loading
-
The shader bundle shipped with
flutter_scene.no setter
Functions
-
environmentAssetPathOf(
EnvironmentMap environment) → String? Lighting and environment -
The radiance asset path
environmentwas loaded from through EnvironmentMap.fromAssets, or null for environments built another way. -
gpuTextureFromAsset(
String assetPath) → Future< Assets and loadingTexture> -
Loads an image from the asset bundle at
assetPathand uploads it as a Flutter GPU texture. -
gpuTextureFromImage(
Image image) → Future< Assets and loadingTexture> -
Uploads a decoded
dart:uiui.Image to a Flutter GPU texture. -
imageFromAsset(
String assetPath, {AssetBundle? bundle}) → Future< Assets and loadingImage> -
Loads and decodes an image from the asset bundle at
assetPath. -
imageFromBytes(
Uint8List bytes) → Future< Assets and loadingImage> -
Decodes an encoded image (PNG, JPEG, etc.) from raw
bytes. -
loadBaseShaderLibrary(
) → Future< Assets and loadingvoid> - Asynchronously loads and caches the base shader bundle. Idempotent. Called by Scene.initializeStaticResources so the synchronous baseShaderLibrary getter has a cached library to return (shader assets can't be read synchronously on any backend).
-
loadFmatMaterial(
String sourcePath, {String? package, String? bundleName, AssetBundle? bundle}) → Future< MaterialsPreprocessedMaterial> -
loadFmatSky(
String sourcePath, {String? package, String? bundleName, AssetBundle? bundle}) → Future< MaterialsPreprocessedSky> -
Loads a DataAssets-backed
.fmatsky by its source path relative to the owning package's root (for exampleassets/gradient_sky.fmat). -
loadScene(
String sourcePath, {String? package, AssetBundle? bundle, FsceneComponentRegistry? registry, SceneReloadCallback? onReload, Scene? applyStageTo}) → Future< Node> -
Loads a DataAssets-backed
.fscenebscene by its source path relative to the owning package's root (for exampleassets/levels/forest.glb). -
loadSceneSubtree(
Node node, {String? package, AssetBundle? bundle, FsceneComponentRegistry? registry}) → Future< Assets and loadingvoid> -
Streams a lazy placeholder
node's prefab content under it, resolving the referenced prefab by its source path (the registry-aware counterpart ofloadSubtreefor scenes loaded with loadScene). -
prefilterEquirectRadiance(
Texture sourceEquirect, {bool sourceIsLinear = false, bool mipLayout = false}) → Texture Lighting and environment - Prefilters an equirectangular radiance texture for image-based specular lighting.
-
raycastNode(
Node root, Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool where(Node node)?, bool includeInvisible = false}) → SceneRaycastHit? Picking and input -
Casts
ray(direction need not be normalized) throughroot's subtree and returns the nearest hit, or null. -
raycastNodeAll(
Node root, Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool where(Node node)?, bool includeInvisible = false}) → List< Picking and inputSceneRaycastHit> -
Casts
raythroughroot's subtree and returns every hit, sorted nearest-first. Parameters as in raycastNode.
Typedefs
-
GltfResourceResolver
= Future<
Uint8List> Function(String uri) Assets and loading -
Resolves an external resource referenced by a multi-file glTF
document (a
.binbuffer or an image file). - SceneCameraBuilder = Camera Function(Duration elapsed)
-
Builds a Camera for the current frame from the
elapsedtime since the view started ticking. Use this for time-based cameras (for example an orbiting view); pass a fixed SceneView.camera instead when the camera does not change over time. - SceneReloadCallback = void Function(Node root) Assets and loading
-
Called after a hot-reloaded scene has been patched in place (see
loadScene), so the app can re-apply per-instance customizations the
patch may have discarded: re-apply a custom material, or re-grab inner
nodes by name.
rootis the same root instance the app holds. - SceneTickCallback = void Function(Duration elapsed, double deltaSeconds)
-
Called once per frame with the total
elapsedtime and thedeltaSecondssince the previous tick. Drive per-frame app logic here, or advance the scene with a supplied timestep via Scene.update (after which Scene.render skips its implicit wall-clock tick for that frame).