I’m using Vite with Typescript as my build-system.
I exported a mesh in Blender to OBJ-format, with colors included.
I managed to get OBJ-file loading working by including this in the typescript file, where I import the mesh :
import * as BABYLON from '@babylonjs/core/Legacy/legacy';
import '@babylonjs/loaders/OBJ/objFileLoader';
However, to get colors of the imported obj file working (I don’t use a material or texture), the documentation says I should add the following:
BABYLON.OBJFileLoader.IMPORT_VERTEX_COLORS = true;
But this doesn’t work with my setup. BABYLON.OBJFileLoader
is undefined
.
Any idea how to enable vertex colors in this case?
UPDATE:
It seems the Blender exporter to OBJ is not including colors after all, so it could never work anyway. When I display the file in 3D Viewer it’s grayscale. Has anybody ever managed to use/make an OBJ file with colors?