Hi I am using this BABYLON.GLTF2Export.GLTFAsync(scene, “object”).then((gltf) => {
gltf.downloadFiles();
});
for my base I have set texture offset and scale.
output in .gltf is showing like these
“baseColorTexture”: {
“index”: 0,
“texCoord”: 0
}
When I use my objects in latest sandbox version 4.2.0 beta it still not add texture transform.
It exports texture with offset and scale
https://www.babylonjs-playground.com/#2FDQT5#191
Check this out .
I am setting material baseTexture offset and scale and exporting scene to Gltf.
And in gltf its not adding khr texture transform extension.
Tracing through the export, Our implementation of the exporter for KHR_Texture_Transform is very suspect:
@kcoley appears to have authored this extension, but this implementation seems antithetical to the intent of the extension. I’m not sure why the original chair model appears preserved, however.
I decided to remove the baking from the texture export process entirely, I’m not sure why we would want to bake out a texture with the normal TRS transformations applied.
Rotate the UVs by this many radians counter-clockwise around the origin
If the rotation point is not at the origin [0, 0], I don’t think there is a way to preserve the original intent in a glTF and thus we bake the transform into the texture. We should use the same resolution though and it shouldn’t loose much precision.
Ah, the original complaint was that we were removing the Texture transform extension, if that’s the case then this isn’t a bug. The textures appear to be baked properly. @Atul_Sharma, since you’re offsetting the texture, we cannot export this texture using KHR_texture_transform as @bghgary explained.
Well, hold on. The PG from @Atul_Sharma doesn’t do any rotations. If you set uRotationOffset and vRotationOffset to 0, then it won’t bake the transforms. This is because uRotationOffset and vRotationOffset default to 0.5, 0.5 in Babylon.js.
But since we are not doing any rotations at all, the uRotationOffset and vRotationOffset shouldn’t even matter. The code should be updated to check if there is even a rotation.