Skip to content
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

Vertex attributes added using emscripten path hard codes normalized flag to false #1023

Open
bghgary opened this issue Sep 20, 2023 · 1 comment
Assignees

Comments

@bghgary
Copy link

bghgary commented Sep 20, 2023

See KhronosGroup/glTF-Blender-IO#2013 for some context.

It appears from the code here that there is no way to add a vertex attribute that has the normalized flag set to true through the emscripten code path. This causes issues when trying to decode normalized vertex attributes since the decode APIs will return an attribute with normalized as false when it should be true.

int PointCloudBuilder::AddAttribute(GeometryAttribute::Type attribute_type,
                                    int8_t num_components, DataType data_type) {
  GeometryAttribute ga;
  ga.Init(attribute_type, nullptr, num_components, data_type, false /* !!THIS IS HARDCODED!! */,
          DataTypeLength(data_type) * num_components, 0);
  return point_cloud_->AddAttribute(ga, true, point_cloud_->num_points());
}

To repro:

  1. Download the test.zip from this issue and extract no_draco_ushort_uvs.glb.
  2. Use Don's glTF-Transform tool to encode Draco with the following command line:
    gltf-transform draco no_draco_ushort_uvs.glb test.glb
    
  3. Open test.glb with the Babylon.js sandbox

Result:
The console will output:

Normalized flag from Draco data (false) does not match normalized flag from glTF accessor (true). Using flag from glTF accessor.

Expected:
The console does not show this warning.

@ondys
Copy link
Collaborator

ondys commented Oct 26, 2023

Support for normalized attributes in encoder emscripten will be added in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants