Importing from Blender changes my model

I imported a model from blender by saving the model directly to the models folder of my JMonkey project. When I preview the file in JMonkey IDE, it already looks wrong. So when I try to convert it to a J3O for use in my game, it converts improperly.

Screenshot:

You can see that the “stinger” on the bottom of the bug is normal in blender (conical, curved, and pointy). However, in JMonkey IDE it appears as a giant shape stretching across the bottom of my object, which never comes to a point.

Why is this happening? How can I fix it? And lastly, if this method is not recommended, what is the recommended most supported way to import models from blender to JMonkeyEngine that supports bones, textures, and animations?

I recommend exporting to the ogre xml format. I say that only because I have never had any problems at all, I know others use different methods just as successfully.

As for the Bee (? :smiley: ), is the model all 1 object? Could be that the scale is not applied for that bottom part (set to 1,1,1). It would help if the screenshot in jmonkey had some non ambient lighting to see what we’re looking at.

Long shot, but I’ve done this before by accidentally exporting hidden objects in blender, so worst case you can upload the blend and I’ll look. Should be easy enough to solve without though.

@JESTERRRRRR I’m going to try ogre xml. I will let you know how it goes.

To be honest, this is my first attempt at making a 3d game so I am sure I am doing a lot of things wrong… I’m not familiar at all with Blender or JMonkeyEngine but I do feel like it shouldn’t be too hard to import a model I have already created.

Thanks!

Yeah, it shouldn’t be, and dw it won’t be once you get the hang of it. You can select the object, press control+a, then click scale to apply the scale. This means the objects scale will be set to 1,1,1 without changing the mesh. Whatever the problem is it will be something simple.

@JESTERRRRRR Can you give more guidance on how to do this (export to ogre xml)?

Most things seem to lead here: Google Code Archive - Long-term storage for Google Code Project Hosting. which says the newest version is maintained here https://bitbucket.org/MindCalamity/blender2ogre which is a dead link.

I have found around 200 links in various forums / google searches that all lead me down a trail that goes to the same dead link.

I’m not sure where to find a tool that lets me do this, and searching for one online is quickly becoming a nontrivial exercise.

https://justpaste.it/yg3m

Paste that into a txt and save as

io_export_ogreDotScene.py

Then whack it in

X:\Program Files\Blender Foundation\Blender\X.XX\scripts\addons

I’ve been using this for ages. It would be easier at present to just export as an .obj, but if you ever want animations you’ll be saving yourself some time in the long run.

1 Like

@JESTERRRRRR Ok cool so it did export. I also had to change the scale like you mentioned. However, there are several issues.

First, I had to join all the different objects that made up my model together into one model. One of them refused to join with the rest, saying “no mesh data to join”. Also, I don’t see how I am going to be able to apply different textures to the body and the stinger when all of them are joined into one huge object.

Next, is there a way to make the rotation 0 without actually changing the mesh (similar to what we did with the scale) because the current rotation is 30 degrees after merging all those objects, and the import makes it look like it is tilted by 30 degrees.

Sorry if I’m bombarding you with questions, I’m new at this. Thanks so much for your help so far, even this has gotten me so much further than I was. I do feel like I am learning as I go.

@JESTERRRRRR I was able to solve the rotation issue on my own, still working on the one object that refused to join with the others.

@JESTERRRRRR Actually I solved the no mesh data issue too - just had to convert my extruded curve to a mesh. However, I am still curious about the fact that I had to join all the objects into one. Won’t this A. make it harder for me to do animations because I no longer can move distinct objects around and B. make it harder for me to do textures because I can no longer apply textures to distinct objects?

Anyway thanks for all your help getting this working! Really appreciate it.

If it wasn’t a mesh maybe that was causing the original problem.

I’ll answer as best I can but I’m not an expert.

Sometimes I want to have separate objects so I can use code to manipulate them, like setLocalRotation and moving them around and so on. In this case I usually export them all individually into .mesh.xml files. I just find this tidier, I can give the files really specific names and so on. Then I have to load all of them individually in code.

I wouldn’t rule out the ability to export separate parts as one whole, pretty sure it can be done multiple ways. They can have names in Blender and you can actually get the individual parts in code by using their names with some exported file types.

Something like Spatial.getChild(“something”); - again not sure. Might be worth asking others.

I’m not sure which file types support skeletal animation though, and since ogre does and for me has never given me problems I’ve begun using it for everything.

As for texturing. In my recent use case I have a character that I want to split into 2 parts - the head, and the body. I want them to share the same texture though. For this, I join them in blender and create the UV map, and complete the rigging to skeleton part. When it is complete I separate the head and body into 2 separate objects and then export individually. In JME I just create 1 material and apply to both, and also hook them both up to the same skeleton/animation controls.

To have separate textures as you want, if it were me then yes I would export individual objects, haven’t had any problems with this.

Performance wise it’s best to try and keep as many things on 1 texture though when possible.

In this picture from one of my JME projects, the floor is 1 object, the outside walls are 1 object, and the star logo is also a separate object. All exported individually so I could apply separate textures/materials. Not saying its necessarily the best way, but it is 1 way. Another separate part off screen rotates and bobs up and down, again export individually despite the entire arena being made in 1 blend file, as one single object (originally before I split it up).

Something to keep in mind… Blender supports a lot of stuff that is unsuitable for a game object. To be honest, probably 90% of the stuff you can do in Blender is unsuitable for game objects.

This means that no matter what format you pick, you will always end up ‘dumbing down’ the object before exporting… such as converting stacks of modifiers into meshes (*), applying transforms, and so on.

(*) - don’t know if they are called “Modifiers” or not… that may be my old 3ds Max experience slipping in… but hopefully you know what I mean. The game engine can basically only deal with meshes. Basically, if what you are exporting isn’t a bunch triangles then it will cause issues.

Thanks everyone this has been really helpful. Everything seems to be working as I hoped now.