Pixi + Three-as-texture: 3D in a sprite
Render a 3D object inside a Pixi screen.
For a 3D menu item or a board inside a Pixi game, select PixiThreeTextureRendererModule from @gamedevland/engine/renderers/hybrid: system.renderer: new PixiThreeTextureRendererModule(). It needs pixi.js, three and @types/three.
Add a ThreeViewport to the JSON layout. The SDK creates a separate Three canvas and assigns its image to a Pixi sprite texture:
{
"itemPreview": {
"type": "ThreeViewport",
"props": {
"width": 400,
"height": 400,
"resolution": 1.5,
"sceneLayout": "json/layouts/previews/item.json",
"camera": "world.camera"
}
}
}
sceneLayout is the JSON asset ID containing Three nodes: groups, models, a camera and lights. camera names a camera inside that file. See the Three layout example. Each viewport has its own graph and IDs; do not declare children on the ThreeViewport itself.
In a component’s onReady, access nodes through viewport.world.requireNode(id, ThreeNode). The default is on-demand rendering: call viewport.invalidate() after changing 3D objects. For continuous animation, set renderMode: "always" in props.
viewport.resize(width, height, resolution) changes the texture size and camera projection. resolution must be between 0.25 and 2. Destroying the node releases the embedded layout, GLB instances, renderer and texture. Resources created by a game component remain that component’s responsibility.
Input stays on the Pixi sprite: Three raycasting inside the image is not automatic. Transferring the image requires copying pixels. ThreeTextureSurface remains available for custom rendering in code.