Hello! Is there a way to apply a wrapping / repeat effect on a material directly on the three.js editor? I would like to create my scene there and apply a wood texture on a plane to make it look like the floor of a cabin, but as it’s a plane I simply get my texture super stretched.
I know I could probably do it in code with something like
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(4, 4);
But i would like that effect directly in the scene editor so i can export my scene directly. Any advice ?
Only solution i have found so far is to set a script to do it, but it is quite ugly. Is it not a feature ? Could it ever be one ?
Anyway, here is the code i added in the script portion of my plane
let firstRun = true ;
function update( event ) {
if(firstRun) {
const texture = this.material.map;
// Set Repeat Property
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(4, 4); // Adjust the numbers to your desired repetition
texture.needsUpdate = true;
firstRun = false ;
}
}
I’d avoid using the json/js export format from the editor, and use gltf if possible. I think it also supports wrap mode on uvs. The js/json export formats are not ideal.