I have a textured mesh (OBJ + MTL file combo) that I load like so:
Spatial spatial = assetManager.loadModel("path/to/some/model.obj");
I’d like to present this model in two formats: textured & untextured. By “untextured”, perhaps I mean unshaded, but what I’m looking for is a way to render the model as just a “mesh skeleton” (essentially just as vertices and connected edges). Is this possible to do?
You need to get the material for this. So I think you’ll need to cast it to a geometry which has a getMaterial() method, which may require some searching on the forum but it’s pretty well documented
Thanks @JESTERRRRRR, but isn’t
Spatial subclass? If so, why couldn’t I just do:
Geometry geo = (Geometry)spatial;
Or am I missing something? Thanks again!
I remember having done this once and finding it didn’t work but try it first by all means.
This is why. I think for me I just ended up doing spatial.getChild(0) and casting that to Geometry, not sure if yours will be the same case.
Never seen that before… what a spoilsport
Thanks @pspeed and @JESTERRRRRR but I guess I’m not seeing the forest through the trees here. I’m loading a single model (OBJ) via
Wouldn’t that mean the resulting spatial will always be a
Geometry?!? How could I load a model and have that be a
Node with children?
Quite often. For example, if your model has more than one texture then it is probably two geometries under a node. If it has more than one mesh then it is two geometries under a node.
The case where loading a model results in a single Geometry is the rarer case.