How To Load a Material? [Not The Tutorial Code]

I know about the tutorial code, but it doesn’t show how to apply a .material file.
I want to load a mesh, assign a .material file, and then apply a texture.
Loading a mesh will do this automatically, but I have many different textures I want to apply, for face customization.
Any ideas?

The material format of jme3 is .j3m The files you have are ogre material files and of not much use for jme apart from referencing textures. Create a new .j3m material via the File menu (make sure you place it in the projects assets and not in its sources).

Thanks, and how can I tell the Material (object) to load this file?

Did you create the j3m already? :roll:

I’m working on that…figuring it out…however will there be a way to tell jMonkey, when I create a new material, to use that j3m file? (I managed to make a j3o file, but I can’t figure out j3m)

I can’t figure out how to convert it. It was the same file name and directory as the original mesh.
And why is my avatar…a pink blob…?

So, press “F1”, enter “Material” and see how it all comes together instead of pressing buttons to find out what they do.

So j3m files are stored materials. I need to know how to keep the UV map data my .material file has. According to the documentation, you need to write these files yourself?

I am almost 100% positive somebody posted the blender import tutorial already… Anyway UV coords are part of the mesh, not the material. The material just references the texture and other things that you have surely seen by now as you certainly opened your new j3m file already. Now all you have to do is to open your model and apply the j3m as material to the geometry. But I am sure you know that as well already as its written in the manual page I suggested reading, sorry.

Normen, thanks for the replies. I am unclear on what exactly the difference is between a MatDef and a Material. Can you maybe link me to something that will clarify that for me?

1 Like

Same here

lol ^^

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_material

1 Like

i have a question about this ,

does jme have the function like:

Material mat_stl = new Material(assetManager, byte[] bytessss);

or have the function like:

Spatial teapot = assetManager.loadModel(byet[] bytesss);

to load decrypt bytes from encrypted file to save some compony `s file like obj or jpg file ??

@ravenocean said: i have a question about this ,

does jme have the function like:

Material mat_stl = new Material(assetManager, byte[] bytessss);

or have the function like:

Spatial teapot = assetManager.loadModel(byet[] bytesss);

to load decrypt bytes from encrypted file to save some compony `s file like obj or jpg file ??

Not that it has anything to do with the original topic, but in this case you would register a custom loader for your encryption format, I think.

@pspeed said: Not that it has anything to do with the original topic, but in this case you would register a custom loader for your encryption format, I think.

:-o

yes

i mean decrypt operation is to be done by coder and load normal obj bytes or material bytes or some inputstream is supported by engine,

ps:the The Elder Scrolls 5 is supporting the player to add them model,

@ravenocean said: :-o

yes

i mean decrypt operation is to be done by coder and load normal obj bytes or material bytes or some inputstream is supported by engine,

ps:the The Elder Scrolls 5 is supporting the player to add them model,


First get acquainted with how jme3 handles loading models, then ask questions about input streams for special loaders, how about it? Else you are prone to misunderstand, completely not understand or right out annoy/get annoyed by people.

We have loaded a material, by making a material and setting the texture, however it doesn’t match the UV map we had set when exporting from blender. Yes, we tried flipping it.

Well did you set the UV map as outlined in the tutorial? Or just after some tutorial?

Which tutorial is this? I see only 1 posted in this thread. And I set it in Blender.