I have a silly question that I can’t figure out after lots of tests.
I’m loading an OBJ model in babylonjs and threejs. I have a very complex environment with different lights.
For some reason, what ever lights I’m configuring I can’t achieve the same look as the one that I have in threejs. I’m probably not familiar with the basics…
On threejs I’m able to see every part of the model reflected in the light.
Quick question.
I’m using an asset container and I’m trying to achieve the same results you have with the GLB file.
I have created a playground with the asset container:
I’m trying to figure out how to update the mesh.convertToFlatShadedMesh and where. Whatever I do, I either get exceptions or it just doesn’t work. What should I use from the container object to modify the shaded mesh?
The model itself is not correct. Could you try to make the same setup with one of the reference models (there are a lot of them here - The Meshes Library | Babylon.js Documentation
Well, something is wrong with my environment and I can’t figure out what.
The technique above works great for OBJ files.
I have used the same model that you used in your playground and it still looks wrong in my environment.
In addition, I have tested the one of the models you mentioned from the babylonjs repo:
BABYLON.SceneLoader.LoadAssetContainer(“https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/Playground/scenes/”, “ufo.glb”, scene, function (container) {
container.addAllToScene()
container.meshes[1].convertToFlatShadedMesh();
})
They both work great in the playground but are messed up in my environment.
Even the following basic code looks wrong.
container.addAllToScene();
container.meshes[1].convertToFlatShadedMesh();
I will use the OBJ files for now. If you have any idea I would love to hear about it. I feel bad for bugging you about it
BTW - I’m using react-babylonjs. I’m not sure if it matters… I have stripped all scene and engine configuration but it still breaks…
Just wanted to update you that your solution worked as you described.
My problem was that I was not aware that I used a react-babylon project with Babylon v 4.2. Migrating to v5 solved the problem.