Black obj meshes with gltf loaded scene

Hi,
I have a problem in a gltf scene that uses pbr materials.

Some additional obj meshes are loaded
If I don’t define an hemispheric light, obj meshes are rendered as black.
The problem adding an hemispheric has impact on the gltf scene highlighting.

Is there a way either in modifying obj materials or other method to be able to render these obj files without adding an hemispheric light ?
Regards

Hi @Stephane_Ancelot do you might making a playground with your example and I can play around with some things? :slight_smile:

By chance i saw this earlier today.

1 Like

I uncommented the part that assigns the loaded node material and it seems to work (once it’s done loading). :slight_smile:

1 Like

The light has an array of excluded meshes that you can push meshes onto and they won’t be affected by it. For example here the box mesh is affected by the HemisphericLight but the imported model isn’t (you can see on line 44 where I excluded it). Another solution could be to use a separate scene for the meshes that need the light…

But also I might be misunderstanding and a playground showing the issue could help us understand and help fix it better. :slight_smile:

This playground is very similar to my application (altough we don’t really see the light effect on this glb model)
GLB scene and obj materials | Babylon.js Playground (babylonjs.com)

Hey,
just add a material with emissiveColor for obj meshes

1 Like

here is a playground with my model
GLB scene and obj materials | Babylon.js Playground (babylonjs.com)

1 Like

The objects will appear black because they think there is no light, so it’s like being put into a pitch-black room. If you don’t want to add any lights within Babylon you can use an environment texture: Using An HDR Environment For PBR | Babylon.js Documentation or you could bake out the lighting you currently have in your scene (in a 3d editor like Blender). The latter will be more time-intensive and tedious depending on your lighting environment, but if done right it’ll look great and be performant.

You could also use the albedo texture (color texture) for the emissive texture as well and it’ll essentially be self-illuminated. This is easier than baking but may also affect the overall look because things like roughness or metallic values may be overpowered.

2 Likes

Here’s a version of your playground where the wheel model isn’t affected by your hemispheric light but the other, grey model is for example. :slight_smile:

1 Like

Hello @Stephane_Ancelot just checking in, has your question been answered? :slight_smile: