OMG. I’m sorry I forgot to include it.
I’m not sure if you remember what happend to loading .babylon model early in the discussion.
Yes, .babylon model can be loaded, but the texture mapping is quite off. I have no idea
and .gltf cannot be loaded…
const fs = require('fs');
const BABYLON = require('babylonjs');
const { createCanvas } = require('../lib');
const XMLHttpRequest = require("xhr2");
global.XMLHttpRequest = XMLHttpRequest;
global.HTMLElement = function () {};
global.window = {
setTimeout,
addEventListener() {},
};
global.navigator = {};
global.document = {
createElement() {
return createCanvas(300, 150);
},
addEventListener() {},
};
const canvas = createCanvas(512, 512);
const engine = new BABYLON.Engine(canvas, true, {preserveDrawingBuffer: true, stencil: true});
const scene = new BABYLON.Scene(engine);
const createScene = async function () {
scene.clearColor = new BABYLON.Color4(0.5, 0.4, 0.4, 1);
const camera = new BABYLON.FreeCamera('cam1', new BABYLON.Vector3(-6.8, 9.8, -9.3), scene)
camera.setTarget(new BABYLON.Vector3(-1.8, 0, 0))
const rootURL = 'https://playground.babylonjs.com/scenes/'
const fileName = 'candle.babylon'
const { meshes } = await BABYLON.SceneLoader.ImportMeshAsync('', rootURL, fileName, scene, null, '.babylon')
const light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(0, 1, 0), scene);
scene.render();
};
createScene();
setTimeout(() => {
fs.writeFileSync('./snapshot/snap-babylon.png', canvas.toBuffer());
}, 3000)
with this, I can load .babylon models like these
but only the ones without textures.
Earlier in this discussion, I asked and mentioned the problem where .babylon model can be loaded, but textures were kinda off.
Now with babylonjs 5.22.1 version
, I cannot load with above code at all