Repository navigation
glTF: texture transform, node visibility, animation pointer, and the rendering fixes they surfaced - #447
Merged
Conversation
…h nodes between joints
…e alpha, unsigned bone indices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Viro now reads the glTF extensions most real-world GLBs ship with, and a set of loader and shader defects that a large corpus of production models exposed is fixed. Before this, every file using
KHR_animation_pointerfailed to load outright, emission never showed on PBR materials, opaque meshes went see-through wherever their texture's alpha was low, and on the web no skinned model drew at all.Loader (
VROGLTFLoader,tiny_gltf.h)KHR_texture_transformand texture coordinate sets. Offset, rotation and scale apply when the material is drawn, and a texture can sampleTEXCOORD_1or later (texCoord, which the extension may override). Viro samples a material's textures through one set and one transform, chosen by the base color texture (else the first other texture); the emissive texture keeps its own transform.KHR_node_visibility. Hidden nodes load hidden with their descendants.KHR_animation_pointer. Node visibility,baseColorFactor,emissiveFactorand the base color texture's offset/rotation/scale are driven per glTF animation and play under its name alongside its node and skeletal channels. Pointers at a node's TRS or weights are rewritten into ordinary channels at parse time; other pointers are skipped with a warning naming them.nodeis optional (this is what made pointer files fail), onlyassetis required at the top level, and a sampler'sinterpolationdefaults to LINEAR (Khronos's Fox sample failed without it).OPAQUEmapped toRGBZero, which nothing implements, so the base color's, texture's and vertex colors' alpha leaked into blending. OPAQUE and MASK now ignore it (VROMaterial::setIgnoresDiffuseAlpha); the material's transparency and the node's opacity still apply, so fades keep working. BLEND no longer writes depth, as three.js, Babylon and Filament do.Waist_tr→Waist) had a broken bone tree and played in bind pose. A joint's world transform is now the product of every node in its chain (animated or at rest) up to the skinned mesh's own ancestors, and an animation of any of those nodes drives the skin.Shaders and materials
material_texture_transform(GL, a surface modifier ahead of every texture sample) andtexture_transforminVROMaterialUniforms(Metal, applied in the vertex stage).uvec4and every integer source is bound unsigned: WebGL refused glTF's unsigned 8/16-bit joints againstivec4, so skinned meshes never drew on the web.wasm/preloadandandroid/sharedCode/src/main/assets.Culling (
VRONode)A subtree holding a skinned mesh is never culled whole: its bounds come from the bind pose, so a model posed away from it lost parts (a character's eyes) as the camera came close.
Notes
KHR_draco_mesh_compression) is still unsupported.CHANGELOG.mdandRELEASE_NOTES.mdare updated under 3.1.0.Testing