I’m using procedural mesh component to generate my city scenes like so:
Since the scene is one dynamically generated city scene viewed from above, I really only should be rendering it in one draw call if possible, using a single mesh section.
The problem is that CreateMeshSection is extremely slow, and slows down the more vertices I give it.
As I understand it, CreateMeshSection is really for initialization. If I wanted to change the number of verts say, I’ll have to do it through this.
Instead, I could use UpdateMeshSection which disallows changing of triangle ordering. Is there a reason for this? Can I hack a version of ProceduralMeshComponent.cpp to support modifying the face ordering, even if the vertex count doesn’t change?
My plan is: create a mesh section that’s 1000000 (some big number to support everything) of verts large, then shove all of those into 0,0,0 until I need them. When I’m procedurally generating meshes, all I’m doing is setting the vertex position. However the triangle ordering will change (and that’s ok…). I really should be able to use UpdateMeshSection to update it without problems. So far this solution doesn’t work because I don’t know the triangle ordering ahead of time, as it may change.
My questions are:
- Can ProceduralMeshComponent be modified to update triangle ordering?
- Has anyone run into a similar issue with a more elegant solution
- Should I be using multiple mesh sections instead? What are the performance ramification of this?