-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayMesh with flag USES_EMPTY_VERTEX_ARRAY still needs vertex array for rendering work #83446
Comments
Please provide a GDScript version of your code, unless this is unique to C# this is preferred and otherwise few contributors will be able to help debugging this |
Indeed, the size of the vertex array is used to determine whether 16 bit or 32 bit indices are used. I guess we have a few options:
|
Ok I updated the issue with a GDScript version. It's not unique to C#. |
As of 4.2.1, the GDScript MRP with the no vertex array option works fine. The custom_aabb or extra cull margin do need to be non-zero so it doesn't get culled by the renderer. Here's an updated, working MRP. |
In this case, is this just a documentation issue? |
It appears to me that as of 4.2.1, this ticket is satisfied and can be closed, unless you want to add documentation. |
Looks good to me. It could be closed. |
While the `RenderingServer::mesh_create_surface_data_from_arrays` method does support vertexless meshes (see godotengine#62046 and godotengine#83446), it enforces that the size of custom arrays is dependent on the size of the vertex array. This effectively means that custom arrays cannot be used in vertexless meshes. This commit changes the way the array length is computed so that if no vertex array is provided, its length will be inferred from the custom arrays, if provided. It therefore adds support for custom arrays in vertexless meshes.
Godot version
v4.2.beta1.mono.official [b137180]
System information
Godot v4.2.beta1.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated GeForce GTX 1650 () - AMD Ryzen 7 4800H with Radeon Graphics (16 Threads)
Issue description
I was experimenting with reading geometry from a Texture when I come across #62046 and found some weird behaviours when creating a ArrayMesh with the MESH_ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY flag:
From this analisis, I conclude the most probable cause is that somewhere in the mesh creation phase there is a check that looks at vertice count to decide if should use or not 16-bit indices. So when no
The main issue here is the requirement in providing a dummy 65k vertice array just to signal that a 16-bit index should not be used.
Conclusion
Vertex-less meshes should work out of the box without needing any vertex array to be created, basically the way it should work is that when the mesh has the empty vertex array flag the logic to decide if a 16 or 32 bit index should be used needs to be different, maybe the user could pass a flag overriding the underlying logic and specifying that 32 bit indices are needed
Steps to reproduce
Look at the Minimal reproduction project.
The general steps are:
If no vertex array is give to ArrayMesh, nothing is drawn
If a vertex array with size 1 is given, primitives are drawn but VERTEX_ID will be 16 bits, causing issues with big meshes, solving by giving a vertex array with size 65536+1
Minimal reproduction project
IssueVertexLessMesh.zip
Edit: Added GDScript version
IssueVertexLessMeshGDScript.zip
The text was updated successfully, but these errors were encountered: