POINTS import: Invalid vertex attribute format+dimension
See original GitHub issueThis error occurs when using some sample files from the draco repository, such as https://github.com/google/draco/blob/master/testdata/pc_kd_color.drc
Full error text:
ArgumentException: Invalid vertex attribute format+dimension value (UNorm8 x 3, data size must be multiple of 4)
UnityEngine.Mesh+MeshData.SetVertexBufferParams (System.Int32 vertexCount, UnityEngine.Rendering.VertexAttributeDescriptor[] attributes) (at <07c89f7520694139991332d3cf930d48>:0)
Draco.DracoNative.CreateMesh (System.Boolean& calculateNormals, System.Boolean requireNormals, System.Boolean requireTangents, System.Int32 weightsAttributeId, System.Int32 jointsAttributeId, System.Boolean forceUnityLayout) (at Packages/com.atteneder.draco@4041c676d1/Runtime/Scripts/DracoNative.cs:540)
At a glance, it seems that Unity requires multiples of 4 for vertex attributes, but (presumably) these draco encoded attributes are 3xUInt8 (R,G,B instead of R,G,B,A).
What’s the best way to go about converting this into a format Unity is friendly with?
Issue Analytics
- State:
- Created a year ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Feedback Wanted: Mesh scripting API improvements
ArgumentException : Invalid vertex attribute format+dimension value (Float16 x 3, data size must be multiple of 4)
Read more >OFF / Object File Format import issues #2228
The implementation I provide loads all possible vertex attributes (normals, vertex colors, and texture coordinates).
Read more >Vertex Data and Vertex Descriptors
In essence, an attribute describes the size and location of a single vertex property (position, texture coordinates, etc.), while a layout ...
Read more >Scripting API: VertexAttributeDescriptor
Description. Information about a single VertexAttribute of a Mesh vertex. ... Float16 format with dimension 3 is not valid. See Also: SystemInfo.
Read more >"Invalid Texture Index" when importing certain .obj files into ...
When trying to import certain .obj files into 3ds Max 2018, the error: "Invalid Texture Index" appears and the file doesn't load.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No, I used the main branch. I switched branches, built the dll and it works fine now, Thank you and @camnewnham thank you too.
Here’s a brief test of this in these PRs (for discussion purposes)
This works by: DracoUnity - determines whether padding should be applied, using a
PaddedColorAttributeMap
. Passes the padded number of components to native. Draco - has an additional parameter to theGetAttributeData
method which specifies an override for the stride of num_components.At the moment, I’m not infilling with
255
as this would require a performance hit in C# or a bit more mess in C++. Most unlit shaders don’t support alpha…This fixes: https://github.com/google/draco/blob/master/testdata/pc_kd_color.drc https://github.com/google/draco/blob/master/testdata/point_cloud_no_qp.drc
There are unrelated issues with these: https://github.com/google/draco/blob/master/testdata/cube_pc.drc https://github.com/google/draco/blob/master/testdata/pc_color.drc
These fail at
(*decoder)->DecodePointCloudFromBuffer(*buffer)
, and I am not sure why…