rememberFilamentScene

fun rememberFilamentScene(engine: Engine = rememberFilamentEngine(), skyboxState: SkyboxState? = null, indirectLightState: IndirectLightState? = null, content: @Composable FilamentSceneScope.() -> Unit): FilamentScene

Declares a Filament Scene as a value. The content lambda declares the world — lights, models, primitives, groups — via scene composables; it emits no UI and runs once at this call site regardless of how many FilamentViews later render the scene.

val scene = rememberFilamentScene(skyboxState = sky) {
Light(type = LightManager.Type.SUN, ...)
GltfInstance(asset = duck)
}
FilamentView(scene = scene, cameraState = cam) { Bloom(strength = 0.2f) }

Parameters

engine

Engine backing the scene. Defaults to a dedicated engine created and destroyed with this composable. Pass a rememberFilamentEngine value to share an engine.

skyboxState

Optional hoisted skybox state. Null = no skybox (the default).

indirectLightState

Optional hoisted IBL state. Null = no IBL (the default).

content

Scene composables (io.github.erkko68.filament.compose.scene.Light, GltfInstance, Group, primitives, …). They are extensions on FilamentSceneScope.