Importing models lose textures!

Alright, I’ve had it. I’ve tried every guide on importing assets (models) with textures, but it just doesn’t work. I make a model, UV-map and add my texture, and it all looks great, I export the model in .OBJ to where the texture is, BUT, when I import it using the SDK importer… the model of course imports without error but it just has a black texture! I’m really getting frustrated, and I don’t know what goes wrong … the texture is just a normal .jpg file, is that alright? What do I do to make it UV mapped?Is that the issue? What are all the steps, from finishing the jpg to seeing it in the game, that I need to do? If someone could just get a concise way of how to import textured model, instead of the often contradicting tutorials in the documentation, that would be great… Thanks! (:

1 Like

It might be because it’s an .obj model. Have you tried creating a material using your .jpg as the diffuse texture or color map and applying that material to your model?

@normen said: http://www.youtube.com/watch?v=6-YWxD3JByE

Holy shit, that helped so much! However, I create the blender file and then move it around a bit, and then it doesn’t work, no textures loaded… as I expected. Where do the textures need to be in order to let them load? The textures folder? Or just wherever you had them when you added them?

Somewhere in the assets folder.

@normen said: http://www.youtube.com/watch?v=6-YWxD3JByE

Also, now another problem has arisen. So I tried creating a room, and made a plane, extruded the edges up and then added a small roof. However, only two of the walls and the floor have textures (on the “inside” of the room, when I check outside by flying out, they have them there!). How can I fix this?

Extruding:

That is a useful word, but only because I know:

(as far as blender goes) It sometimes creates unnecessary doubles, and the faces usually have to be recalculated or hit with a flip direction.

This has to do with face culling on meshes, although I couldn’t explain it in detail, I never went out of my way to learn all of it.

I think I recall that what it does, is render the texture dependent on camera position, which side depends on if it’s culling front, or back.

The materials setting also has an off feature, but I can’t say how much impact it’ll have on resources if you run a lot of face culling off.

Summary:

you have 3 options that can get your faces right:

In Blender under normals: in [*Edit Mode]: 1) Recalculate 2) Flip Direction (ONLY ON AFFECTED PARTS)

In JME(unknown impact): 3) make the material, turn off face culling, apply to the model, either in scene explorer or code.

It might be helpful to view the normals:
Go in edit mode and have a look at that:

You might also want to turn on “Backface culling”. You can find it at the “Display” knot.
So you can see such errors faster.

I don’t know if you are doing this but I had to alter the planes when I exported and change the centre of models before I exported. I was having problems before I realised I had to do this.

On the export properties when exporting to .obj I selected yup and x forward (I think, experiment) and my model was a box basically but I still needed to move the centre to the bottom left corner. This actually also made things easier when I was putting it all together in the application.

Alright, thanks so much for all the help, it really works now! However, one last question … The materials which are prepared for UV mapping, how do I import them into another project? :slight_smile: I already made a model and I’d rather keep that, since it took some time… but it was just made in a “normal” blender file, not the one you open through Jmonkey! So, how should I do that?

I will give this one a shot:

In regards to the potentially obscure/misunderstood: “The materials which are prepared for UV mapping”:

If you mean the UV mapped textures:

The UV map settings are all set to go in your mesh, they will only import if mapped to material(s).

will import if you packed them in the .blend (sometimes)
will import if they are in the same folder as your import.
if you moved them into JME’s file structure: imports with all files visually through the JME [Projects]/[Files] explorer
will also work if you mess up the materials on import, but added to a JME material and apply them to the model through code or scene explorer

If you mean the materials settings themselves, that’s pretty broad, and will need more clarification, like:
Cycles Render or Blender Render, nodes setup, etc.

@cardboardman said: I will give this one a shot:

In regards to the potentially obscure/misunderstood: <span style=“text-decoration:underline;”>The materials which are prepared for UV mapping</span>:

If you mean the UV mapped textures:

The UV map settings are all set to go in your mesh, they will only import if mapped to material(s).

will import if you packed them in the .blend (sometimes)
will import if they are in the same folder as your import.
if you moved them into JME’s file structure: imports with all files visually through the JME [Projects]/[Files] explorer
will also work if you mess up the materials on import, but added to a JME material and apply them to the model through code or scene explorer

If you mean the materials settings themselves, that’s pretty broad, and will need more clarification, like:
Cycles Render or Blender Render, nodes setup, etc.

Well I was mostly talking about the materials that are described in the video posted by Normen… Basically, the one that is set up when you (in the SDK) rightclick in the model folder and press New -> Other… -> Blender -> Box prepared for UV texturing… You then get a blender file which has a few materials (like diffuse, specular, and something else which I forgot), and those make it a whole lot easier to get this texture importing thing going. So, how do I move THOSE (the different already set-up materials) into other blender files, which were not started as “Box prepared for UV texturing…”? :slight_smile:

Somewhat easily:

If you have one editor type set to info (the one with File Add Render Help):

File->Append->[file you want stuff from.blend]->Material->go nuts

As far as I know this is a blender to current project feature, so it will only append .blend info

Some get lost at this point as it does NOT automatically put up the material, you then go to material, and make or select a material, and then a little button below that will let you link the mat you imported.