.obj model showing up white even with lighting

I’ve created a simple model in Blender 2.8. It is just a cylinder moulded into a sword.
I’ve also coloured various faces of the sword using the materials section in the Properties Editor, so I don’t believe I have any textures to load.

The model files are just a .obj file and a .mtl file.

When I use pview, it shows up white, until I press L, then all the colours appear.
So I’ve added an ambient light in my program, like so:

        # Set some ambient light, so the unlit areas don't become entirely black
        ambientLight = AmbientLight("ambient light")
        ambientLight.setColor(Vec4(1, 1, 1, 1))
        # Get a NodePath for the light node by telling the parent node (root in this case) to attach the light node, rather than telling the light node to attach itself to a parent node.
        self.ambientLightNodePath = self.render.attachNewNode(ambientLight)
        # Set the lights to affect the whole scene

But it still shows up white when I run the program. Am I using the wrong kind of lighting or is there something else I’m missing?

Also, when I exported the model from Blender, I had the whole model selected and I pressed ALT-C before exporting, as someone else suggested.

I believe you need one of a Point, Spot, or Directional light to get shading. An ambient light just bumps up brightness on pixels by a uniform amount, it doesn’t result in actual shading.

1 Like

Ah right, I’ve got it now, I tried all the other lights and they work pretty well. The blue shows up as grey, but I guess that’s because it’s an emission material with bloom enabled, so maybe it’s not supported by Panda3D. But I’m not fussed about that, this was just a test model to see that I can get simple materials to show up.

Thanks a lot!