1
votes

EDIT:

I had a question about exporting to obj and mtl but discovered that I could export from three.js using GLTFExporter.js and had success getting the geometry and texture out of three.js from that.

The issue I'm having with the GLTF Exporter is that I have textures that have offset and repeat settings that seem to not be exported from three.js when I open the file in Blender. In Blender the whole texture takes up the MeshPlane that used to only have a small part of the texture showing in Three.js scene.

Might anyone know what I could add to the GLTF Exporter to be able to record and keep the repeat and offset texture settings?

Many Thanks :)

1

1 Answers

2
votes

I've hit this myself.. and as far as I know, the answer is No.

Offset and Repeat are THREE.js specific features. Some other libraries have equivalents.. some engines use direct texture matrix manipulation to achieve the same effect.

One workaround is to modify your models UV coordinates before exporting to reflect the settings of texture.offset and texture.repeat. You would basically multiply each vertex UV by the texture.repeat, and then add texture.offset. That would effectively "bake" those parameters into the model UV's, but then would require you to reset .repeat and .offset back to 1,1 and 0,0 respectively, in order to render the model correctly again in THREE.js.

Here's a slightly relevant thread from the GLTF working group:

https://github.com/KhronosGroup/glTF/issues/107