I created three UVs for the model, but when I exported the model to Babylon, only two UVs were present. Is there a specific step that needs to be set during the export process?
Is there a good way to solve this? I need more than three UVs to create the material.
It is useful to provide the import code and model in a playground as well as indicate the program and version number of the tool you’re exporting from.
As @HiGreg said, it looks like an issue with your creation apps so knowing which one it is might help and you should probably ask on their forum too
var createScene = function () {
// This creates a basic Babylon Scene object (non-mesh)
var scene = new BABYLON.Scene(engine);
// This creates and positions a free camera (non-mesh)
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -50), scene);
// This targets the camera to scene origin
// This attaches the camera to the canvas
camera.attachControl(canvas, true);
// This creates a light, aiming 0,1,0 - to the sky (non-mesh)
var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
// Default intensity is 1. Let's dim the light a small amount
light.intensity = 0.7;
BABYLON.SceneLoader.ImportMesh(“”,“https://meta.veryengine.cn/5TEST/","ground.babylon”,scene,function(e){
camera.setTarget(e[0].position);
});
return scene;
};
The export tool I used is version v20240125.3. Even when I tried using the latest v20240312.5 export tool, I got the same result.
I feel that this is a bug with the export tool. There were no errors during the export process, but even with multiple versions of the export tool, the third UV set of my model still failed to export successfully.
Could you export your model to GLB and check if there are the same issues?
What software are you using to export ?
I’m using 3D Max for exporting. I’ve tried both the 2021 and 2023 versions of the software, but neither was able to successfully export the third UV set.
Let s validate with @PatrickRyan if it is supported ?
According to GLTF Specifications -
Client implementations SHOULD support at least two texture coordinate sets, one vertex color, and one joints/weights set.
Babylon loader supports UV3 - GLTF2Export.GLBAsync can't export uv3 uv4 - #3 by bghgary , not sure about the exporter current state.
Seems that the problem relates to the export from 3D Max. Could you share your original file to have a look?
@lang_l, even if you can’t share your original model due to licensing/NDA reasons, can you make a small repro using three UV sets the same way you made this one so we can have something to diagnose?
In the meantime, I would also suggest you look at your third UV set and make sure that every vertex has a UV coordinate in it. It doesn’t matter if you want UV3 to be primarily one part of the mesh, you can pack the rest of the vertices on top of each other and scale them down to fit in a corner. But every vertex should have a coordinate in every UV set. Our exporters do not assign random UV coordinates to any vertex wihout a coordinate in a particular UV set. Exporters like Blender’s will assign a random UV coordinate like (0,1) - anything along the edge of 0-1 space. They are assuming that is the safest place for vertices that did not have a coordinate assigned, but we were not comfortable making that assumption.
Basically, what happens - and you should be able to see it in the export logs - is that the UV set is deemed invalid for not having UV coordinates for every vertex in the mesh. Ensuring every vertex has a coordinate in every UV set might fix the issue.