jnsmalm/pixi3d

Optimization

Closed this issue · 1 comments

Hi I want to understand how to optimize this scene , so that objects that are not visible are not shown.
Or maybe batch render all the cubes at ones.

Here is a working example I made that I want to optimize so that I can display more cubes
https://codesandbox.io/s/long-currying-ortbc1

thank you.

Hello!

You can use instancing to reduce draw calls. In your example, create first a mesh outside the loop then create instance inside the loop.

// Outside loop
let parent = app.stage.addChild(Mesh3D.createCube());

// Inside loop
let mesh2 = app.stage.addChild(parent.createInstance());