If your geometry uses multiple vertex streams (e.g., separating positions from normals/UVs for depth pre-passes), you must use the Multi variants of certain functions and remap each stream individually.
Vertex Remapping for Multiple Streams
To generate a vertex remap for multiple streams, use meshopt_generateVertexRemapMulti. After generating the remap, you must call meshopt_remapVertexBuffer once for each individual vertex stream to produce the correctly reindexed data.
Shadow Indexing
Use meshopt_generateShadowIndexBufferMulti as a replacement for the standard shadow indexing function when working with multiple streams.
Vertex Fetch Optimization
Instead of using meshopt_optimizeVertexFetch on a single buffer, it is recommended to use meshopt_optimizeVertexFetchRemap and then call meshopt_remapVertexBuffer for each stream.
Vertex Compression
When compressing vertex data, use meshopt_encodeVertexBuffer on each vertex stream separately. This allows the encoder to better utilize correlations between attribute values within each specific stream.
meshopt_Stream streams[] = {
{&unindexed_pos[0], sizeof(float) * 3, sizeof(float) * 3},
{&unindexed_nrm[0], sizeof(float) * 3, sizeof(float) * 3},
{&unindexed_uv[0], sizeof(float) * 2, sizeof(float) * 2},
};
std::vector<unsigned int> remap(index_count);
size_t vertex_count = meshopt_generateVertexRemapMulti(&remap[0], NULL, index_count, index_count, streams, sizeof(streams) / sizeof(streams[0]));