Import from Blender messes up materials

Hi,



I’m experienced in programming, but I’m a noob at JME and Blender (and 3d in general). But I managed to import a model from Blender to JME. Unfortunatly, the result is not really satisfactory.



Here is my model in Blender:

Imgur: The magic of the Internet



Here is the result in JME:

Imgur: The magic of the Internet



As you can see, it is messed up.



What did I use?



I have used these tools:

JME:

Product Version: jMonkeyEngine SDK 3.0beta
Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (jmonkeyplatform)


Blender:
2.26 r44136


What did I do?


1. made the model in Blender
2. exported from Blender with File->Export->Ogre3D
http://imgur.com/qYewH,C1nVy,EfqYe,nG6bP,paHNu#4
3. copied exported files to ..assetsScenes in project
4. renamed material to "goal2.material"
5. converted to j30
http://imgur.com/qYewH,C1nVy,EfqYe,nG6bP,paHNu#3
6. double-click on j30
http://imgur.com/qYewH,C1nVy,EfqYe,nG6bP,paHNu#1
7. in code: loaded goal:
[java] Spatial thegoal = assetManager.loadModel("Scenes/goal2.j3o");
this.goal = new Node("goal");
this.goal.setLocalTranslation(0, 0, 0);
this.goal.attachChild(thegoal);
...
gameData.getRootNode().attachChild(goal);[/java]
8. ran program
http://imgur.com/qYewH,C1nVy,EfqYe,nG6bP,paHNu#2


If anyone can help, that would be very much appreciated.

Thank you

simple question:



why not to use j3m? :roll:



this will give you support for advanced shader options also. And you will solve this problem :slight_smile:

@oxplay2 said:
simple question:

why not to use j3m? :roll:

this will give you support for advanced shader options also. And you will solve this problem :)


I dont quite understand. Is it not possible to load the whole model at once? Do I have to load the material seperatly? And how do I get j3m from blender? As I said, I'm new to this.

One texture cannot be found (red areas) and the object isn’t transparent (see the manual on using transparency), else everything seems fine. You should read our documentation, especially on proper models for gaming and the best practices section as using two textures for such a simple model is definitely not the way to go. Also you should manage your textures better (stick them in the assets folder before staring to edit the model) so they can be found, if they are lying around on some other HD or in a folder that has nothing to do with your project it cannot be loaded.



Also there seems to be a buried belief that a model should look exactly like you see it in the 3d editor. This will never be the case as a) 3d modelers are for offline rendering purposes and many of the material and texture options simply do not work in a live rendering context and b) the shaders that render the material later do it differently than your 3d editor render output.



So your models should be simple meshes that only use diffuse, normal and specular maps, no other material settings. And the textures should ideally be on a texture atlas (that is one big texture with all the parts, not multiple textures for each part of the model). Again, check our documentation, it contains all the info.

Thank you for answering.



But I did not use two textures. I only used one (for the net, which is a cube). The poles only use materials and I used different ones to see if that changes anything but they all end up red. I understand that it can not look exactly the same, but the materials do not seem to have ANY effect.

Yes, like I said. You could not expect any material setting to look remotely like your material in the 3d editor, hence you should not even expect that. Only if its clear what the editor does it can be translated (e.g. vertex colors etc.). Just map a small white part of your texture atlas to the now red material and it will look white.

to be more clear:



way 1


  • use only 1 texture(texture atlas)
  • create one mesh(not 2 meshes), add UV map to it.



    Tutorial:

    http://www.youtube.com/watch?v=obB9T3jXlak


  • export model to ogre mesh.
  • convert it to j3o(no need export blender material too)
  • create j3m material. j3m is a material file in assets that can be used by j3o files. You can use Unshaded.j3md for a start(j3md is a material definition for a material j3m file). apply your texture to this material(diffuse texture - this one standard color texture)
  • when you edit j3o file, then selecting geometry in SceneComposer you can choose material on right side(by standard there is select input)
  • ready to go :wink:





    way 2(dont sure if it work)


  • use 2 textures
  • create 2 meshes and export them separatly like geometries, but have them in one j3o file.
  • create 2 material files with each diffrent texture.
  • for each geometry in j3o file apply diffrent material.
  • ready to go



    if you have problems you can also look here:



    blender to jme3 though ogre XML - YouTube

Edit: posted at around same time as previous post



Thank you.



Do you mean this documentation:



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:best_practices



And for the creation of the texture atlas I have to look at Blender documentation, right?

yes, jme documentation is powerful, it have everything what you need. but remember to read jme3 doc, not jme2.



you need to learn how to make material files(j3m) and you need to learn how to use SceneComposer to apply this material to model :slight_smile:



edit: You can also do it “ingame”. there is many possibilities(jme give you ready solutions, or if you have time you can use diffrent solutions), but you should start from SceneComposer.

Yeah, our whole wiki basically :P. Its a gem, really. And yes, you can in most 3d editors “bake” textures to one atlas, even bake high poly models to normal maps to be used on low poly versions and more stuff like that. Just always remember you use a general editor for a specific purpose.

I was struggling getting good results going the blender->ogre->j3 route but then I switched to the direct blender import and I’ve never looked back. (Drop blend file in your assets folder, right click->convert to j3).



I’m applying the textures programatically though, not exporting them in the model, so I’m not sure how well that bit translates.