Can't add textures to custom 3D models

Can't add textures to custom 3D models

Postby DromEd » 19 Apr 2013, 11:58

Hi. I tryied to import my own 3D models (as static objects) into the game. Technically, the model itself works but there is a big problem, I don't see any texture ! :o
I've put my texture in the same directory as the .mesh file (data/objects) but it dosen't change anything. i did the model with Blender (a simple cube to test) and I could see the texture when I rendered.
I am totally newbie with Blender, I'm much more confident with 3ds max, maybe I forgot something/did something wrong with blender... :(

I also tryied to edit the file "objects_static.mat" located on data/materials to add my object in that file (as I did to add one custom road texture) but it dosen't change anything, not any texture won't show up on my 3D model.
The line I added in objects_static.mat is that :

material cube
{
parent base
diffuseMap stripes.jpg
ambient 1 1 1
diffuse 0.8 0.8 0.8
specular 0.4 0.4 0.4 16
}

Can you guys help me ? (note: I use the latest blender : 2.66a)
DromEd
 
Posts: 9
Joined: 18 Apr 2013, 12:01
Location: France

Re: Can't add textures to custom 3D models

Postby CryHam » 19 Apr 2013, 17:08

This is the way to do it. So it should work.
Try another name, check in blender the name of the material (rename to something unique, maybe even with a part of the object name). Then use that new name in objects_static.mat. You can check in .mesh file just search for the string of material name, should appear (I know it's binary but you should find the name of materials there).
Also make sure if the texture stripes.jpg has the same name as file, and it should be in data/objects.

If it still doesn't help, look into ogre.log, it should have a line somewhere saying what's wrong. So look for e.g.:
- Can't assign material ..... to .... because this Material does not exist.
- OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource ...
- Error loading texture
So basically look for: can't, exception, error or warning.
If the object appears white, this means material isn't present in .mat or (name is different). If material is ok but texture not found it should be black.
User avatar
CryHam
SR Moderator
 
Posts: 1047
Joined: 25 Nov 2012, 08:40

Re: Can't add textures to custom 3D models

Postby DromEd » 20 Apr 2013, 11:52

i checked all that and in the first view, I'd say this is my material which has a wrong name. I'll try to give the same name as in the materials/objects, that's the only thing wrong I see.
Also, I don't see any ogre.log either in the blender folers or the stunt rally folders...

CryHam {l Wrote}:If the object appears white, this means material isn't present in .mat or (name is different). If material is ok but texture not found it should be black.


My objects appear in white, so it confirm the fact that I should rename it.
I'll retry as soon as possible

EDIT : Ok the problem was from the material name. With the right name, I can see the textures, that's nice ! :)
DromEd
 
Posts: 9
Joined: 18 Apr 2013, 12:01
Location: France

Who is online

Users browsing this forum: No registered users and 1 guest