Skip to content

Defined in: packages/three-flatland/src/Flatland.ts:280

Flatland - Unified 2D rendering pipeline for Three.js WebGPU.

Combines sprite batching, post-processing, render targets, and global uniforms into a single high-level API. Each instance privately owns the runtime shared between sprite batching and post-processing passes.

// Basic usage - render to viewport
const flatland = new Flatland({ viewSize: 400 })
flatland.add(new Sprite2D({ texture }))
// Render loop
function animate() {
flatland.render(renderer)
requestAnimationFrame(animate)
}
// Render to texture
import { RenderTarget } from 'three'
const target = new RenderTarget(512, 512)
const flatland = new Flatland({ renderTarget: target })
flatland.add(sprite)
// Use texture on 3D mesh
mesh.material.map = flatland.texture
// Render loop
flatland.render(renderer) // Renders to target
renderer.render(scene3D, camera3D) // Renders 3D with card
// React Three Fiber usage
import { Canvas, extend, useFrame, useThree } from '@react-three/fiber/webgpu'
import { Flatland, Sprite2D } from 'three-flatland/react'
extend({ Flatland, Sprite2D })
function Scene() {
const flatlandRef = useRef<Flatland>(null)
const { renderer } = useThree()
useFrame(() => {
flatlandRef.current?.render(renderer)
})
return (
<flatland ref={flatlandRef} viewSize={400} clearColor={0x1a1a2e}>
<sprite2D texture={texture} position={[0, 0, 0]} />
</flatland>
)
}

new Flatland(options?): Flatland

Defined in: packages/three-flatland/src/Flatland.ts:495

FlatlandOptions = {}

Flatland

Group.constructor

animations: AnimationClip []

Defined in: three.js/core/Object3D:animations 

Array with object’s animation clips.

[]

Group.animations


autoClear: boolean

Defined in: packages/three-flatland/src/Flatland.ts:378

Auto-clear before render


castShadow: boolean

Defined in: three.js/core/Object3D:castShadow 

Whether the object gets rendered into shadow map.

false

Group.castShadow


children: Object3D <Object3DEventMap >[]

Defined in: three.js/core/Object3D:children 

Array with object’s children.

THREE.Object3DGroup | Group for info on manually grouping objects.

[]

Group.children


clearAlpha: number

Defined in: packages/three-flatland/src/Flatland.ts:384

Clear alpha


clearColor: Color 

Defined in: packages/three-flatland/src/Flatland.ts:381

Clear color


optional count?: number

Defined in: three.js/renderers/common/Backend:count 

Group.count


optional customDepthMaterial?: Material <MaterialEventMap >

Defined in: three.js/core/Object3D:customDepthMaterial 

Custom depth material to be used when rendering to the depth map.

Can only be used in context of meshes. When shadow-casting with a THREE.DirectionalLight | DirectionalLight or THREE.SpotLight | SpotLight, if you are modifying vertex positions in the vertex shader you must specify a customDepthMaterial for proper shadows.

undefined

Group.customDepthMaterial


optional customDistanceMaterial?: Material <MaterialEventMap >

Defined in: three.js/core/Object3D:customDistanceMaterial 

Same as customDepthMaterial, but used with THREE.Object3DPointLight | PointLight.

undefined

Group.customDistanceMaterial


frustumCulled: boolean

Defined in: three.js/core/Object3D:frustumCulled 

When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. If set to false the object gets rendered every frame even if it is not in the frustum of the camera.

true

Group.frustumCulled


readonly globals: GlobalUniforms

Defined in: packages/three-flatland/src/Flatland.ts:315

Global uniforms shared across all sprite materials


readonly id: number

Defined in: three.js/core/Object3D:id 

Unique number for this Object3D  instance.

Note that ids are assigned in chronological order: 1, 2, 3, …, incrementing by one for each new object. Expects a Integer

Group.id


readonly isGroup: true

Defined in: three.js/objects/Group:isGroup 

Read-only flag to check if a given object is of type Group .

This is a constant value

true

Group.isGroup


readonly isObject3D: true

Defined in: three.js/core/Object3D:isObject3D 

Flag to check if a given object is of type Object3D .

This is a constant value

true

Group.isObject3D


layers: Layers 

Defined in: three.js/core/Object3D:layers 

The layer membership of the object.

The object is only visible if it has at least one layer in common with the THREE.Object3DCamera | Camera in use. This property can also be used to filter out unwanted objects in ray-intersection tests when using THREE.Raycaster | Raycaster.

new THREE.Layers()

Group.layers


matrix: Matrix4 

Defined in: three.js/core/Object3D:matrix 

The local transform matrix.

new THREE.Matrix4()

Group.matrix


matrixAutoUpdate: boolean

Defined in: three.js/core/Object3D:matrixAutoUpdate 

When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.

DEFAULT_MATRIX_AUTO_UPDATE - that is (true).

Group.matrixAutoUpdate


matrixWorld: Matrix4 

Defined in: three.js/core/Object3D:matrixWorld 

The global transform of the object.

If the Object3D  has no parent, then it’s identical to the local transform THREE.Object3D.matrix | .matrix.

new THREE.Matrix4()

Group.matrixWorld


matrixWorldAutoUpdate: boolean

Defined in: three.js/core/Object3D:matrixWorldAutoUpdate 

If set, then the renderer checks every frame if the object and its children need matrix updates. When it isn’t, then you have to maintain all matrices in the object and its children yourself.

DEFAULT_MATRIX_WORLD_AUTO_UPDATE - that is (true).

Group.matrixWorldAutoUpdate


matrixWorldNeedsUpdate: boolean

Defined in: three.js/core/Object3D:matrixWorldNeedsUpdate 

When this is set, it calculates the matrixWorld in that frame and resets this property to false.

false

Group.matrixWorldNeedsUpdate


readonly modelViewMatrix: Matrix4 

Defined in: three.js/core/Object3D:modelViewMatrix 

new THREE.Matrix4()

Group.modelViewMatrix


name: string

Defined in: three.js/core/Object3D:name 

Optional name of the object

(doesn’t need to be unique).

""

Group.name


readonly normalMatrix: Matrix3 

Defined in: three.js/core/Object3D:normalMatrix 

new THREE.Matrix3()

Group.normalMatrix


optional occlusionTest?: boolean

Defined in: three.js/renderers/common/Backend:occlusionTest 

Group.occlusionTest


parent: Object3D <Object3DEventMap > | null

Defined in: three.js/core/Object3D:parent 

Object’s parent in the scene graph .

An object can have at most one parent.

null

Group.parent


pivot: Vector3  | null

Defined in: three.js/core/Object3D:pivot 

The pivot point for rotation and scale transformations. When set, rotation and scale are applied around this point instead of the object’s origin.

null

Group.pivot


readonly position: Vector3 

Defined in: three.js/core/Object3D:position 

Object’s local position.

new THREE.Vector3() - that is (0, 0, 0).

Group.position


readonly quaternion: Quaternion 

Defined in: three.js/core/Object3D:quaternion 

Object’s local rotation as a THREE.Quaternion | Quaternion.

new THREE.Quaternion() - that is (0, 0, 0, 1).

Group.quaternion


receiveShadow: boolean

Defined in: three.js/core/Object3D:receiveShadow 

Whether the material receives shadows.

false

Group.receiveShadow


renderOrder: number

Defined in: three.js/core/Object3D:renderOrder 

This value allows the default rendering order of scene graph  objects to be overridden although opaque and transparent objects remain sorted independently.

When this property is set for an instance of Group , all descendants objects will be sorted and rendered together. Sorting is from lowest to highest renderOrder.

0

Group.renderOrder


readonly rotation: Euler 

Defined in: three.js/core/Object3D:rotation 

Object’s local rotation (Euler angles ), in radians.

new THREE.Euler() - that is (0, 0, 0, Euler.DEFAULT_ORDER).

Group.rotation


readonly scale: Vector3 

Defined in: three.js/core/Object3D:scale 

The object’s local scale.

new THREE.Vector3( 1, 1, 1 )

Group.scale


readonly scene: Scene 

Defined in: packages/three-flatland/src/Flatland.ts:285

Internal scene containing sprites


readonly spriteGroup: SpriteGroup

Defined in: packages/three-flatland/src/Flatland.ts:309

Internal sprite group for batching


static: boolean

Defined in: three.js/core/Object3D:static 

Whether the 3D object is supposed to be static or not. If set to true, it means the 3D object is not going to be changed after the initial renderer. This includes geometry and material settings. A static 3D object can be processed by the renderer slightly faster since certain state checks can be bypassed.

Only relevant in context of WebGPURenderer.

false

Group.static


readonly type: string

Defined in: three.js/core/Object3D:type 

A Read-only string to check this object type.

This can be used to find a specific type of Object3D in a scene. Sub-classes will update this value.

Object3D

Group.type


up: Vector3 

Defined in: three.js/core/Object3D:up 

This is used by the lookAt  method, for example, to determine the orientation of the result.

Object3D.DEFAULT_UP - that is (0, 1, 0).

Group.up


userData: Record<string, any>

Defined in: three.js/core/Object3D:userData 

An object that can be used to store custom data about the Object3D .

It should not hold references to functions as these will not be cloned.

{}

Group.userData


uuid: string

Defined in: three.js/core/Object3D:uuid 

UUID  of this object instance.

This gets automatically assigned and shouldn’t be edited.

Group.uuid


visible: boolean

Defined in: three.js/core/Object3D:visible 

Object gets rendered if true.

true

Group.visible


static DEFAULT_MATRIX_AUTO_UPDATE: boolean

Defined in: three.js/core/Object3D:DEFAULT_MATRIX_AUTO_UPDATE 

The default setting for matrixAutoUpdate for newly created Object3Ds.

true

Group.DEFAULT_MATRIX_AUTO_UPDATE


static DEFAULT_MATRIX_WORLD_AUTO_UPDATE: boolean

Defined in: three.js/core/Object3D:DEFAULT_MATRIX_WORLD_AUTO_UPDATE 

The default setting for matrixWorldAutoUpdate for newly created Object3Ds.

true

Group.DEFAULT_MATRIX_WORLD_AUTO_UPDATE


static DEFAULT_UP: Vector3 

Defined in: three.js/core/Object3D:DEFAULT_UP 

The default up direction for objects, also used as the default position for THREE.DirectionalLight | DirectionalLight, THREE.HemisphereLight | HemisphereLight and THREE.Spotlight | Spotlight (which creates lights shining from the top down).

new THREE.Vector3( 0, 1, 0)

Group.DEFAULT_UP


static options: RenderingSetting | undefined = undefined

Defined in: packages/three-flatland/src/Flatland.ts:282

Class-level rendering defaults, resolved before RenderingConfig.

get aspect(): number | "auto"

Defined in: packages/three-flatland/src/Flatland.ts:753

Get the configured aspect mode. Returns 'auto' while Flatland follows the render surface; use resolvedAspect for the camera’s current numeric ratio. A PixelPerfectCamera follows the physical output shape even when this property retains a numeric regular-camera setting. A user-supplied camera keeps its authored frustum regardless of this mode.

number | "auto"

set aspect(value): void

Defined in: packages/three-flatland/src/Flatland.ts:782

A number pins the regular managed camera ratio manually. A PixelPerfectCamera continues following the physical output shape; the numeric value is retained in case pixelPerfect is later disabled. Assigning 'auto' restores automatic internal-camera and effect sizing, including after resize(). User-supplied cameras keep their authored frustum. The explicit sentinel also lets R3F restore constructor defaults when an aspect JSX prop is removed. Invalid numeric values are ignored.

number | "auto"

void


get camera(): OrthographicCamera 

Defined in: packages/three-flatland/src/Flatland.ts:645

The camera flatland renders its internal scene with. Read-only access for event integration (portal events.compute re-casts pointer rays from this camera — spec §8.1) and debugging.

OrthographicCamera 

set camera(value): void

Defined in: packages/three-flatland/src/Flatland.ts:686

Set a custom camera. Assigning the default camera read from a no-arg Flatland instance restores this instance’s own managed camera; this is the property-removal path used by React Three Fiber.

OrthographicCamera 

void


get lighting(): LightEffect | null

Defined in: packages/three-flatland/src/Flatland.ts:1567

Get the active LightEffect.

LightEffect | null


get lights(): readonly Light2D[]

Defined in: packages/three-flatland/src/Flatland.ts:1560

Get the active Light2D instances.

readonly Light2D[]


get outputNode(): Node  | null

Defined in: packages/three-flatland/src/Flatland.ts:860

Get/set the output node for post-processing effects. Set this to apply TSL effect chains.

Node  | null

set outputNode(value): void

Defined in: packages/three-flatland/src/Flatland.ts:864

Node 

void


get passes(): readonly PassEffect[]

Defined in: packages/three-flatland/src/Flatland.ts:1539

Get the current post-processing passes.

readonly PassEffect[]


get passNode(): PassNode  | null

Defined in: packages/three-flatland/src/Flatland.ts:852

Get the pass node for composing effects.

PassNode  | null


get pixelPerfect(): boolean

Defined in: packages/three-flatland/src/Flatland.ts:654

Whether Flatland manages a PixelPerfectCamera. Toggling this while a custom camera is active records the preferred internal-camera mode; the custom camera remains untouched until it is removed.

boolean

set pixelPerfect(value): void

Defined in: packages/three-flatland/src/Flatland.ts:658

boolean

void


get renderPipeline(): RenderPipeline  | null

Defined in: packages/three-flatland/src/Flatland.ts:845

Get the render pipeline instance.

RenderPipeline  | null


get renderTarget(): RenderTarget <Texture <unknown, TextureEventMap >, RenderTargetEventMap > | null

Defined in: packages/three-flatland/src/Flatland.ts:812

Get the render target (null = viewport).

RenderTarget <Texture <unknown, TextureEventMap >, RenderTargetEventMap > | null

set renderTarget(value): void

Defined in: packages/three-flatland/src/Flatland.ts:819

Set the render target.

RenderTarget <Texture <unknown, TextureEventMap >, RenderTargetEventMap > | null

void


get resolvedAspect(): number

Defined in: packages/three-flatland/src/Flatland.ts:762

Current numeric camera aspect. For Flatland’s internal camera this includes the ratio resolved in auto mode; for a user-supplied camera it is derived directly from that camera’s authored orthographic frustum.

number


get texture(): Texture <unknown, TextureEventMap > | null

Defined in: packages/three-flatland/src/Flatland.ts:838

Get the render target texture (or null if rendering to viewport).

Texture <unknown, TextureEventMap > | null


get viewSize(): number

Defined in: packages/three-flatland/src/Flatland.ts:719

Get the view size.

number

set viewSize(value): void

Defined in: packages/three-flatland/src/Flatland.ts:726

Set the view size.

number

void


get viewWidth(): number | undefined

Defined in: packages/three-flatland/src/Flatland.ts:734

Fixed horizontal design extent, or undefined for fill-at-integer-scale.

number | undefined

set viewWidth(value): void

Defined in: packages/three-flatland/src/Flatland.ts:738

number | undefined

void

add(…objects): this

Defined in: packages/three-flatland/src/Flatland.ts:1086

Add objects to Flatland. Sprites are routed to the internal SpriteGroup for batching. Other objects are added directly to the internal scene.

This overrides Group.add() to route children to the internal scene rather than this Group, enabling proper rendering with Flatland’s camera.

…Object3D <Object3DEventMap >[]

this

Group.add


addEventListener<T>(type, listener): void

Defined in: three.js/core/EventDispatcher:addEventListener 

Adds a listener to an event type.

T extends keyof Object3DEventMap 

T

The type of event to listen to.

EventListener <Object3DEventMap [T], T, Flatland>

The function that gets called when the event is fired.

void

Group.addEventListener


addPass(passEffect, order?): this

Defined in: packages/three-flatland/src/Flatland.ts:1384

Add a post-processing pass to the pipeline. Passes are applied in insertion order (or explicit order). Automatically enables post-processing.

PassEffect

PassEffect instance to add

number

Optional explicit order (default: auto-increment)

this

this (for chaining)

import { CRTEffect, VignetteEffect } from 'three-flatland'
const crt = new CRTEffect()
const vignette = new VignetteEffect()
flatland.addPass(crt).addPass(vignette)
crt.curvature = 0.3 // zero-cost uniform update

applyMatrix4(matrix): void

Defined in: three.js/core/Object3D:applyMatrix4 

Applies the matrix transform to the object and updates the object’s position, rotation and scale.

Matrix4 

void

Group.applyMatrix4


applyQuaternion(quaternion): this

Defined in: three.js/core/Object3D:applyQuaternion 

Applies the rotation represented by the quaternion to the object.

Quaternion 

this

Group.applyQuaternion


attach(object): this

Defined in: three.js/core/Object3D:attach 

Adds a Object3D  as a child of this, while maintaining the object’s world transform.

Object3D 

this

Note: This method does not support scene graphs having non-uniformly-scaled nodes(s).

add 

Group.attach


clear(): this

Defined in: packages/three-flatland/src/Flatland.ts:1234

Remove all sprites and other objects from the internal scene. Overrides Group.clear() to clear the internal scene.

this

Group.clear


clearPasses(): this

Defined in: packages/three-flatland/src/Flatland.ts:1519

Remove all post-processing passes from the pipeline. Disables post-processing if it was auto-initialized.

this

this (for chaining)


clearRenderPipeline(): void

Defined in: packages/three-flatland/src/Flatland.ts:1355

Clear the render pipeline setup.

void


clone(recursive?): this

Defined in: packages/three-flatland/src/Flatland.ts:2687

Clone for devtools/serialization compatibility. Flatland manages internal scene, camera, and render pipeline that cannot be meaningfully cloned. Returns a Group with cloned children.

boolean

this

Group.clone


copy(object, recursive?): this

Defined in: three.js/core/Object3D:copy 

Copies the given object into this object.

Object3D 

boolean

If set to true, descendants of the object are copied next to the existing ones. If set to false, descendants are left unchanged. Default is true.

this

Event listeners and user-defined callbacks (.onAfterRender and .onBeforeRender) are not copied.

Group.copy


declareSortLayer(name, config): SortLayerConfig

Defined in: packages/three-flatland/src/Flatland.ts:292

Declare (or redeclare) a named sort layer for use with sprite.sortLayer and SortLayerGroup. Pair with a SortLayerRegistry interface augmentation for typed names.

SortLayerName

SortLayerConfig

SortLayerConfig


dispatchEvent<T>(event): void

Defined in: three.js/core/EventDispatcher:dispatchEvent 

Fire an event type.

T extends keyof Object3DEventMap 

BaseEvent <T> & Object3DEventMap [T]

The event that gets fired.

void

Group.dispatchEvent


dispose(): void

Defined in: packages/three-flatland/src/Flatland.ts:2705

Dispose of all resources.

void


getObjectById(id): Object3D <Object3DEventMap > | undefined

Defined in: three.js/core/Object3D:getObjectById 

Searches through an object and its children, starting with the object itself, and returns the first with a matching id.

number

Unique number of the object instance. Expects a Integer

Object3D <Object3DEventMap > | undefined

Note that ids are assigned in chronological order: 1, 2, 3, …, incrementing by one for each new object.

id

Group.getObjectById


getObjectByName(name): Object3D <Object3DEventMap > | undefined

Defined in: three.js/core/Object3D:getObjectByName 

Searches through an object and its children, starting with the object itself, and returns the first with a matching name.

string

String to match to the children’s Object3D.name property.

Object3D <Object3DEventMap > | undefined

Note that for most objects the name is an empty string by default You will have to set it manually to make use of this method.

Group.getObjectByName


getObjectByProperty(name, value): Object3D <Object3DEventMap > | undefined

Defined in: three.js/core/Object3D:getObjectByProperty 

Searches through an object and its children, starting with the object itself, and returns the first with a property that matches the value given.

string

the property name to search for.

any

value of the given property.

Object3D <Object3DEventMap > | undefined

Group.getObjectByProperty


getObjectsByProperty(name, value, optionalTarget?): Object3D <Object3DEventMap >[]

Defined in: three.js/core/Object3D:getObjectsByProperty 

Searches through an object and its children, starting with the object itself, and returns the first with a property that matches the value given.

string

The property name to search for.

any

Value of the given property.

Object3D <Object3DEventMap >[]

target to set the result. Otherwise a new Array is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).

Object3D <Object3DEventMap >[]

Group.getObjectsByProperty


getWorldDirection(target): Vector3 

Defined in: three.js/core/Object3D:getWorldDirection 

Returns a vector representing the direction of object’s positive z-axis in world space.

Vector3 

The result will be copied into this Vector3.

Vector3 

Group.getWorldDirection


getWorldPosition(target): Vector3 

Defined in: three.js/core/Object3D:getWorldPosition 

Returns a vector representing the position of the object in world space.

Vector3 

The result will be copied into this Vector3.

Vector3 

Group.getWorldPosition


getWorldQuaternion(target): Quaternion 

Defined in: three.js/core/Object3D:getWorldQuaternion 

Returns a quaternion representing the rotation of the object in world space.

Quaternion 

The result will be copied into this Quaternion.

Quaternion 

Group.getWorldQuaternion


getWorldScale(target): Vector3 

Defined in: three.js/core/Object3D:getWorldScale 

Returns a vector of the scaling factors applied to the object for each axis in world space.

Vector3 

The result will be copied into this Vector3.

Vector3 

Group.getWorldScale


hasEventListener<T>(type, listener): boolean

Defined in: three.js/core/EventDispatcher:hasEventListener 

Checks if listener is added to an event type.

T extends keyof Object3DEventMap 

T

The type of event to listen to.

EventListener <Object3DEventMap [T], T, Flatland>

The function that gets called when the event is fired.

boolean

Group.hasEventListener


localToWorld(vector): Vector3 

Defined in: three.js/core/Object3D:localToWorld 

Converts the vector from this object’s local space to world space.

Vector3 

A vector representing a position in this object’s local space.

Vector3 

Group.localToWorld


lookAt(vector): void

Defined in: three.js/core/Object3D:lookAt 

Rotates the object to face a point in world space.

Vector3 

A vector representing a position in world space to look at.

void

This method does not support objects having non-uniformly-scaled parent(s).

Group.lookAt

lookAt(x, y, z): void

Defined in: three.js/core/Object3D:lookAt 

Rotates the object to face a point in world space.

number

Expects a Float

number

Expects a Float

number

Expects a Float

void

This method does not support objects having non-uniformly-scaled parent(s).

Group.lookAt


onAfterRender(renderer, scene, camera, geometry, material, group): void

Defined in: three.js/core/Object3D:onAfterRender 

An optional callback that is executed immediately after a 3D object is rendered.

WebGLRenderer 

Scene 

Camera 

BufferGeometry 

Material 

Group 

void

This function is called with the following parameters: renderer, scene, camera, geometry, material, group. Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D , Group  or Bone are not renderable and thus this callback is not executed for such objects.

Group.onAfterRender


onAfterShadow(renderer, scene, camera, shadowCamera, geometry, depthMaterial, group): void

Defined in: three.js/core/Object3D:onAfterShadow 

An optional callback that is executed immediately after a 3D object is rendered to a shadow map.

WebGLRenderer 

Scene 

Camera 

Camera 

BufferGeometry 

Material 

Group 

void

This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry, depthMaterial, group. Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D , Group  or Bone are not renderable and thus this callback is not executed for such objects.

Group.onAfterShadow


onBeforeRender(renderer, scene, camera, geometry, material, group): void

Defined in: three.js/core/Object3D:onBeforeRender 

An optional callback that is executed immediately before a 3D object is rendered.

WebGLRenderer 

Scene 

Camera 

BufferGeometry 

Material 

Group 

void

This function is called with the following parameters: renderer, scene, camera, geometry, material, group. Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D , Group  or Bone are not renderable and thus this callback is not executed for such objects.

Group.onBeforeRender


onBeforeShadow(renderer, scene, camera, shadowCamera, geometry, depthMaterial, group): void

Defined in: three.js/core/Object3D:onBeforeShadow 

An optional callback that is executed immediately before a 3D object is rendered to a shadow map.

WebGLRenderer 

Scene 

Camera 

Camera 

BufferGeometry 

Material 

Group 

void

This function is called with the following parameters: renderer, scene, camera, shadowCamera, geometry, depthMaterial, group. Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D , Group  or Bone are not renderable and thus this callback is not executed for such objects.

Group.onBeforeShadow


raycast(raycaster, intersects): void

Defined in: three.js/core/Object3D:raycast 

Abstract (empty) method to get intersections between a casted ray and this object

Raycaster 

Intersection <Object3D <Object3DEventMap >>[]

void

Subclasses such as THREE.Mesh | Mesh, THREE.Line | Line, and THREE.Points | Points implement this method in order to use raycasting.

THREE.Raycaster | Raycaster

() => {}

Group.raycast


remove(…objects): this

Defined in: packages/three-flatland/src/Flatland.ts:1192

Remove objects from Flatland. This overrides Group.remove() to properly remove from internal scene/spriteGroup.

…Object3D <Object3DEventMap >[]

this

Group.remove


removeEventListener<T>(type, listener): void

Defined in: three.js/core/EventDispatcher:removeEventListener 

Removes a listener from an event type.

T extends keyof Object3DEventMap 

T

The type of the listener that gets removed.

EventListener <Object3DEventMap [T], T, Flatland>

The listener function that gets removed.

void

Group.removeEventListener


removeFromParent(): this

Defined in: three.js/core/Object3D:removeFromParent 

Removes this object from its current parent.

this

Group.removeFromParent


removePass(passEffect): this

Defined in: packages/three-flatland/src/Flatland.ts:1500

Remove a post-processing pass from the pipeline.

PassEffect

The same PassEffect instance passed to addPass()

this

this (for chaining)


render(renderer): void

Defined in: packages/three-flatland/src/Flatland.ts:2159

Render Flatland.

WebGPURenderer 

void


resize(width, height): void

Defined in: packages/three-flatland/src/Flatland.ts:2561

Resize the rendering area, taking manual control of the aspect ratio and surface size (the automatic per-render sync is disabled from here on). The active destination fixes the authored unit for the whole manual-size session. With no render target attached, dimensions are logical CSS pixels and every later destination uses width × renderer DPR. With a render target attached, dimensions are physical texels and remain physical across later target swaps or a return to the canvas. Calling resize() again begins a new session using the destination active at that time.

Zero, negative, or non-finite dimensions are ignored — a transient unmeasured layout (R3F’s first commit reports a 0×0 canvas) must not latch a NaN/Infinity frustum, and must not disable the automatic sync that will pick up the real size once it exists.

number

number

void


rotateOnAxis(axis, angle): this

Defined in: three.js/core/Object3D:rotateOnAxis 

Rotate an object along an axis in object space.

Vector3 

A normalized vector in object space.

number

The angle in radians. Expects a Float

this

The axis is assumed to be normalized.

Group.rotateOnAxis


rotateOnWorldAxis(axis, angle): this

Defined in: three.js/core/Object3D:rotateOnWorldAxis 

Rotate an object along an axis in world space.

Vector3 

A normalized vector in world space.

number

The angle in radians. Expects a Float

this

The axis is assumed to be normalized Method Assumes no rotated parent.

Group.rotateOnWorldAxis


rotateX(angle): this

Defined in: three.js/core/Object3D:rotateX 

Rotates the object around x axis in local space.

number

this

Group.rotateX


rotateY(angle): this

Defined in: three.js/core/Object3D:rotateY 

Rotates the object around y axis in local space.

number

this

Group.rotateY


rotateZ(angle): this

Defined in: three.js/core/Object3D:rotateZ 

Rotates the object around z axis in local space.

number

this

Group.rotateZ


setLighting(lightEffect): this

Defined in: packages/three-flatland/src/Flatland.ts:1593

Set the lighting effect for this Flatland instance. The LightEffect produces a ColorTransformFn that is applied to all lit sprites.

Flatland owns the active effect’s lifecycle while attached. Replacing it or passing null calls dispose() before detachment so GPU resources are released promptly. The effect instance remains reusable and will receive a fresh init → resize → update sequence when reattached; callers should not use effect-owned GPU resource handles while the effect is detached.

LightEffect | null

LightEffect instance (or null to disable lighting)

this

this (for chaining)

import { DefaultLightEffect } from '@three-flatland/presets'
const lighting = new DefaultLightEffect()
flatland.setLighting(lighting)
lighting.ambientIntensity = 0.4 // zero-cost uniform update

setRenderPipeline(renderPipeline, passNode): void

Defined in: packages/three-flatland/src/Flatland.ts:1340

Initialize the render pipeline with a given RenderPipeline instance. Users should create the RenderPipeline and pass node themselves for flexibility.

RenderPipeline 

PassNode 

void

import { RenderPipeline, pass } from 'three/webgpu'
import { crtComplete } from 'three-flatland'
const pipeline = new RenderPipeline(renderer)
const scenePass = pass(flatland.scene, flatland.camera)
pipeline.outputNode = crtComplete(scenePass, uv(), { curvature: 0.1 })
flatland.setRenderPipeline(pipeline, scenePass)

Flatland preserves the pipeline’s outputColorTransform setting. Set it to false when a manual pipeline writes working-space color to a render target. With a PixelPerfectCamera, Flatland sizes the supplied scene pass to the camera’s integer viewport so the pipeline cannot introduce a fractional intermediate resample.


setRotationFromAxisAngle(axis, angle): void

Defined in: three.js/core/Object3D:setRotationFromAxisAngle 

Calls THREE.Quaternion.setFromAxisAngle | setFromAxisAngle(axis, angle) on the .quaternion.

Vector3 

A normalized vector in object space.

number

Angle in radians. Expects a Float

void

Group.setRotationFromAxisAngle


setRotationFromEuler(euler): void

Defined in: three.js/core/Object3D:setRotationFromEuler 

Calls THREE.Quaternion.setFromEuler | setFromEuler(euler) on the .quaternion.

Euler 

Euler angle specifying rotation amount.

void

Group.setRotationFromEuler


setRotationFromMatrix(m): void

Defined in: three.js/core/Object3D:setRotationFromMatrix 

Calls THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix(m) on the .quaternion.

Matrix4 

Rotate the quaternion by the rotation component of the matrix.

void

Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).

Group.setRotationFromMatrix


setRotationFromQuaternion(q): void

Defined in: three.js/core/Object3D:setRotationFromQuaternion 

Copy the given THREE.Quaternion | Quaternion into .quaternion.

Quaternion 

Normalized Quaternion.

void

Group.setRotationFromQuaternion


sortLayer(name): SortLayerConfig

Defined in: packages/three-flatland/src/Flatland.ts:304

Resolve a declared sort layer’s config — the hook for placing foreign objects relative to a layer:

skiaText.renderOrder = flatland.sortLayer('ui').renderOrder - 1

SortLayerName

SortLayerConfig


toJSON(meta?): Object3DJSON 

Defined in: three.js/core/Object3D:toJSON 

Convert the object to three.js JSON Object/Scene format .

JSONMeta 

Object containing metadata such as materials, textures or images for the object.

Object3DJSON 

Group.toJSON


translateOnAxis(axis, distance): this

Defined in: three.js/core/Object3D:translateOnAxis 

Translate an object by distance along an axis in object space

Vector3 

A normalized vector in object space.

number

The distance to translate. Expects a Float

this

The axis is assumed to be normalized.

Group.translateOnAxis


translateX(distance): this

Defined in: three.js/core/Object3D:translateX 

Translates object along x axis in object space by distance units.

number

Expects a Float

this

Group.translateX


translateY(distance): this

Defined in: three.js/core/Object3D:translateY 

Translates object along y axis in object space by distance units.

number

Expects a Float

this

Group.translateY


translateZ(distance): this

Defined in: three.js/core/Object3D:translateZ 

Translates object along z axis in object space by distance units.

number

Expects a Float

this

Group.translateZ


traverse(callback): void

Defined in: three.js/core/Object3D:traverse 

Executes the callback on this object and all descendants.

(object) => any

A function with as first argument an Object3D  object.

void

Note: Modifying the scene graph inside the callback is discouraged.

Group.traverse


traverseAncestors(callback): void

Defined in: three.js/core/Object3D:traverseAncestors 

Executes the callback on all ancestors.

(object) => any

A function with as first argument an Object3D  object.

void

Note: Modifying the scene graph inside the callback is discouraged.

Group.traverseAncestors


traverseVisible(callback): void

Defined in: three.js/core/Object3D:traverseVisible 

Like traverse, but the callback will only be executed for visible objects

(object) => any

A function with as first argument an Object3D  object.

void

Descendants of invisible objects are not traversed. Note: Modifying the scene graph inside the callback is discouraged.

Group.traverseVisible


updateMatrix(): void

Defined in: three.js/core/Object3D:updateMatrix 

Updates local transform.

void

Group.updateMatrix


updateMatrixWorld(force?): void

Defined in: three.js/core/Object3D:updateMatrixWorld 

Updates the global transform of the object. And will update the object descendants if .matrixWorldNeedsUpdate is set to true or if the force parameter is set to true.

boolean

A boolean that can be used to bypass .matrixWorldAutoUpdate, to recalculate the world matrix of the object and descendants on the current frame. Useful if you cannot wait for the renderer to update it on the next frame, assuming .matrixWorldAutoUpdate set to true.

void

Group.updateMatrixWorld


updateWorldMatrix(updateParents?, updateChildren?, force?): void

Defined in: three.js/core/Object3D:updateWorldMatrix 

An alternative version of Object3D#updateMatrixWorld  with more control over the update of ancestor and descendant nodes.

boolean

Whether ancestor nodes should be updated or not.

boolean

Whether descendant nodes should be updated or not.

boolean

When set to true, a recomputation of world matrices is forced even when Object3D#matrixWorldNeedsUpdate is false.

void

Group.updateWorldMatrix


worldToLocal(vector): Vector3 

Defined in: three.js/core/Object3D:worldToLocal 

Converts the vector from world space to this object’s local space.

Vector3 

A vector representing a position in world space.

Vector3 

Group.worldToLocal