Panda3d lighting not working with a .ply mesh

I have a .ply mesh which looks like a crumped piece of paper when I open it in Paint3D.

But when I load it in Panda3d, I only see white, the colour of the directional light I have (it is the absolute colour of whatever lighting I have and featureless).

The Panda model, in comparison, renders correctly, so it’s a problem with the mesh. This is my code.

#load stuff
import direct.directbase.DirectStart
from panda3d.core import *
x = loader.loadModel('panda')
ply_file = "test.ply"
otha = loader.loadModel( convert_path_to_panda_path(ply_file))

#position things
otha.setPos(-330799.84375, -6257419.5, -59.53)
base.trackball.node().setPos(0, 560, 0)

#set the lighting
directionalLight = DirectionalLight('directionalLight')
directionalLight.setColor((1.0, 1.0, 1.0, 1))
directionalLightNP = render.attachNewNode(directionalLight)
directionalLightNP.setHpr(0, -60, 0)

I guess there’s something wrong with the mesh, but setting the object colour or using setTexGen(), or setTexture(), all do nothing. Any ideas?

I’m not familiar with the “ply” format–it may be that it’s not one of those supported by Panda, and that it’s only loading as far as it is due to some similarity to a file-format that Panda does support.

What happens if you convert your model to another format, like Panda’s native “egg” or “bam” formats, or glTF?

Thanks, I think I’m getting somewhere now.

As I understand PLY along with a bunch of other formats became loadable through " Assimp" a few years ago, but it looks like this is maybe this translation into the Panda3d model structure doesn’t work for all scenarios of each input format.

GLB and GLTF showed nothing, maybe because the texture is missing.

blend2bam finally worked, and gave this hint during translation: “Warning: mesh out-again has a primitive with no material, using an empty RenderState”

1 Like