I need to put LOTs of small objects in my scene (a star field) and animate them. They need to appear more or less round, but since they will be so small, I made them out of octahedrons and they look fine. I made the model in Cheetah, which told me each octahedron had 6 vertices. That’s great, since I that means I can have 1000 of them in my scene and still total only 6000 verts. But in Unity, each one I add to the scene adds 48 verts, or 8x as many verts as I was expecting! I originally started with dodecahedrons, which Cheetah told me had 20 vertices each, but had 120 (6x) in Unity.
How can I predict how many verts an object I create outside of Unity will have after it’s imported? Will it always be significantly more in Unity? Is there any way I can create a simple, low-vert object that looks relatively round from all sides?
I think advanced lighting pumps up the vertex count (if you’re going by that rendering statistics window in the game preview)
EDIT: also, if your vertices are being shared but using different normals or different UVs for each shared side I think Unity creates a unique vertex for each combination. (I think this is due to the nature of hardware graphics rendering)
For something like this I would suggest using animated textures on long life particles or just a bunch of prefab 2d planes with animated textures on it. That should keep your polygon count very low and if the objects are that far away the eye shouldn’t notice they are planes instead of basic spheres.
I need to be able to move each object independently. In each frame, the position of each object gets updated based on user interaction. You can’t control the position of a particle after it is generated, can you?
They also need to be viewable from any angle. Wouldn’t a 2D object have to be constantly rotated to keep it facing a moving camera?
Particles are billboarded which means they are automatically rotated to face the camera. They are also able to be affected by forces and can be animated to move in space. Check out the particle documentation to see just how they work. They can even be attached to their spawn points and move with them, meaning you could have one spawn point be a galaxy and move it around and have others that move around themselves. With enough ingenuity you can do some pretty cool things with particles. You can even prime the particle system so it doesn’t have to spew out a bunch of them before you get a nice volume of them with one of its functions.
Wow, I didn’t know that. Haven’t used particles that much.
Sounds like I could create one particle per object, and then keep that object invisible. Move the object and the particle follows. Guess I need to start exploring the world of particles.
Particles work great at reducing vertices. Went from over 100k to 5k, and they look just as good. Thanks for the suggestion.
On the other hand, draws calls went up dramatically. Looks like one draw call per particle (emulated draw calls in the stats window). So now I have over 1000 draw calls. Can that be right? They all use the same texture. I guess I still don’t have a good understanding of how draw calls work.
A particle system is a single draw call regardless of the number of particles. I guess you’re using one particle system per particle, which is exactly what you don’t want to do. Just one particle system total is the way to go.
No problem, but yes, you should use as few particle emitters as possible for maximum performance. Each particle responds to physics and can be interacted with individually. Also, you can use a mesh particle emitter to create a varied non-visible object where particles will spawn from the vertecies. If its invisible the vertecies wont be drawn and have a net effect of zero. If you want a large disbursement of them and find it easier to spawn them from a single object to get a large field of them.
I now have one particle emitter with up to 1200 particles, and draw calls are down to 7 with a maximum of around 5k vertices. What a dramatic difference! I now have a whole new understanding of what can be done with particles.
This forum has been invaluable in helping me learn Unity. Thanks to all.
Glad to help. Yep, with a little out of the box thinking you can really find some cool ways to optimize your game with using alternative effects than what you would normally think to use.