Hey @Drigax, it the playground working and enough for you?
Hey @julien-moreau, thanks for the playground! I took a look, but Iām not quite seeing what youāre seeingā¦
My first test is to use one of my testing rigs that exports the scene, disposes the old scene, and imports fom glTF into the new scene:
Here is the starting scene with some modifications to see the texture orientation clearer using a UV checkerboard:
https://playground.babylonjs.com/#DHZKGW#2
when we enable the scene export then import with identical camera settings we get:
https://playground.babylonjs.com/#DHZKGW#3
Ignoring the change in lighting intensity, it looks like weāre properly applying the texture transform to the output texture hereā¦
we can even inspect the output glb:
to see that we are actually preserving the original orientation of the texture, and just exporting with KHR_texture_transform to handle the vscaling
Hey @Drigax, I think it has been fixed while you were looking for the bug because I donāt reproduce the bug anymore using my own playground
Iām testing with the scene of @sguerrero right now to confirm, but Iām pretty sure it is.
This is awesome news! Thank you @julien-moreau and @Drigax for all your time spent looking into the issue.
Hi, I think the bug still exists with PBRMaterials (Specular/Glossiness). If I export a .glb using GLTF2Export.GLBAsync, the KHR_texture_transform is missing for Specular Glossiness PBRMaterials. Metallic Roughness PBRMaterials are working fine on the other hand. I am on 4.2.0-beta.
@Drigax might be able to shade some lights on this one
*rimshot*
@thegabman Do you have a repro in a PG we can debug?
Hi,
sorry for being that late with my reply.
I just modified @Drigax playground to reproduce my problem.
https://playground.babylonjs.com/#DHZKGW#7
If āuseMetallicWorkflowā is true, than everything is working fine. Otherwise the scaling is not applied.
Ah, that appears to happen because when converting the textures from specGloss to metalRough, weāre dropping the extension and transform information when creating the new baseColor textureā¦
The fix is not too straightforward, as weāll have to bake texture transform information before combining baseColor + glossiness textures, so any texture transform will be applied to the output texture (I donāt think its too straightforward to preserve texture transform data of two combined texturesā¦)
Iāll create an issue to track this, but Iām not too sure this will be done before 4.2 release. Texture transform is lost when exporting SpecGloss textures Ā· Issue #8968 Ā· BabylonJS/Babylon.js Ā· GitHub
Okay, sound plausible. I got around this issue by implementing a custom postprocess to convert my diffuse/spec/gloss textures to baseColor/metal/rough textures following the math of the GLTFMaterialExporter. I apply this postprocess right before exporting my scene to a gltf/glb. For now that does the job.
For the future it would be great to keep the spec/gloss textures in the export using the KHR_materials_pbrSpecularGlossiness instead of converting them to metal/rough.
Maybe a year ago KHR_materials_specularGlossiness might have been the best solution, but at this point is probably most pragmatic to support KHR_materials_specular, since itās finally proposed for ratification. Iām re-titling this issue to represent this work, As Iād rather not move forward with the texture transform baking approach either, it feels like a half measure as well