Gltf and android/oculus

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.

  1. 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 ).
  2. 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.
  3. 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.

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.

1- You can not as by definition GLTF files are meant to be PBR based.

2- You can either iterate in the callback or in the promise result.

3- Point light behaviour only can unfortunately not lit metalic glossy meshes as you would mainly see only a dot:
It would only work for none metallic surfaces:

About the mix std and pbr, you can simply change the light falloff type to be like standard on pbr:

Or even enforce a falloff type for all pbr mat on the light:

Those are meant to help with compatibility. That said, if you do not have an environment, You would not be able to render metallic materials which makes sense as they would only reflect black.

1 Like

Thanks for all that information - it’s very useful. I think I have enough now to work out how to solve my problem!