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
self.render.setLight(self.ambientLightNodePath)
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.