How fast is the MeshWriter?

Our environment model includes a lot of text as meshes, which take up an enormous portion of the total vertex count. One way to simplify them would be to convert them into flat textures and fake depth with normal (and perhaps specular) maps.

But I stumbled upon the MeshWriter, which is a promising alternative. The basic example shows over 100k total vertices, but the total FPS is a ridiculous 2k!

In comparison, our whole environment model, including the text meshes, which is about 170k vertices, runs at approximately 150 FPS total on my PC when loaded into the Sandbox. What gives?

The most glaring difference I saw is that the MeshWriter example has 6 draw calls, whereas our model has over 480. Could that be the reason for the discrepancy, or does the MeshWriter have other optmizations going for it? Its documentation does mention it makes use of SPS, though I admit most of it flew over my head:

new Writer() builds a mesh with material that is inserted into the scene. This is a multi-step process with interim meshes and holes per letter. These meshes are sucked into an SPS and then disposed. At the end, one mesh, one material and one SPS have been added to the scene.

For context, here’s the stats in the Sanbox for our environment model:

And here’s the stats for the MeshWriter example on the Playground:


image


In conclusion, would you recommend using the MeshWriter? Or should I focus on reducing the draw calls first, and only then focus on the text?

I would say that if the MeshWriter suits your need and is faster then you should use it!

Also, there has been some discussions in this forum regarding drawing texts fast. Try to search for “fast text”.

1 Like

And OTOH if you like your custom text meshes better, you can try adding them to an SPS to get the draw count down to 1 if you like. Here’s the documentation page that shows how to create an SPS and add and position your meshes, etc… :slight_smile:

Even though the text is different for each mesh? Is it because they share (or are supposed to share) the same material?

Yup and you can use multiple materials but will end up with more draw calls (one per material). :slight_smile:
SPS Materials documentation :point_left: