Possible to load texture-less meshes into jME3?

I’ve created a PLY file from a system external to my jME3 game, and then used some glue code to read that PLY file into a Mesh instance. I can also load that PLY file into other visualization tools, and so I know its a valid mesh/model.

I was hoping to load the Mesh instance as a skeleton (no textures/materials, just vertices/edges/triangles) into a jME3 scene and used this code:

// Groovy, but should be easily readable to any Java dev
@Slf4j
class Visualizer extends SimpleApplication {
    Mesh mesh
    
    void visualizeMesh(Mesh mesh) {
        this.mesh = mesh
        start()
    }
    
    @Override
    void simpleInitApp() {
        log.info('Starting to visualize...')
        Geometry geometry = new Geometry('mesh', mesh)
        geometry.setLocalTranslation(0.0f, -5.0f, -2.0f)
        rootNode.attachChild(geometry)

        DirectionalLight sun = new DirectionalLight()
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f))

        rootNode.addLight(sun)        
        log.info('Visualized!')
    }
}

When I run it, I get the following exception:

Uncaught exception thrown in Thread[jME3 Main,5,main]
IllegalStateException: No material is set for Geometry: mesh

I guess it makes sense: I’m not actually applying a mesh! But it does have me curious, is there any way I can load just the mesh into a jME3 game or even some aspect of the SDK (perhaps a GUI tool or as part of the NetBeans-based IDE) and view the mesh as a textureless “skeleton”?

Can’t you just create and apply an unshaded material?

Material cube1Mat = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md")

Else what’s it gonna look like? What colour? AFAIK since jme is shader based it needs one to be drawn and that is set via the material.

If you load it then export it as a j3o you could view it in the scene composer in the SDK, but even then the scene composer will just apply a material for you.

Thanks @JESTERRRRRR thats a great idea and makes perfect sense, I’ll try it out!

You got to specify some material. If you’d like to show the mesh in wireframe, you can use

cube1Mat.getAdditionalRenderState().setWireframe(true); 

I think there is some “missing texture” placeholder in the SDK