I have read that ThreeJS now supports multiple UVs in GLTF files without writing custom ShaderMaterial. Is it possible, for example, to blend two color textures with two different UV sets?
I basically want to use a solid base texture and apply another texture with transparency to it. Both textures using their own uv mapping.
If it is possible, how should the shader configuration in Blender be set up to export the information correctly?
three.js supports assigning which UV channel each material texture (e.g. material.map) uses, but the textures themselves are still the same, and blending two textures into a single role still requires either a custom shader, or the node material system. Similarly, Blender can only have one texture connected to each socket on the Principled BSDF node for export, custom mix nodes as input will not export.
Thanks for the quick response - okay, that’s what I suspected as well. Are there any considerations I need to take into account to use the second UV set in the MeshStandardMaterial? My approach would be to add the additional texture and its associated texture access using “onBeforeCompile” and then blend it accordingly with the existing color value. Are there any reservations regarding the UV attributes beside the first uv?
MeshStandardMaterial supports a fixed set of textures. onBeforeCompile will let you modify the shader, but I’m not sure it provides a way to add new uniforms like textures. My guess is that you’ll need either a custom shader, or THREE.NodeMaterial, to do what you describe. But there could be other approaches.
You can add new uniforms. onbeforecompile gets a “shader” object which has all the uniforms and you can add to it, and patch the fs/vs to access them. It’s kinda great :D.