Scene
A realtime 3D engine for Flutter
Scene extends Flutter into a complete toolkit for building incredible 3D multiplatform apps. Rendering, physics, audio, tooling, and a full asset pipeline.
Website ยท Docs ยท Examples App ยท FAQ
Why Scene exists
Scene began its life inside the Flutter Engine, as a C++ module for Impeller with a declarative widget interface exposed through a 3D API in the Flutter SDK. Flutter GPU was built initially to set this project free, providing the low-level GPU access needed to develop Scene outside the engine, as an ordinary ecosystem of Dart packages.
That origin shapes the project's philosophy. Scene is a full 3D engine and toolkit that makes Flutter GPU practical to build on, spanning rendering, physics, audio, editor tooling, and asset support across every target Flutter runs on. And the relationship flows both ways by design. The work of building Scene continually exercises and improves Flutter's internal graphics stack, so Impeller and Flutter GPU get better because Scene exists.
The goal has always been to pave the way for advanced graphics in Flutter. In line with the goals set out in Flutter GPU's original design doc, Scene aims to de-fracture, unite, and elevate Flutter's graphics ecosystem, so that building incredible 3D experiences with Flutter and Dart no longer requires engine forks, complicated external renderer integrations, or giving up platforms to get advanced features.
Scene is built by a former core Flutter engine team member who spent four years on Flutter, most of it building Impeller and Flutter GPU.
Getting started
flutter pub add flutter_scene
dart run flutter_scene:init
init sets up the asset pipeline, which is the recommended way to use Scene.
Drop sources under assets/, load them by their source path, and render:
final level = await loadScene('assets/level.glb');
scene.add(level);
// ...
SceneView(scene, cameraBuilder: (elapsed) => PerspectiveCamera(...));
The same code runs on web, and the engine's shaders are compiled for you during the build by flutter_scene's own build hook. Rendering goes through Flutter GPU, which is off by default, so enable it once per platform (below). The web needs nothing.
Impeller, which Flutter GPU builds on, is the default renderer on every native platform as of 3.47, so there is nothing to do for it.
Coding agents
This package ships a set of agent skills so a coding assistant writes idiomatic
Scene instead of guessing: correct usage and traps, the run-settle-capture
verification loop, copy-paste look presets, procedural content, and
performance. dart run flutter_scene:init offers to install them, and dart run flutter_scene:skills
installs, updates, or checks them on their own without touching your build hook.
Upgrading Scene can carry newer revisions; dart run flutter_scene:skills --check reports whether any are available.
Enable Flutter GPU
While developing, pass the flags on the command line:
flutter run --enable-flutter-gpu
To turn it on permanently, for every run and for the app you ship, edit the platform file:
| Platform | File | Add |
|---|---|---|
| iOS | ios/Runner/Info.plist |
<key>FLTEnableFlutterGPU</key><true/> |
| Android | android/app/src/main/AndroidManifest.xml, in <application> |
<meta-data android:name="io.flutter.embedding.android.EnableFlutterGPU" android:value="true" /> |
| macOS | macos/Runner/Info.plist |
<key>FLTEnableFlutterGPU</key><true/> |
| Web | nothing |
Windows and Linux set it on the DartProject their runner builds. This needs Flutter 3.47.1.
// linux/runner/my_application.cc
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_enable_flutter_gpu(project, TRUE);
// windows/runner/main.cpp
flutter::DartProject project(L"data");
project.set_enable_flutter_gpu(true);
On 3.47.0 there is no such setting, so desktop takes the command-line flags per run, and release builds compile the engine's environment switches out, meaning a shipped Windows or Linux release needs 3.47.1.
A scene with no assets
The built-in geometry needs no asset pipeline, so a cube renders straight after flutter pub add flutter_scene:
import 'package:flutter/material.dart';
import 'package:flutter_scene/scene.dart';
import 'package:vector_math/vector_math.dart' as vm;
void main() => runApp(const MaterialApp(home: CubeView()));
class CubeView extends StatefulWidget {
const CubeView({super.key});
@override
State<CubeView> createState() => _CubeViewState();
}
class _CubeViewState extends State<CubeView> {
final Scene scene = Scene();
bool ready = false;
@override
void initState() {
super.initState();
// Geometry and materials touch the shader bundle, so build them once the
// engine's static resources are up.
Scene.initializeStaticResources().then((_) {
scene.add(
Node(
mesh: Mesh(
CuboidGeometry(vm.Vector3(1, 1, 1)),
PhysicallyBasedMaterial(),
),
),
);
if (mounted) setState(() => ready = true);
});
}
@override
Widget build(BuildContext context) {
if (!ready) return const SizedBox.expand();
return SceneView(
scene,
camera: PerspectiveCamera(position: vm.Vector3(2, 2, -4)),
);
}
}
The scene's default studio environment lights it, so there is nothing else to set up.
Moving a node
Every Node carries a transform relative to its parent. Read and write it one
component at a time, or as a whole matrix through node.localTransform.
node.position = vm.Vector3(0, 1, 0);
node.rotation = vm.Quaternion.axisAngle(vm.Vector3(0, 1, 0), 0.5);
node.scale = vm.Vector3.all(2);
node.position += vm.Vector3(0, 0.1, 0);
Each getter returns a copy, so node.position.y = 1 moves nothing. Assign the
value back instead. Debug builds throw on an edit that cannot reach the node,
whether it is to a returned copy or to localTransform in place.
Built-in geometry
Every class below builds vertex data for you and drops into a Mesh the same way CuboidGeometry does above.
- Primitives:
CuboidGeometry,SphereGeometry,IcosphereGeometry,CapsuleGeometry,CylinderGeometry,TorusGeometry,PlaneGeometry,DiscGeometry,RingGeometry,WedgeGeometry. - Swept along a path or profile:
ExtrudeGeometry,TubeGeometry,RibbonGeometry. - Lines and camera-facing quads:
PolylineGeometry,LineSegmentsGeometry,BillboardGeometry. - Your own vertex data:
MeshGeometryandGeometryBuilder.
The asset pipeline
init writes a hook/build.dart that converts your assets at build time,
creates flutter_scene_generated/ with a .gitignore for its outputs, and adds
that one directory to flutter.assets in your pubspec.yaml. It is safe to run
again, and it will not overwrite a hook/build.dart you wrote yourself. It
prints a block to paste into your existing build() callback instead.
The hook it writes discovers .glb and .fscene models, .fmat materials, and
loose images under assets/, and converts each one:
// hook/build.dart
import 'package:flutter_scene/build_hooks.dart';
import 'package:hooks/hooks.dart';
void main(List<String> args) async {
await build(args, (input, output) async {
buildScenes(buildInput: input, buildOutput: output);
await buildMaterials(buildInput: input, buildOutput: output);
});
}
The one line it adds to your pubspec.yaml:
flutter:
assets:
- flutter_scene_generated/
Upgrading from an earlier version, run it again. Generated assets now go into
that directory on every Flutter release, so re-running init migrates the hook
it wrote and adds the pubspec entry. A hook still asking for a removed asset
mode fails the build and names its replacement.
From then on, drop sources under assets/ and load them by source path:
final level = await loadScene('assets/level.glb');
final toon = await loadFmatMaterial('assets/toon.fmat');
final ground = await loadTexture('assets/ground.png');
A .glb has to be parsed and unpacked into GPU-ready form every time the app
loads it. The pipeline does that work once, at build time, into the .fsceneb
format the engine reads directly, so loading a model at runtime costs far less.
Prefer it for anything that ships with your app. It is also how .fmat custom
materials and block-compressed textures with full mip chains reach you, and
editing any source reconverts just that source and hot reloads it.
Keep your sources in version control. The generated directory holds compiled
output tied to the Flutter engine that built it, which is why the hook manages
its .gitignore for you.
For a model that only exists once the app is running, because you download it or
the user supplies it, import the .glb directly with
Node.fromGlbAsset('assets/model.glb'). That needs no hook, and it parses the
glTF on every load, so prefer the pipeline whenever the model ships with you.
Where to go next
fscene.dev carries the full documentation. Your first scene renders something on screen from here, and the guides cover each subsystem in depth with live demos, including assets and loading, materials, lighting and environment, animation, and cameras. The API reference documents every public symbol.
Requirements
Flutter Scene is pre-1.0 and evolving quickly. Minor releases can carry breaking changes, and every change is documented in the CHANGELOG.
- Flutter 3.47 (stable) or newer. Rendering is built on Flutter GPU, which every platform except the web needs turned on once (see Enable Flutter GPU).
- On native platforms rendering runs on Impeller, Flutter's default renderer on every native platform as of 3.47. The web has no Impeller, so the package ships its own WebGL2 backend and runs there without flags.
Features
Rendering
- Physically based materials with image-based lighting, plus a built-in procedural studio environment so an imported model looks good with zero lighting setup.
- Directional, point, and spot lights. Directional and spot lights cast shadows, with cached shadow tiles for static geometry and alpha-masked shadow casters.
- A full post-processing stack, with HDR tone mapping, physical camera exposure, automatic eye adaptation, bloom, fog, god rays, screen-space reflections, depth of field with bokeh, and anti-aliasing with resolution scaling.
- Sky materials with live IBL rebaking, HDR/EXR environment import, and smooth environment cross-fades.
- 3D Gaussian splatting, loading
.plyand.splatcaptures as scene nodes. - Instanced rendering, automatic geometry LODs, and an allocation-light frame loop.
- A particle system driven by configurable emitter and behavior modules.
Materials and shaders
- A custom-material workflow (
.fmat) covering both fragment and vertex stages, with shader hot reload. - Per-frame scene inputs for custom shaders, including scene depth and shadow data, plus a depth-aware and shadow-aware custom post-pass API.
- A noise library with matched CPU and GPU implementations.
Assets and animation
- glTF (
.glb) import at runtime, or pre-converted at build time into the engine's.fscenebformat through build hooks, loaded by source path. - The
.fscene/.fscenebscene description format, human-readable as text and fast to load as binary, with prefab support. - KTX2 compressed textures with full mip chains,
.fstextexture builds, and HDR/EXR environment decoding. - Skinned meshes and a blended animation system, with declarative per-clip playback control.
KHR_materials_variantssupport in both import paths, with instant variant switching.- Hot reload for models, shaders, textures, and environments.
App integration
- A
SceneViewwidget with both an imperative scene-graph API and a fully declarative widget API (SceneNode,SceneMesh, andSceneModelwith async loading placeholders). - Interactive Flutter widgets embedded on 3D surfaces, with pointer raycasting into the scene.
- Screen-reader accessibility, exposing scene content through Flutter semantics.
- Render-target control, split-screen and multi-view layouts, and synchronous frame capture as
ui.Image. - Geometry readback and procedural geometry builders with derivation operations.
Ecosystem
- Physics through
flutter_scene_rapierorflutter_scene_box3d, both implementing the engine's shared physics contract. - Audio components with SoLoud and FMOD backends, developed in this repository.
- The Flutter Scene Editor, a desktop scene-editing app with an MCP server for agent-driven editing, in development in this repository.
FAQ
Q: What platforms does this package support?
On native platforms flutter_scene runs anywhere Impeller does. On the web it runs on a built-in WebGL2 backend.
Every native platform needs Flutter GPU turned on. Impeller, which it builds on, is already the default everywhere. Enable Flutter GPU has the file and the key for each.
On the web, no flags are needed; it works under both the CanvasKit and Skwasm renderers.
| Platform | Status |
|---|---|
| iOS | ๐ข Supported |
| Android | ๐ข Supported |
| Web | ๐ข Supported |
| MacOS | ๐ข Supported |
| Windows | ๐ข Supported (3.47.1 to ship a release) |
| Linux | ๐ข Supported (3.47.1 to ship a release) |
| Custom embedders | ๐ข Supported |
Q: How does web support work?
Impeller and Flutter GPU aren't available on the web, so flutter_scene ships a built-in WebGL2 backend (a drop-in for flutter_gpu) and renders through it there. It works under both the CanvasKit and Skwasm web renderers, with no extra flags or configuration.
Sponsors
Scene's development infrastructure is supported by:
- Codemagic - macOS CI on Apple silicon hardware
Interested in supporting Scene's development? Reach out: x@bdero.me
Repository
This repository is a pub workspace containing the engine, its companion packages, and the example apps:
| Path | Description |
|---|---|
packages/flutter_scene |
The 3D engine, including the glTF importer, the .fscene format, and the web (WebGL2) backend. Published to pub.dev as flutter_scene. |
packages/flutter_scene_rapier |
Rapier physics backend, shipping prebuilt native binaries and a wasm module. Published to pub.dev as flutter_scene_rapier. |
packages/flutter_scene_box3d |
box3d physics backend. Published to pub.dev as flutter_scene_box3d. |
packages/flutter_scene_soloud |
SoLoud audio backend. Not yet published. |
packages/flutter_scene_fmod |
FMOD Studio audio backend. Not yet published. |
packages/flutter_scene_editor_core, packages/flutter_scene_editor, packages/flutter_scene_mcp |
The Flutter Scene Editor stack (headless command core, Flutter UI, and MCP tool surface). Shipped as the desktop app under apps/, not as pub.dev libraries. In active development. |
apps/flutter_scene_editor_app |
The standalone Flutter Scene Editor desktop app. |
examples/flutter_app |
Runnable example app with 40 feature examples. |
The remaining examples/ folders are dev-only test harnesses (the web-backend smoke test, deterministic smoke renders, and a CPU stress bench).
To run the example app from a fresh clone:
flutter pub get # resolves the workspace
cd examples/flutter_app
flutter create . --platforms=macos,ios,android,linux,windows,web # generate gitignored platform stubs
flutter run --enable-flutter-gpu # native; add `-d <device>` if needed
flutter run -d chrome # web
Pass --dart-define=FLUTTER_SCENE_PROFILE=true to print 120-frame render graph, culling, encoding, instance packing, binding, byte, draw, and instance summaries. Multiple active RenderViews share the counters.
Libraries
- annotations
- Component annotations for the
flutter_scene_codegenextractor. - audio
- Audio for flutter_scene, an optional pluggable-backend contract.
- build_hooks
- Build-hook helpers for flutter_scene.
- fscene
- The
.fsceneserialized scene format: an in-memory document model, JSON read/write, and realization to and from a liveNodegraph. - gpu
- Curated public GPU surface for the custom-shader (ShaderMaterial) workflow.
- noise
- Deterministic noise, matched between CPU and GPU.
- physics
- Physics for flutter_scene, an optional pluggable-backend contract.
- scene
- 3D rendering for Flutter, built on Flutter GPU and Impeller.