Hello again! I’m sorry I’m so bad at this stuff, it’s all very overwhelming. This is going to be a mish-mash of thoughts because I don’t really know where to go from here.
I created a fence post model in crocotile3d and exported it as glTF (also have the option of obj and glb, just fyi). I’m having a heck of a time getting the ambient light to affect the mesh. I’ve searched the forums and only found 1 post that was similar to my issue, but it didn’t really help me. Someone mentioned that maybe because the coordinates were flipped, it broke the lighting. I’ve also read that ambient lighting doesn’t work on glTF (and I assume also glb).
Another person said to use PBR materials on the model and set the light falloff to glTF. This is over my head and I don’t know how to switch the material on an imported glTF file that has an embedded texture. So I didn’t bother even trying that.
Why is this so difficult? Shouldn’t I be able to just import a model and have the lighting system work on it?
Why does the model import as 2 separate meshes, one with the id “root” and one with the id “node0”? I noticed “node0” is parented to “root” and “node0” contains things like the normals information while the “root” does not.
So many questions and the deeper I dig the more confused and overwhelmed I get. Any advice would be appreciated.
@Vinc3r
Do you know if there is a way to access a meshes material from the mesh itself using typescript?
_materials is private and since I have no control over the material name, if I import multiple meshes, won’t using scene.getMeshByName() cause problems?
Edit: Nevermind… I guess I can access the material from the mesh but there is no unlit property when using typescript. Odd.
That’s probably because your material is seen as an instance of Material by typescript, not as PBRMaterial: mesh.material is a Material, not a PBRMaterial.
You’re right. I wasn’t even aware it imported as a PBR. I was able to access it by using material[“unlit”] = false;
Kinda hacky, but whatever. I appreciate everyone’s help!