- Home /
my model make my game lag, how can i compressed it ?
Hi, all, sorry i want to ask how can i compress my model in my game, because my model make my game lag. When i only use 5 model, my game not lag, but when i use 10 model, my game lag and can't play anymore because of lag, how can i compressed my model, or how can i make my game not lag when i use many model on it ?
my model is in FBX file.
Thanks
Answer by Setzer22 · Jan 14, 2013 at 01:59 PM
I don't know if there's any program to lower the poly count for a 3d model automatically, otherwise you'll have to do it yourself with a 3d modelling program. If you got the model from someone or somewhere, try to ask if you could get a lower poly version for tht model. It's not the file size what causes you lag, it's the amount of poligons for your 3d model, which might be too high for a videogame. Especially if you're aiming for mobile platforms (such as android) you should take into account that those devices can't hold many poligons on-screen at the same time.
Someone correct me if I'm wrong, but no characer in your game should exceed 1500 poligons at average (when aiming for a mobile platform at least). You can check the number of triangles of your character's (or model) mesh through the inspector. Just double-click on the "mesh" property of the meshFilter, feedback on the number of triangles for your model might help people here to tell you what's going on more precisely.
Hope it helped, it's not an easy to "fully-answer" question
Answer by Wolfram · Jan 14, 2013 at 02:05 PM
Either simplify the model in your modeling program, or use an external tool such as PolyTrans.
However, the most important thing is to reduce draw calls. One important Unity tool to help reduce these is CombineChildren.cs in the StandardAssets.
Other than that, we would need some more information about your model (how many triangles, meshes, materials, drawcalls, ...).
oh no, my model about 6000 poligons and my game for android, how can i reduce the poligons into 1500 @.@
what's polytrans? i never heard it before ?
so combinechildren.cs attach to my model?
hmm, i don't find where i can find triangles, meshes, materials and drawcalls, i can find it on unity or 3ds max?
so what i need is to reduced my poligons into 1500 right? but when i reduced it into 1500, my model not look like model anymore haha
Well yes, reducing your model to a lower poly count equals less quality, and thus, faster drawing. So it won't look anymore like your model, It's like when you reduce a sprite's size, it becomes more "pixelated". Well, it's the 3d equivalent for that.
I'm not really sure of that "1500" triangle count restriction, but with a little ressearch I've found people which recommended not to get over 800-1000 vertices for a mobile game, so it might be even lower. Anyway, you can't have by any means 6k poligons in your mesh for a mobile app, it won't handle it.
Anyway, long story short, blame your modeller if you hired one, or make lower poligon models if you're the modeller. As @Wolfram said, you can also use PolyTrans, which seems to be an application to lower the poly count for your model, but with that you might not get the best results. The best thig to do is to create the model again, using the high poly mesh as a refference, but that's not a game programmer's issue, that's more like a 3d artist issue (Of course this is much more costly than just converting it with a program).
And if your model consists on more than one mesh (which it is very likely). It will also improve your speed greatly combining all the meshes in one (as @Wolfram said, once again), either in your modelling program, or using the builtin Unity method
Oh, and to find the drawcalls you should look in Unity, 3ds max won't tell you. When you're on play mode click on the "Stats" button and it will show the current draw calls on screen.
Exactly, the Stats screen will also show you the number of rendered triangles.
Note the absolute performance killer nowadays are the number of drawcalls, not primarily the polygon count. It can very well be that 10 meshes with 5 materials each and 100 triangles each will render slower than 6000-10000 triangles using one mesh and the same material. This is also the reason why texture atlases are important.
Combine$$anonymous$$eshes.cs helps to reduce the drawcalls, especially if your model is split into several meshes (take a look at the hierarchy each child node usually has 1 mesh). The script will not help reducing polygon complexity.
You could also look for tools for LOD generation ("level of detail"), I think there might be some for Unity out there.
hmm, ok so i must create the model again and with low poly right, but the problem just like that the model won't look like model anymore hahaha..
yah, i look at polytrans and i'll try to use it later.
i already look from stats so this is the result : Drawcalls : 100++ tris : 150k verts : 140k
that's it,haha.. so what is tris and verts and drawcall too?
Your answer
Follow this Question
Related Questions
Changing size of model with animation 1 Answer
The 3D modeling‘s animation is too big! 0 Answers
MMD How to export model and animations to Unity as 3rd person controller? 2 Answers
Difference between sizes 1 Answer
Unity changes image size 1 Answer