question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

POINTS import: Invalid vertex attribute format+dimension

See original GitHub issue

This 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:open
  • Created a year ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
AR-Vsxcommented, May 10, 2022

No, I used the main branch. I switched branches, built the dll and it works fine now, Thank you and @camnewnham thank you too.

1reaction
camnewnhamcommented, May 4, 2022

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 the GetAttributeData 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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found