Scene class base Scene graph

Represents a 3D scene, which is a collection of nodes that can be rendered onto the screen.

Scene manages the scene graph and handles rendering operations. It contains a root Node that serves as the entry point for all nodes in this Scene, and it provides methods for adding and removing nodes from the scene graph.

Implemented types

Constructors

Scene()

Properties

ambientOcclusion AmbientOcclusionSettings
Screen-space ambient occlusion settings. Off by default; set AmbientOcclusionSettings.enabled to turn it on. Requires a PerspectiveCamera (the occlusion is reconstructed from the camera's perspective depth); it is skipped for other camera types.
final
antiAliasingMode AntiAliasingMode
The requested anti-aliasing strategy for this Scene.
getter/setter pair
directionalLight DirectionalLight?
A single analytic directional light (e.g. a sun) layered on top of the image-based lighting. Null (the default) means IBL only.
getter/setter pair
effectiveAntiAliasingMode AntiAliasingMode
The anti-aliasing technique that actually runs when this Scene renders.
no setter
environment EnvironmentMap?
The image-based-lighting environment, or null to use the engine's default (the built-in procedural EnvironmentMap.studio, built lazily on first render).
getter/setter pair
environmentIntensity double
Scalar multiplier applied to environment's contribution. 1.0 (the default) is neutral.
getter/setter pair
environmentTransform ↔ Matrix3
Rotation applied to the image-based-lighting environment when it is sampled. Identity (the default) leaves the environment unrotated.
getter/setter pair
exposure double
Linear exposure multiplier applied to the HDR scene color before tone mapping. 1.0 (the default) is neutral; see physicalCameraExposure to derive a value from camera settings.
getter/setter pair
filterQuality FilterQuality
The sampling quality used when compositing screen views onto the canvas. Defaults to ui.FilterQuality.medium.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
postProcess PostProcessSettings
Built-in post-processing settings, such as color grading. Every effect is off by default.
final
renderScale double
Scales the resolution screen views render at, relative to the display's native resolution. Defaults to 1.0.
getter/setter pair
renderScene → RenderScene
The flat list of drawable items the render passes iterate.
final
root Node
The root Node of the scene graph.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skybox Skybox?
The visible background drawn behind the scene, or null (the default) to clear to transparent.
getter/setter pair
skyEnvironment SkyEnvironment?
Drives environment from a sky on a refresh policy, or null (the default) to leave environment caller-managed.
getter/setter pair
surface Surface
Handles the creation and management of render targets for this Scene.
final
toneMapping ToneMappingMode
Tone mapping operator used when resolving the HDR scene color to the display image. Defaults to ToneMappingMode.pbrNeutral.
getter/setter pair
views List<RenderView>
Views this scene owns and renders every frame, in addition to the views passed to each renderViews call.
final

Methods

add(Node child) → void
Add a child node.
override
addAll(Iterable<Node> children) → void
Add a list of child nodes.
override
addMesh(Mesh mesh) → void
Add a mesh as a child node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
raycast(Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool where(Node node)?, bool includeInvisible = false}) SceneRaycastHit?
Casts ray through the scene's render geometry and returns the nearest hit, or null.
raycastAll(Ray ray, {double maxDistance = double.infinity, int layerMask = 0xFFFFFFFF, bool where(Node node)?, bool includeInvisible = false}) List<SceneRaycastHit>
Casts ray through the scene's render geometry and returns every hit, sorted nearest-first. Parameters as in raycast.
remove(Node child) → void
Remove a child node.
override
removeAll() → void
Remove all children nodes.
override
render(Camera camera, Canvas canvas, {Rect? viewport, double? pixelRatio}) → void
Renders camera's view of this scene onto canvas.
renderViews(List<RenderView> views, Canvas canvas, {Rect? region, double? pixelRatio}) → void
Renders a list of views of this scene onto canvas.
toString() String
A string representation of this object.
inherited
update(double deltaSeconds) → void
Advances the scene by deltaSeconds: ticks every node's components and animation players, and refreshes the flat render layer.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

advancePhysics({required PhysicsWorld world, required void fixedUpdateWalk(double fixedDt), required double accumulator, required double frameDt}) double
Fixed-step substepping driver. Adds frameDt to accumulator, takes up to PhysicsWorld.maxSubsteps fixed steps to consume it (walking fixedUpdateWalk then world.step each step), drops leftover time when the renderer falls far behind, and finishes by calling world.interpolateTransforms with the residual fraction.
initializeStaticResources() Future<void>
Prepares the rendering resources, such as textures and shaders, that are used to display models in this Scene.
isAntiAliasingModeSupported(AntiAliasingMode mode) bool
Whether mode is supported by the active Flutter GPU backend.
physicalCameraExposure({required double aperture, required double shutterSpeed, required double iso}) double
Computes the linear exposure multiplier for a physical pinhole camera, the way photographers reason about it: aperture (f-stops), shutterSpeed (seconds), and sensor iso.