Decode oct-encoded normals from glTF 1.0 #98
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #97
Details are described in the issue and the comment linked from there.
A tl:dr:
gltf-pipeline
, then the 2D normals are transferred into the glTF assetWith this PR, these 2D normals will be converted into 3D normals as part of the
upgrade --targetVersion 1.1
step.The
upgrade --targetVersion 1.1
will convert B3DM and I3DM to GLB. After the GLB was upgraded from glTF 1.0 to 2.0, the upgrade step now creates a glTF-Transform document, goes through all meshes/primitives/NORMAL attributes, and if one of them is aVEC2/BYTE
orVEC2/SHORT
accessor, then it will be converted into 3D normals by oct-decoding them (with a snippet borrowed from CesiumJSoctDecode.glsl
).I have added a spec file in the new
specs/data/migration/input/BatchedLegacy/BatchedWithGltf1With2DNormals/
directory. Creating such an "invalid" glTF 1.0 was a bit of a hassle, but ... https://github.com/javagl/JglTF still supports glTF 1.0, so that was doable. The B3DM that contains this glTF 1.0 will be converted into a glTF 2.0 GLB (and the JSON of that is used as the 'golden' reference, similar to the other migration specs).I also tested the whole thing with the 'New York' data that originally sparked the linked issue. (I could probably just have used a B3DM from that data set, but ... who knows that the licensing implications could be. I'm trying really hard to stay away from lawyers). The resulting data set can be rendered in CesiumJS as expected.