Hi, I’ve exported my 3D model from blender (gltf), baked a texturemap, to get more realistic looking shading in Threejs, but it seems to go wrong when I apply the texturemap to the glb model.
Left is a screenshot from blender, right is a screenshot from the running website.
I had a previous website that I made last year, then I got it working perfectly, but now I can’t get it right, I dont know wich step i forgot.
Anyone that can help pointing me in the right direction to a solution?
It looks like the wrong uv map has either been baked or applied in three js, can you check to see if you only have one uv map in blender?
I followed this tutorial, that shows I needed to add a “bake” UV map to each object before baking the textures, but that does seem to behave strangely in threejs.
But when I don’t add these additional UVmaps, the view in Blender is distorted after baking
(left: before bake, right: after baking)
Wallpaper + floor is distorted. I’m sure there was a time this was easy, I just forgot the correct steps
what version of three.js are you on? older versions had some limitations with how many UV sets were supported, and how different textures on the same material needed to share UV offset/repeat/rotation.
1 Like
according to package.json “three”: “^0.141.0”
But this is the same version as my other threejs website with texturemaps, and there it works. I just can’t seem to find what I’m doing differently now vs then.
Got a step further:
- select each item in the scene and add second UV map (and highlight it)
- select all items → edit mode → Smart UV project to create a texturemap with all items in 1 image
- bake
- select each item again, 1 by 1 → remove second UV map
- Select all items → edit mode → Smart UV project again
- Select each item once again and link the texturemap to the color attribute in blender.
- export the glb & texturemap
Then, in Threejs on the website, it finally looks like it should.
By the love of God, I can’t remember that I had to do all these steps before, to get to this result. Is this texturemapping changed in Blender 4.0? The last time I was working in 3.5 I think
(result in ThreeJs website)
1 Like
In three.js versions prior to r150, there was a limitation that .aoMap and .lightMap use the 2nd UV set, and all other textures use the 1st UV set. Blender has no knowledge of that, so it could be something as simple as Blender using a 2nd or 3rd UV set where three.js needed it to use the 1st perhaps. I’m not sure if anything has changed in Blender though.
2 Likes
flipY was allready set to false
1 Like
K just checking… Glad you got it sorted!