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

Sparse accessors are not handled correctly by iterators #154

Closed
bwasty opened this issue Mar 9, 2018 · 7 comments · Fixed by #246
Closed

Sparse accessors are not handled correctly by iterators #154

bwasty opened this issue Mar 9, 2018 · 7 comments · Fixed by #246

Comments

@bwasty
Copy link
Member

bwasty commented Mar 9, 2018

The SimpleSparseAccessor sample model is rendering like this in my viewer:
simplesparseaccessor

It should look like this:
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/SimpleSparseAccessor

Looking at the data layout / geometry explanations (in the sample model readme), it seems to me like sparse accessors are not considered by the iterators.

@alteous
Copy link
Member

alteous commented Mar 12, 2018

The library currently does not expose sparse iterators. I expect what you currently render is the 'base case' where vertices are not perturbed.

@bwasty
Copy link
Member Author

bwasty commented Mar 14, 2018

I'd still call it a bug. The iterators should at least fail instead of delivering wrong data if the underlying accessor is sparse.

@alteous alteous added this to the Release 1.0 milestone Jun 18, 2018
@alteous
Copy link
Member

alteous commented Jun 18, 2018

Let's fix this before the next release.

@bwasty
Copy link
Member Author

bwasty commented Feb 21, 2019

@alteous alteous removed this from the Release 1.0 milestone Jul 21, 2019
@alteous
Copy link
Member

alteous commented Aug 16, 2019

I'm attempting this now. It's quite difficult to achieve for all accessors. I suggest we start with morph targets (positions, normals, and tangents) and expand from there.

@alteous
Copy link
Member

alteous commented Aug 17, 2019

A sparse accessor differs from a regular one in that bufferView property isn't required. When it's omitted, the sparse accessor is initialized as an array of zeros of size (size of the accessor element) * (accessor.count) bytes. A sparse accessor min and max properties correspond, respectively, to the minimum and maximum component values once the sparse substitution is applied.

When neither sparse nor bufferView is defined, min and max properties could have any values. This is intended for use cases when binary data is supplied by external means (e.g., via extensions).

Our handling of sparse accessors is more broken than originally thought!

@bwasty
Copy link
Member Author

bwasty commented Aug 17, 2019

I haven't looked into the code for a while (and I'm currently traveling), but I wonder what makes it so hard to do generically for all accessors - in TypeScript (linked above) I found it surprisingly easy in the end.

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

Successfully merging a pull request may close this issue.

2 participants