Hello,
I need to upgrade a Programm written in jme2 to jme3 for my bachelor thesis,
for this i need to load an .obj file which has also a .mtl file
In jme2 this is working without any problems, but in jme3 it always says:
Unknown statement in MTL! Tf
Unknown statement in MTL! sharpness
Unknown statement in MTL! Tf
Unknown statement in MTL! sharpness
I used the following code:
Spatial halle = assetManager.loadModel(“Models/338k.obj”);
rootNode.attachChild(halle);
What can I do?
Thanks for your help.
Remove the unknown statements from the mtl for a start?
But then the object does not look like it should
Well Tf is a color filter as far as I see it, I guess the default importer does not take core of that, because the material tahts used per defaultfor obj does not support it. I guess you have to extend that part of the code to your needs, and probably write a own pixelshader since jme3 does not use the fixed pipeline anymore
For the sharpness not even google helps me to find out what it does at all?
Uhm, bigdom1001, do you have any other problems but these warnings? I mean, maybe the jME2 importer just ignores them silently, do the models look like they should?
Does the model display correctly?
The sharpness value is for a reflection map, which is not used by jME3. Tf is for transmission filter e.g. refraction color, it is not used either.
You were right it seems to be an other Problem
I load the object using:
Spatial Halle = assetManager.loadModel(“Models/338k.obj”);
and the Problem is that jme3 is culling the back face.
I can prevent this using:
Material mat = new Material(assetManager, “Common/MatDefs/Misc/ShowNormals.j3md”);
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
Halle.setMaterial(mat);
but then it seems overwrite the material from .mat file
is threre a way to prevent back face culling in general?
Thanks for your help.
just get the material and apply the facecullmode to that instead of creating a new one…
I can´t find a getter method.
How is it called?
Thanks
duh… getMaterial()…
[snippet id=“13”]
Thanks.
That solved my Problem:
Geometry model=(Geometry)assetManager.loadModel(“Models/338k.obj”);
Material mat=model.getMaterial();
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
model.setMaterial(mat);
Sorry, I am new and didn´t knew that Geometry has getMaterial() and Spatial not.
Emmm,I copied your code to solve my problem but I got
class com.jme3.scene.Node cannot be cast to class com.jme3.scene.Geometry (com.jme3.scene.Node and com.jme3.scene.Geometry are in unnamed module of loader 'app')
I suspect that 13 years later even if these people are still here they won’t remember their own code. Id suggest starting a new thread explaining your issue (including what you’re doing)
[That said, your problem is probably that your saved model is a node at the top level not a Geometry, it probably doesnt need to be cast at all and can just be left as s spatial]