I can't understand what is wrong with my obj model

I use Softimage XSI to create my model (OBJ).
There is 3 materials on it. At best I see one correctly uv mapped but the main
part of the screw is entirely black in babylon. (other model appear correctly)

here is the model (.obj, .mtl and png) :
https://lemayacademie.net/DevZone/postMetal.zip

Here’s the code used :
BABYLON.OBJFileLoader.OPTIMIZE_WITH_UV = true;
BABYLON.SceneLoader.Append(objects/, postMetal.obj, scene, function (scene) {});

Here is what it look like in a generic 3D viewer on the left, and what it look like in Babylon on the Right.

Does someone have a clue?

Steve

Hi polygame,

Welcome to Babylon! What kind of lighting are you using in your Babylon scene? It looks like the light in the Babylon scene is directional, not IBL, which might cause metallic parts to look very dark if light isn’t hitting them directly. When I drag-and-drop your model (and texture and material) into the Sandbox, which has IBL enabled by default, it looks like this:

image

2 Likes

Hey thx for replying! the light I use is this one (Don’t know about IBL Light)

	// light1
	var light = new BABYLON.PointLight("dir01", new BABYLON.Vector3(-1, -2, -1), scene);
	light.position = new BABYLON.Vector3(0, 0, 100);
	light.intensity = 1;

	var lightSphere = BABYLON.Mesh.CreateSphere("sphere", 10, 2, scene);
	lightSphere.position = light.position;
	lightSphere.material = new BABYLON.StandardMaterial("light", scene);
	lightSphere.material.emissiveColor = new BABYLON.Color3(1, 1, 0);

Yep, that light can have this artifact. The reason this is happening is because point lights (and many other idealized rendering lights) send light in only one direction, in this case from a single point. In reality, though, light is almost always coming from all directions because it’s always bouncing off things, so things that are lit by light coming from only one direction look wrong. An approach that often looks nicer is image-based lighting, or IBL, which computes light coming from may directions by using images of some environment meant to represent the surrounding illumination. Try out the following instead of the lights you’re using now

    scene.createDefaultEnvironment({ createGround: false, createSkybox: false });
    
    var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
    const sphereMat = new BABYLON.PBRMaterial("sphereMat", scene);
    sphere.material = sphereMat;

as seen in this Playground. If you import your model into a scene lit using createDefaultEnvironment, I suspect it’ll look a lot more like what you’re expecting. Hope this helps, and best of luck!

2 Likes