rememberFilamentScene

fun rememberFilamentScene(engine: Engine = rememberFilamentEngine(), 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 {
Skybox(color = LinearColor(0.05f, 0.05f, 0.08f))
DirectionalLight(intensity = LightIntensity.LuminousPower(100_000f))
GltfInstance(asset = duck)
}
FilamentView(scene = scene, cameraState = cam,
postProcessing = PostProcessing(bloom = 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.

content

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