Jump to content

Fixed slow runtime mesh creation


Brutile
 Share

Recommended Posts

To anyone creating mesh at runtime, like an endless terrain or something, you don't have to call Update() on the surface you just created. It was in the documentation, so I thought it was something you had to do when you created a model, but you only need to call model->UpdateAABB() with local and global parameters, like in the docs.

 

Updating the surface took around 15-20 milliseconds, which was causing frame drops when I was creating chunks of terrain, and there was nothing I could do to speed it up. But I tried it without surface->Update() and it now runs at a steady 100fps, instead of 100 and constantly dropping to 40fps.

 

Hope this helped a few people :D

  • Upvote 2
Link to comment
Share on other sites

Update() is rather thorough. It will calculate binormals/tangents, BSP collision for raycasts, and some other stuff.

 

Try calling UpdateBinormalsAndTangents() as well. I'm pretty sure the BSP collision will just recalculate itself only when needed.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...