Skip to main content

Introduction

PixiJS 3D, the @pixi/3d package, draws 3D scenes in a PixiJS application. A View3D holds the scene. It's a display object you add to the stage like a sprite. Hello cube shows the smallest scene, a cube and a light in a view.

How 2D and 3D fit together​

2D content later in the display list draws over the scene. 2D content earlier in the list shows behind it, unless you give the view a background. By default the view catches pointer events anywhere in its rectangle, so the user can't click, tap or hover 2D content behind it. Interaction shows the ways around this.

The scene inside a view is its own tree of Container3D nodes under the view's root. A 2D display object can't go in that tree, and a 3D node can't go on the stage. To show 2D content on a 3D surface, draw it into a ContainerTexture (Rendering 2D into 3D). To pin a 2D label over a 3D object, use worldToScreen (View3D and 2D content).

Inside the scene, +Y points up, and the defaults expect one unit to be a metre, not a pixel. A camera draws nothing past its far distance, 1000 units by default, so it cuts off a scene built at pixel sizes.

Features​

Some parts come from @pixi/3d/extras, another entry point that Installation explains.

There's no physics engine; bring your own.

Renderers and performance​

PixiJS 3D draws with WebGPU or WebGL2. WebGL and WebGPU covers choosing one.

Performance explains what keeps a frame cheap and has a checklist for phones.

Next steps​