0
votes

I'm trying out Babylon.js to see if it has better capabilities and more versatility than Three.js. I wanted to test out the quality of 3D models in both by importing a simple model, but I cannot seem to get the MTL data to display the colors on the penguin that I made in Blender. How do I get it to show, or what do I need to modify about the model or file format to get it to work?

Also, I have already tried the STL format which does not display colors either.

var canvas = document.getElementById("renderCanvas");
        var engine = new BABYLON.Engine(canvas, true); 

        var createScene = function () {

            var scene = new BABYLON.Scene(engine);

            var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 2, 2, new BABYLON.Vector3(0,0,5), scene);
            camera.attachControl(canvas, true);

            var light1 = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
            var light2 = new BABYLON.PointLight("light2", new BABYLON.Vector3(0, 1, -1), scene);

            BABYLON.SceneLoader.Append("./", "penguinmodel.obj", scene, function (scene) {}); 

            return scene;

        };

Full code and files at: https://repl.it/@SwedishFish/Babylon-Testing

1

1 Answers

0
votes

Hello you should export your model using gltf exporter. This is by far a more richer format and very well supported by Babylon.js