Skip to content

Meaning of vertex count for optimizeVertexCache/optimizeOverdraw/optimizeVertexFetch with LODS #520

Answered by zeux
JesseRMeyer asked this question in Q&A
Discussion options

You must be logged in to vote

Generally speaking, when a function in meshoptimizer takes an index buffer and a vertex_count, vertex_count is simply an upper bound of the values referenced by the index buffer (+1). You could pass a larger value, which may cause some algorithms to run a little slower, but produce the same output.

Of course when a function only takes an array of vertex data, such as meshopt_optimizeVertexFetch, it's the actual number of vertices that the algorithm will process.

The reason why the demo passes the size of the original vertex buffer in the snippet you quoted is that that code produces an index buffer per level of detail, but shares the vertex buffer. This is optimal from the total memory co…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by zeux
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants