rememberRenderTargetTexture
Renders a FilamentScene off-screen through its own camera into a Texture that you can feed back into a material — the building block for mini-maps, security-camera monitors, portals and thumbnails. Returns the color attachment as a sampleable Texture (null until valid).
The off-screen view owns its own View, Camera and Renderer and redraws every frame via Renderer.renderStandaloneView; it is independent of any on-screen FilamentView. Bind the returned texture like any other:
val scene = rememberFilamentScene { /* world */}
val mapCam = rememberCameraState(initialEye = Position(0f, 40f, 0f), initialTarget = Position(0f))
val mapTex = rememberRenderTargetTexture(scene, mapCam, width = 256, height = 256)
val screen = rememberMaterialInstance(screenMaterial, mapTex) {
mapTex?.let { setParameter("screen", it, TextureSampler(TextureSampler.MagFilter.LINEAR)) }
}
Plane(material = screen) // a screen showing the mini-mapPost-processing is off by default (PostProcessing(enabled = false)): a DEPTH attachment is used, and Filament ignores depth attachments when post-processing is on. Pass a fully enabled PostProcessing — the same type and nullability FilamentView takes — only if you don't depend on the depth buffer.
Return
The color texture being rendered into, or null for a non-positive size.
Parameters
The scene to render off-screen. Supplies the engine.
Hoisted camera for the off-screen view. Defaults to a fresh state.
Texture width in pixels.
Texture height in pixels.
Post-processing configuration for the off-screen view. Defaults to PostProcessing(enabled = false), which skips the pass entirely — see the note above.
Shadow technique for the off-screen view, or null for none, as on FilamentView.
Redraw the texture on every display refresh. false stops once the current scene is in it and keeps that frame, as on FilamentView: for a thumbnail, or a monitor nobody sees.