Hello, so I’m in the beginning states on creating a VR game in Unity for the HTC vive. The game is a bit like Minecraft in that it will allow you to build structures out of cubes and cylinders, spheres etc. Before I get too far into this, I’m wondering about the performance considerations of adding hundreds, possibly thousands of objects on the screen. Looking at a game like Minecraft, it’s built using a very large number of blocks. I don’t know the details, but if the Map was 128ux128x128, this is over 2 millions blocks.
Does anyone have any thoughts about how the game manages to render all of these and keep the performance where it needs to be? Does anyone know any tricks that are used for this kind of thing?
I know that I can generate hundreds, and (perhaps thousands?) of Cube primitive objects, and place them in a scene without the performance degrading much, but I certainly can’t for example generate 50,000 or more.
There are VR games like TiltBrush, and sculptrvr where the users can paint in the 3d space and these seemingly drop huge numbers of objects into the play area, and again I’m wondering how this is handled without very quickly killing the performance.
Obviously my question is variable depending upon the GPU/CPU. I ran a test where I generated a 10 x 10 x 10 grid of cubes (1000 cubes) and a 15x15x15 grid of cubes (3375 cubes). Performance was fine with 1000 cubes, but I was getting frame losses at 3375 cubes. This is with a nvidia 980ti video card. So on my system, I have a rough idea of how many unity primitive cubes will work in a scene, but it seems like these 3d sculpting program (like sculptrvr) are creating several thousand objects. Google “sculptrvr” to see videos of what I mean. Does anyone know how the creators of this type of software pull this off?
Also, some primitives have many more faces and vertices than others, like for instance quads vrs planes, and spheres are much higher polycount than a cube… so different primitive, different performance.
Interesting. Clearly there’s a lot I need to learn on the subject. So if, for example, I’m in VR and am using on of the controllers to “paint” in 3d space out of small cubes, then instead of dropping down individual cube primitives I would instead (somehow) merge the newly dropped cube into the mass of cubes that was previously painted? If that’s the case, then I should look into how to do this. If anyone has any tips on how (the basic steps) this is done, I’d appreciate it.
For my particular game, the core functionality really requires primitives because after building the structures, you can blow them up which requires the unity physics to act on the individual pieces. If this limits the number of pieces that can be placed into the hundreds, then so be it. I’m still intrigued by the idea you mentioned about clustering objects together. I may want to add a 3d painting component to the game that wouldn’t need to react to the physics.
Hi, thanks for the link. There’s a lot of good information there. I did find a script that lets you combine the Meshes of multiple objects into a single mesh. After running this script, the 15 x 15 x 15 cube of cubes that I was creating was no longer causing judder.
Depending if that script takes the actual hidden faces and vertices out and other optimizations, it might be a good idea to use a different approach than thinking of “cubes” at all really, and instead sort of a huge 3d array of integer that mean a “type” of block item whatever thingy. Then you just draw faces on the visible sides of nearby sections of the map depending on what type of block that is and never create or modify actual cubes at all… it might be something you could even find an example/script for in that thread!