When rendering imported meshes and using IBL the imported meshes are lit. But the dynamicly generated meshes via Babylon are all black and dark.
Imported Meshes are lit, while dynamically generated meshes are dark… The only light source is IBL
Any idea why this is happening or how i can light the rest of the scene in the same way?
I believe they are imported as PBR and therefor get the light from the environment.
Edit: I did some more research and found this post. I take it that IBL only effects PBR materials, and therefore my dynamically generated walls and floor (probably standard material) are not affected / lit by the IBL.
Yes. That’s correct.
You need to switch to either all PBR Materials so your IBL lighting works for all of your meshes or you can alternatively add like hemispheric light in the scene to light up the models with StandardMaterial, depending on what you need. If you have some kind of textured object that you just want to be seen in the scene (without fancy reflections and whatnot), hemispheric light could be enough.
For the sake of lighting, the addition of a hemispheric light would actually be enough, but sadly, I also want to add shadows to the scene. Here I get more problems. I added every single mesh in the scene as a shadow caster and shadow receiver, but I still don’t see any shadows. Might this also be caused by the difference in materials?
Here, I disabled IBL and only lit the scene with one directional light. Now the imported objects and the floor are properly lit, but the walls are not (the direction is angled so objects are also lit on their left side, not only on top). Also, there are no shadows in the scene whatsoever.
Can you make a PG out of it? Did you check if there’s an error in the console? Did you try change settings on your dir light or shadow generator? In essence, meshes cast and receive shadows, not materials. However, PBR material can take back from the shadow (intensity) since they are also affected by the env and a number of parameters. For the sake of consistency, you should work all either from PBR materials OR from a reflection texture that’s based on your env for standardMaterials. As for having no shadows at all, as I said, this is something different. Either an error or some wrongly set parameters. Clearly, the PG would help…
Edit: Forgot to mention that at least for PBR Materials, having a white emissive at level 1 or above will cast white emissive color towards the shadow, basically nulling it. To get darker shadows on PBR materials, the emissive should be either black or darkish. Next, there are a number of parameters you can set to make it closer to your likin. But a white emissive will clearly work against the shadow.