[SOLVED] Help importing/converting external Pokemon assets (need to apply multiple textures)

tl,dr: how can I attach 2 textures to a material?

I’m new to the game development world, I just started today. I’m trying to use some external assets that I downloaded from here:

The folder contains models in multiple formats:

  • Models:
    .FBX file extension: Autodesk FBX Interchange File
    .X file extension: DirectX Model File
    .OBJ file extension: Wavefront 3D Object File

  • Mesh (I tried to understand the difference between model and mesh but I don’t know exactly what is it):
    .PSK file extension Unreal Engine Skeletal Mesh File
    .MD5MESH file extension id Tech 4 3D Mesh File

  • Materials:
    .MTL file extension OBJ Material File

  • Textures:
    .tga files in the texture folder

  • and a .blend file that should contain everything?

I tried to convert all of them to j3o from the jMonkey IDE, but after being able to import them, there is always some problem with the texture and the models show without colors in the game.

To convert them I do the following (for example using the .blend model) :

File → Import model → select the Bulbasaur.blend file using this options:
Screenshot from 2018-02-18 21-49-54

In the next screen the model is showing up correctly, with the right textures, and there is a Bulbasaur.j3o file and a Bulbasaur.j3odata in the asset folder at the end of the import (so I assume it was successfull).

In the Textures folder however there are 2 files:

  • FushigidaneDh.tga for the whole body
  • FushigidaneEyeDh.tga for the eyes

So when I launch the game I see a creepy Bulbasaur without eyes because I don’t know how to attach multiple textures to it. Also I’m using the standard material because I don’t know it that is supposed to be inside the .blend file already.

This is the code I’m using

    Spatial pokemon = assetManager.loadModel("Models/Bulbasaur/Bulbasaur.j3o");

    // Using a standard material because I don't know if is included in the j3o object                
    Material mat_default = new Material(
        assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

    //Attaching only one texture here, I need to attach another too

Can anybody help me to attach also the eyes texture to it?

Bonus questions:

  1. Which file extensions are the best ones? Which one I should use?
  2. How do I know if a model file contains the material too?
  3. How do I know if a model file contains animations too?

What happens if you don’t set your own material?

Probably what you got was a Node with multiple Geometry objects underneath it. By calling setMaterial() on that, you blast it over all of the child geometries. One goemetry probably had one texture and another geometry the other.

And anyway, you shouldn’t have had to do that if the .blend file converted properly. And even if you did need to tweak the materials, load it into the scene composer and generate the j3m files so you can just edit them.

I don’t need to tweak the materials.
If I comment the material part and just use this code:

    Spatial pokemon = assetManager.loadModel("Models/Bulbasaur/Bulbasaur.j3o");

I don’t get any texture at all:

Screenshot from 2018-02-18 22-46-34

If I keep the additional texture code instead:

Screenshot from 2018-02-18 22-06-00

This is how it should look like (shown correctly in the preview):

Load your file in the scene composer to see what’s going on.

In the scene composer your can view your file to see what’s going on.

…or you can load your file into the scene composer to see what’s going on.

What I should look at exactly in the scene composer? Sorry, I’m not familiar with 3d objects yet.

I tried to inspect the logs more carefully, I see some WARNING messages about not being able to locate the textures like:

Cannot locate resource: Textures//FushigidaneDh.tga (Flipped)

Is that a problem with the model itself or with the framework?
Here is the full log with FINE trace:

Additional warnings that I get in the notification tab are:

The texture Kd.001 has linear color space, but the material parameter DiffuseMap specifies no color space requirement, this may lead to unexpected behavior.
Check if the image was not set to another material parameter with a linear color space, or that you did not set the ColorSpace to Linear using texture.getImage.setColorSpace().


Unknown block header: PY00

Start here:

Then eventually here: (but don’t skip the above.)
…and scroll down to the info box in “Using .j3m Materials”

I was able to solve: apparently there is a problem with the framework when textures are not in the same folder as the model.

In my case the model was in the Bulbasaur/ folder, while the textures were in the Bulbasaur/Textures/ folder.

I copied the textures in the Bulbasaur/ folder and manually changed the mtl to reference FushigidaneEyeDh.tga instead of Textures/FushigidaneEyeDh.tga and the textures are applied correctly now.

1 Like