Number of polygons in model to size in KB within ram
Hi, I want to calculate the size of Model in KB in ram. My Maya model has 3.9K vertex, nearly same faces and 7.8K edges. It has 4 animations. I want to create dozens of instances in scene.
Answer by Glurth · Aug 07, 2016 at 04:18 PM
Each face will require 2 bytes (int: 0-65k) to index each vertex, and being a triangle, will have 3 such vertex-indicies: total 6 bytes. 6x3.9k= 23.4k
Each vertex will store 3 floating point numbers as coordinates. a float is 4 bytes: total 12 bytes. 12x3.9k= 46.8k
The edges are not stored.
If we assume that each vertex has a unique Normal and UV coordinate:
normal: 3 float coordinaes, UV: 2 floats coordinates total of 5*4 bytes more per vertex = 20*3.9k = 78k
Subtotal: 23.4k + 46.8k + 78k = 148.2k bytes
These 148.2K bytes define the mesh. note: Even if you have multiple objects in unity that use this mesh, the 148k mesh-definition should exists only ONCE in memory.
Not sure how maya defines those animations, but I would suspect the memory used depends on how many verticies you are animating, times how many keys each animation has. I'm also unsure how/when unity will load/use those animations from maya.
You have calculated impressively the size in ram.
But one questions. For multiple objects won't each object instantiated will have own vertex values as coordinates, so it should maintain its own value ?
If I remember correctly once I developed a game & I instantiated number of same characters but my game got slower when I have 15 characters. $$anonymous$$eshes were nearly same size about ~1$$anonymous$$ more polygon count.
The faces are probably stored internally as tri-strips or fans, which take only about 1.4 points/tri, depending on the average length.
An excellent point, those numbers are completely raw, and uncompressed. How much it can be compressed depend, as with most things, on the object's data itself.
@fahimalavi No, multiple objects that use this mesh will share the single mesh in memory (and it's verticies, normals, uv's, and colors). However, each object WILL have it's own TRANSFOR$$anonymous$$. this transform will define how the mesh is oriented, scaled, and positioned in WORLD SPAC$$anonymous$$ Each vertex of the mesh will be processed THROUGH the object's transform when being drawn.
Your answer
Follow this Question
Related Questions
Hide items on export from Maya? 0 Answers
Maya Animations getting only partially lost in Unity 0 Answers
How to make bedside table with drawers 1 Answer
How to make AR Floor Plans? 1 Answer