I’ve been experimenting with imported models of planets ( Saturn in particular ) for an oculus-based planetarium program I’m working on.
I’ve sort of got something working, but have hit issues because of limitations in the shaders compared with those on PC hardware, and I’d welcome suggestions on workarounds, or, possibly an update to the docs to clarify.
- When I import a gltf model, it uses PBR material. There appears to be no way to use a different material during the import, and switching all the bits of the model over to standardMaterial afterwards appears convoluted ( i.e. I can’t find a clean, future-proof way to do it, which doesn’t involve digging into the javascript objects and making assumptions about their structures ).
- If I use the PBR material with a point light and set the point light intensity to something suitably large, it’s fine if the distances are less than about 1000, but that’s no good for astronomy.
- If I change the PBR material I’ve imported to use pbr.usePhysicalLightFalloff = false
then I can get my objects out to about 100000 which I can live with, but to do that, I still need to iterate over all the underlying materials.
So:
1 - Can you import gltf using standard material?
2 - If not, is there a clean way to iterate over all the meshes imported by a specific model and only those to update the corresponding materials?
3. - Most of the documentation and forum hits you get if you complain that an imported gltf model is black tell you to use an environmentTexture. That certainly illuminates the PBR, but isn’t the solution if you need point light behaviour.It would perhaps help to emphasise that if you want to mix PBR with existing standard materials, you either need to set up very bright lights for the PBR and only illuminate the PBR meshes with that light, or you need to set usePhysicalLightFalloff=false if that behaviour is acceptable.