I load a glb model in Three.js generated in SketchUp. The file can be found here https://www.graviditetsberegner.dk/bpnew.skp
The model contains a group called text with a mesh. I want to display a texture containing text here. I use the below code:
var modelLoader = new THREE.GLTFLoader();
modelLoader.load("https://www.graviditetsberegner.dk/bpnew.glb", function (gltf) {
model = gltf.scene.clone();
model.scale.set(50,50,50)
scene.add(model);
//Use canvas to draw texture and add it to the model group Text
var textModelMesh = FindMeshWithNameInModel(model, "Text");
var textTexture = CreateCanvasTexture("This is a test");
textTexture.wrapS = THREE.RepeatWrapping;
textTexture.wrapT = THREE.RepeatWrapping;
textModelMesh.material.map = textTexture;
I have two issues with the code:
- The text is mirrored. In other formats such as dae, the text is not mirrored
- The text is only displayed when I set wrapS and wrapT to RepeatWrapping. However, the texture used in SketchUp should be similar to the dimensions of the generated texture in the canvas.
How can I fix these issues?
A fiddle showing the problem: https://jsfiddle.net/Lgmds9ce/2/