- Home /
Mesh Performance Issues
We're finding that we are having performance issues when updating meshes during runtime on certain video cards. The particular problematic chip is an Intel HD integrated graphic card (http://www.intel.com/technology/graphics/intelhd.htm). Has anyone else ran into issues with this before?
While troubleshooting the issue we made a very simple example that seems to consistently reproduce the issue on the hardware. We are updating a mesh with 10 vertices once every second. Basically we are manipulating the position of the vertices to morph the objects shape. Additionally we are also adjusting the vertex color and UV coordinates every time we update the vertices.
Consistently we see stuttering when applying the new vertices. Additionally, if any sounds are playing they oddly become a beeping noise each time the hitch occurs. The problem does not seem to occur if we increase the amount of time between updates to around 20-30 seconds.
Is there any better way to optimize this in Unity for low end hardware? I assume this is also problematic for other Intel Integrated chipsets.
protected Vector3[] _vertices; protected int[] _tris; protected Vector2[] _uvs; protected Color[] _meshColors; protected Mesh _mesh; protected float _currentTime;
public void Start() { _currentTime = 0;
_meshRenderer = (SkinnedMeshRenderer)GetComponent(typeof(SkinnedMeshRenderer));
_mesh = _meshRenderer.sharedMesh;
// Our current test is only 4 quads in a triangle strip with 10 vertices.
// Code removed for brevity.
// Initialize _tris,_uvs, _meshColors, and _vertices with data.
_mesh.Clear();
_mesh.vertices = _vertices;
_mesh.uv = _uvs;
_mesh.colors = _meshColors;
_mesh.triangles = _tris;
_mesh.RecalculateBounds();
}
public void Update() { _currentTime += Time.deltaTime;
// Only update once a second
if(_currentTime < 1.0f)
return;
_currentTime = 0;
// Code removed for brevity.
// Update _tris, _uvs, _meshColors, and _vertices data.
// The hitch always occurs here 100% of the time.
_mesh.vertices = _vertices;
_mesh.uv = _uvs;
_mesh.colors = _meshColors;
_mesh.RecalculateBounds();
}
Answer by Jesse Anders · Feb 14, 2011 at 11:01 AM
It's been a while, so I don't know if you're still monitoring this thread, but I've also been running into some performance problems when updating meshes at run time on an Intel integrated card. (Or at least that seems to be the cause of the issues I'm seeing.) I was going to ask about it on the forums (and still may), but stumbled on this thread while looking for information.
I don't have an answer per se, but I thought I'd post just to confirm your observation. (Or at least possibly confirm it - again, I'm not completely sure what the cause of the problems I'm seeing is.)
No, we never found anything out. I narrowed the issue down to the performance issues where caused by the updating of the mesh object. If you set the data once, then the performance is not a problem. However, if you update the mesh frequently it is problematic. I tried various tests, and found that the performance would still hitch even if the mesh was updated every 15-30 seconds. The bigger issue I have is that I do not have this hardware in our office. Therefore, I had to do a special build of our game and then push it to our client to test and give feedback. It was quite slow and tedious.
@Bill I have been having serious issues with this as well. Did you ever figure it out?
Unfortunately we never figured out how to solve this. We ended up redesigning things to avoid having to do this. The issue seems specifically related to the chip set I mention. As I have not been able to reproduce it on any other machine.
Your answer
Follow this Question
Related Questions
View triangle count of a scene? 1 Answer
Mesh collider cost 1 Answer
Mesh.CombineMeshes does not work when mergeSubMeshes=false 2 Answers
Substract mesh from Skinned Mesh Renderer 0 Answers
Which is faster, Blendshapes or Non-Uniform Scaling? 0 Answers