Jump to content

Textures not loaded


Shawn Dao
 Share

Recommended Posts

I'm a beginner with babylonjs.

I'm trying to make a demo to see how it's work. Everything work fine with  "Bane, Batman, Penguin" sample

2016-08-02_10-26-59.png

But when i try to load the model downloaded from sketchfab.com it just not working properly. Here what i've got.

2016-08-02_10-28-43.png

What's happening? What am i missing?

Here the entire code
 

// The first step is to get the reference of the canvas element from our HTML document:
var canvas = document.getElementById('renderCanvas');

// Then, load the Babylon 3D engine:
var engine = new BABYLON.Engine(canvas, true);

// After that, we create our scene. In order to keep your program compatible with the Babylon.js Playground, we recommend that you insert a "createScene" function at this point. Beside generating a Babylon Scene Object, createScene() is where you will add your basic scene requirements: a camera, a light, and two basic meshes (a sphere and a ground plane).
var createScene = function() {

    // This creates a basic Babylon Scene object (non-mesh)
    var scene = new BABYLON.Scene(engine);

    // Light
    new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);

    // Uncaught Error: No camera defined
    var cam = new BABYLON.ArcRotateCamera("ArcRotateCamera", 0, 0, 5, new BABYLON.Vector3(0, 3, 0), scene);

    // Panning: Ctrl + Left click => Right click
    // AttachControl Params: canvas, noPreventDefault, useCtrlForPanning
    cam.attachControl(canvas, true, false);

    var loader = new BABYLON.AssetsManager(scene);
    var obj = loader.addMeshTask("azir", "", "sample/azir/", "b_azir.obj");

    loader.onFinish = function() {
        engine.runRenderLoop(function() {
            scene.render();
        });
    };

    loader.load();

    return scene;
};

// Now that our createScene() function is ready, we need to call it:
var scene = createScene();

// The next three javascript lines are very important, as they register a render loop to repeatedly render the scene on the canvas:
engine.runRenderLoop(function() {
    scene.render();
});

// Lastly, you should implement a little canvas/window resize event handler, like this:
window.addEventListener('resize', function() {
    engine.resize();
});

 

Expectation: https://sketchfab.com/models/a3aa2827a6764f90aede27b9c0d5a630

azir.zip

Link to comment
Share on other sites

A few things to check:

1) is the .mtl file included in the object

2) are the textures loading correctly

3) is the light strong enough? (dunno, the entire scene looks a bit dark, also with the other models).

4) have you loaded the object in a different application (like meshlab for example)?

Link to comment
Share on other sites

I don't know exactly
load texture form Obj file err i really don't know, i just see that some floating point numbers are changed.

in How to apply show diffuse texture with PBR? the material is not overloading to a scene.

here http://www.html5gamedevs.com/topic/24210-textures-not-loaded/
the mirror material of the obj has refuses babylonjs from load.

i think something with babylonjs the reflectionTexture texture. 

 

Link to comment
Share on other sites

Sorry, I can't follow :)

You pasted before a demo of the loader, where the object is perfectly shown. Did you modify the object in any way?

Obj doesn't support PBR, it only supports the standard material. if you want to use PBR you will have to create it by yourself and attach it to the right mesh.

Link to comment
Share on other sites

11 hours ago, RaananW said:

A few things to check:

1) is the .mtl file included in the object

2) are the textures loading correctly

3) is the light strong enough? (dunno, the entire scene looks a bit dark, also with the other models).

4) have you loaded the object in a different application (like meshlab for example)?

1. I saw this line mtllib b_azir.mtl in the object

2. How can i check it?

3. I dont think it's related to the light because the texture quite clearly

4. Not yet. But I'm going to use babylonjs for my project so need to workaround to fix it. and i think Nabroski had it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...