Hi,
My objective is to render a cube which has 1 million cubelets. So the dimensions are 100100100 cubelets. My question is there any possibilty to render 1 million cubelets at a time with a decent frame rate. Here is my code
var cubeinstance : Transform;
var dimension = 10;
function Start ()
{
for (var z = 0; z < dimension; z++)
{
for (var y = 0; y < dimension; y++)
{
for (var x = 0; x < dimension; x++)
{
Instantiate(cubeinstance, Vector3 (x, y, z), Quaternion.identity);
}
}
}
}
Created a cube prefab and assigned it to this script and attached this script with the main camera.
The Problem : If I try to render more than 303030, the framerate drops severely.
Any ideas for optimization ??
Thank you.
firstly: Do you really need to render 1 mil cubes? (What the hell are you doing?) secondly: take a look at voxels
– Benproductions1Unless you plan some x-ray vision feature, you won't need to display all of these cubelets at once, so consider generating only those, that are required and manage them using a pool. If one needs to disappear, return it to the pool. If another one has to be drawn, get it from pool.
– ArkaneX