Support for exporting aoMaps and the second UV channels#8728
Support for exporting aoMaps and the second UV channels#8728tanaydimri wants to merge 2 commits into
Conversation
|
Per specs, aoMap should be called |
Hi @Maksims Unless I misunderstood what you said... |
|
My appologies if I took it out of context, just saw in PR mention of aoMap, and do remember that in GLTF specs it was occlusionTexture. So commented just to make sure. And yes, the call you've mentioned - does what you say. So all seems great! |
There was a problem hiding this comment.
Pull request overview
Fixes glTF exporter bugs related to materials using non-zero UV channels and missing AO map export. Texture infos now emit a texCoord matching the material's <map>Uv setting, aoMap is added to the recognized texture semantics (so it gets collected and considered for stripping), and the stripUnusedAttributes logic now keeps a TEXCOORD_n whenever any material texture references that exact UV index.
Changes:
- Add
aoMaptotextureSemanticsso the AO texture is collected and not stripped. - In
attachTexture, read<semantic>Uvfrom the material and write it to the texture info astexCoord. - Rewrite the
TEXCOORD_nretention check increatePrimitiveto compare the material's<semantic>Uvagainst the attribute's index instead of relying onTiling.uv.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| index: textureIndex, | ||
| texCoord: textureTexCoord | ||
| }; | ||
|
|
There was a problem hiding this comment.
@mvaligursky I am not sure if this is necessary? I am guessing this would only save a single line per material. But I don't see any harm leaving it in there. Just in case a GLTF viewer doesn't set it to 0 by default.
I can definitely make the change if you think I should...
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Description
While testing out the GltfExporter with an asset that had maps in any other UV channel than 0, the exported GLB would not contain this map at all. Also noticed that the aoMap was not included in the textureSemantics (which seems to drive what will be exported), causing the AO maps to be ignored altogether.
Fixes Issue: #8727
Fixes
Fixes some bugs in GltfExporter where:
You can try it out by exporting this glb with the existing playcanvas build vs the build from this PR
playcanvas_glb_export_test.zip
Checklist