- Home /
How to tell that i am drawing the same mesh to Graphics.drawMesh?
When i call Graphics.DrawMesh 60.000 times per frame, i see the VBO Total and VRAM usage increasing like crazy, this leads me to think that Graphics.DrawMesh is sending the mesh data every time it draws to the graphics card. This is the method that draws the meshes (5 different meshes each frame, they draw 4000 times and each have 3 materials, therefore Graphics.DrawMesh is called 5 4000 3 times per frame)
void Update() {
i++;
if (completed == null) {
return;
}
for (int i2 = 0; i2 < completed.Length; i2++) {
var com = completed[i2];
if (!com.processed) {
continue;
}
int i4 = i % com.frames.Length;
var vector3 = new Vector3(i2, 0, 0);
vector3 += com.frames[i4].position;
var rot = com.frames[i4].rotation;
var mesh = com.frames[i4].mesh;
for (int i6 = 0; i6 < 4000; i6++) {
for (int i3 = 0; i3 < com.materials.Length; i3++) {
Graphics.DrawMesh(mesh, vector3, rot, com.materials[i3], 0, Camera.main, i3);
}
}
}
}
How do i 'tell' Graphics.DrawMesh that it does not need to upload the mesh every single time?
Comment
Your answer
Follow this Question
Related Questions
Odd shadow behaviour from generated mesh 1 Answer
How to create a plow of fields ? 0 Answers
Creating a 3D curve? 0 Answers
Scene view looks better then the game itself... 0 Answers
Dymanic Mesh Hiding 2 Answers