causita
causita

Reputation: 1708

Three.js slow with thousands of objects

I'm creating about 12,000 + BoxHelpers and the loading and, specially, the navigating is very slow. I want to know if there is a better approach

this is what I have

    var c=[];
c.push([    -100,15,285 ]);
c.push([    0,25.5,285  ]);
c.push([    0,51,285    ]);
c.push([    0,76.5,285  ]);
c.push([    0,0,297 ]);
c.push([    0,25.5,297  ]);
c.push([    0,51,297    ]);

.... this is for example only. actual data comes from json.

var cubeGeometry = new THREE.CubeGeometry(10, 24.5, 12);


  for (var i in c)
        var cube = new THREE.BoxHelper();
    cube.material.color.set( 0x6666FF    );
    cube.scale.set( 5, 12, 6 );
    cube.position.set(c[i][0], c[i][1],c[i][2] );
    scene.add( cube );
    }

May be creating the whole building then just add the building to the scene? but I dont even know how to do start.

Upvotes: 1

Views: 491

Answers (1)

mcode
mcode

Reputation: 466

You wanna create a Building out of thousands of objects?

If I get it correctly: - Create the Building in Blender and import it, or - Create the Building out of ONE Geometry with thousands of vertices and faces

Can you upload an example Code in jsfiddle?

Upvotes: 1

Related Questions