.material to .j3m

Hey guys, I’ve been trying to import a Blender model (A tree) into jme, butI have two issues:

  1. There are two materials, trunk and leaves. Am I supposed to only have 1? If so, how do I turn 2 materials into 1?

  2. The materials are in .material format, and people say to use .j3m. However, I have no clue how to turn .material into .j3m.

Thanks for any assistance :slight_smile:

  1. In jme, each geometry has one material. You can convert your .blend file to jme3 file which should automatically create multiple geometries if your model has two or more materials.

  2. .material format? You can convert .blend to jme3. Eg. in sdk just right click and convert.

I put the .blend file in my Models and converted it to j3o. No option to convert it to jme3. This is my folder:

When I upload that .j3o file I get no model in the SceneComposer.

Thanks for the reply!

EDIT: Silly me forgot to turn light on in the viewer. Sorry I’ve never ever done this before. Still no materials, it now just shows a white, untextured tree.

You need to set the UV in blender (so jme3 can import the texture coords) and have the textures packed in the .blend (no external ones).

No, not packaged in the blend, that will create packaged textures which are bad because they can’t be shared. Just make sure the texture is in the assets folder and referenced with a relative path in the blend file.

I remember having problems with this paths when starting with jme and the usage blender-jme3 can be frustrating sometimes so to check that the things are working and the only remaining issue is the texture paths I strongly suggest to first try with “packaged” textures. Once it works, the optimization can come :D.

Another curious thing about the sdk is that if you load the j3o with the packaged textures and then go (through the scene explorer) to the geometry properties and you click on “create j3m file” (on submiting), it unpacks the textures and generate a material file.

Well yeah, I had to add that unpacking feature because j3m files can’t reference packed textures either. I strongly recommend getting your asset management in order and use textures from the assets folder directly in Blender. If it doesn’t work you’re still doing something wrong.

I mapped it to UV (has a bug, tree trunk won’t get coloured while leaves do but I posted on the blender forums for that). Now, what do I do to get it to have a material in my game? It’s just a .blend file. I tried using that but it has no colour, still gray. I also tried exporting as OGRE, I got a .material file. Not a .j3md. There is no option to convert it to j3m either. I’m going nuts here :frowning:

Convert the model to j3o.

Load it in the scene editor.

Select the geometries.

Go to the panel in the right and next to material select “generate material” or “create material” or something… then you will get a j3m for the material in one of the assets sub-folders. (I don’t remember exactly which one.)

Thank you. But what am I supposed to do with this? It’s like having unshaded.j3md. It’s not my material, I want it to use the material I created in blender. Thank you.

That’s JME’s version of what you created in blender.

Obviously, JME cannot use blender files directly.

Okay. Then how would I give it my blender texture? I’ve tried setting its “DiffuseMap” property to my UV Map.png file but that just makes it look silly. How do I tell it “This is the trunk! This is the top!”?

“silly” is not nearly as descriptive as a picture. Maybe it’s upside down?

The trunk and the top will likely have two different materials… which in the scene editor you can see because it will have multiple geometries in the scene explorer tree.

You may need to poke around a little and try to understand what is going on or you will struggle every step of the way forever.

Okay, here are some pictures of what I’m working with. (I also flipped it to no avail).

UV MAP:

I downloaded the .blend you uploaded on blender forums. It worked for me selecting “Blender render” and add a texture to the material.

You added a texture to the material in jme or in blender itself?

Blender itself.

See now I’m very confused… There are so many different opinions here. I read everywhere that I was supposed to UV map it otherwise it wouldn’t work, but now you say I can just skip the uv mapping and directly texture it? And if I did do this, how would I apply that texture in Blender into the object itself in jme? I wish there was a tutorial on this… :frowning: I’m incredibly lost and confused right now…

Ok. Lets see. You have to create the UV wrap in blender (so the texcoords are set). After that you have to set the a texture to the material:

You don’t need to have a uv-map file. Just generate it in blender. JME3 will fetch the textureCoords and set it to the geometry.

I’ve noticed that no matter what texture I apply to the DiffuseMap it doesn’t actually show the full image, just 1 single color. Example is with the monkey texture from jme. It’s just a white tree :o