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:
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");
pokemon.setMaterial(mat_default);
//Attaching only one texture here, I need to attach another too
mat_default.setTexture("ColorMap",
assetManager.loadTexture("Models/Bulbasaur/Textures/FushigidaneDh.tga"));
Can anybody help me to attach also the eyes texture to it?
Bonus questions:
Which file extensions are the best ones? Which one I should use?
How do I know if a model file contains the material too?
How do I know if a model file contains animations too?
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.
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().
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.