Replies: 6 comments 4 replies
-
If you just want to access vertices then you need to use the vertex indices in the meshlet data, for example:
|
Beta Was this translation helpful? Give feedback.
-
下面是cpp中 meshlet 的构建代码 The following is the C++ code for constructing meshlets. struct Vertex struct Mesh Mesh tmpMesh; "...construct tmpMesh using MyMesh in my project..." meshopt_optimizeVertexCache(&tmpMesh.indices[0], &tmpMesh.indices[0], tmpMesh.indices.size(), tmpMesh.vertices.size()); The following is part of the code in 'my.mesh.'" IndexList contains the original indices of tmpMesh, and Positions represent the original vertex coordinates of tmpMesh. for (int i = 0; i < meshlets[meshletIndex].triangle_count; ++i) {
The above code renders correctly only for meshlet[0]. meshlet[1], meshlet[2], and so on, do not render correctly. I suspect that the indices of the vertices in each meshlet are not corresponding properly, but I am not sure how to address this. |
Beta Was this translation helpful? Give feedback.
-
I haven't found such a comprehensive tutorial. Luckily, I am also using Vulkan. Thank you so much. |
Beta Was this translation helpful? Give feedback.
-
meshopt_generateVertexRemap(remap.data(), 0, index_count, triangle_vertices.data(), index_count, sizeof(Vertex)); Can the triangle_vertices.data() parameter be the deduplicated vertices? My project has already loaded the model data, and the vertices of these models have been deduplicated. Can I directly use the deduplicated vertices and corresponding indices from my project to construct meshlets |
Beta Was this translation helpful? Give feedback.
-
I followed the steps mentioned above to read both OBJ and GLB models, then constructed meshlets, and finally rendered them. However, only the OBJ model renders correctly, while the GLB model does not render properly. My question is, do different models need to undergo a unified preprocessing step before meshlet construction? |
Beta Was this translation helpful? Give feedback.
-
Before constructing meshlets, I performed the following operations: lodIndices is the index array of the model, and vertices is the vertex array of the model std::vector verticesReMap(lodIndices.size());
When I removed these lines and directly performed meshlet construction, everything worked fine. Now, I'm using a GLB model with 5,000,000 vertices in my project, and it's working properly. Regarding this code snippet causing issues with building meshlets for my GLB model, I will investigate further. Thank you very much |
Beta Was this translation helpful? Give feedback.
-
I'm incorporating meshlets into a mesh shader, and there are some parts that I don't quite understand. For example, I have a mesh with 150 vertex coordinates and 576 indices. After generating meshlets, I have three of them. I want to extract the vertices, normals, and UVs from a meshlet based on the vertexList and indexList of the original mesh. I attempted to calculate it like this:
for (int i = 0; i < meshlets[j].vertex_count; ++i) {
index = meshlets[j].triangle_offset + i;
position[i] = mesh.vertexList[index];
...
}
In the end, I found that this approach is not correct. This is because the vertex data in the VertexList has been deduplicated. Have I missed something?
Beta Was this translation helpful? Give feedback.
All reactions