Applying textures

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Lukas
Posts: 4
Joined: Mon Aug 24, 2009 2:43 pm

Applying textures

Post by Lukas »

Hello Irrlicht community.

I'm new to Irrlicht engine and programming. I found out, downloaded, and started using this engine only yesterday. I went through several tutorials and learned quite a bit, like how to load objects, apply a single texture to them. But I still don't know how to apply more than one texture to my map, created in 3d Studio Max 9. I did apply textures in 3d max, but when I loaded the level into my game, it had no textures at all.

I couldn't find any examples, or tutorials to do that, I searched forum, read wiki, but I had no luck. Can you point me to some tutorials, or tell me how to apply several textures to my map? (Floor, walls, ceiling, etc.) Any help is appreciated. Thanks alot

- Lukas
Heresiarch
Posts: 14
Joined: Mon Mar 16, 2009 1:21 pm
Location: Finland

Post by Heresiarch »

Did you UV map the textures on your object?
Lukas
Posts: 4
Joined: Mon Aug 24, 2009 2:43 pm

Post by Lukas »

This is not an object as I mentioned, did I understand you correctly? My map should be UVW Unwrapped, just like any other model? How would my map look if I UVW Unwrapped it, then applied a signle 512x512 dimension texture for the whole map...

Thanks for reply though.

- Lukas
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Hi Lukas,

There are a number of possible problems.

1) Did you export materials with the objects in question?
2) Have you checked the console output (it normally explains what its doing and why)
3) Have you any more information except "its not working".

Most times we can try guess , but you might be doing something incorrectly code side (for example setMaterialTexture is not needed if the mesh has a texture applied already in 3dsmax) and you could be resetting stuff, who knows right ?

The best way to get a good answer is to be careful how you respond as well , you would hate to come across as too sarcastic when you are the one seeking help (this is normal in any community)
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

just 2 common errors when using 3ds meshes:

1st: are the textures in the same folder the mesh is in (they should be) ???
2nd: are the texture names in 8.3 (DOS) format (they should be) ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Lukas
Posts: 4
Joined: Mon Aug 24, 2009 2:43 pm

Post by Lukas »

Hello,

It seems that I didn't have textures I used in my map in the same directory as my map. I also had this code :

Code: Select all

node->setMaterialTexture(0, driver->getTexture("Data/Materials/Wall01.png"));
for example setMaterialTexture is not needed if the mesh has a texture applied already in 3dsmax
Thanks to you, I managed to clear those lines of code, and my map now has 2 textures applied. But I wanted to ask, if there is a way to make my Testmap.3ds file load the textures from different directory? I would like to keep my maps in Maps folder, and the textures in Materials folder.
The best way to get a good answer is to be careful how you respond as well , you would hate to come across as too sarcastic when you are the one seeking help (this is normal in any community)
I didn't mean to sound rude in my last post, I was just thinking that it couldn't be the way to make maps, that's all.

Thanks alot.

- Lukas
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

No worries!

Also, on the same folder issue, no this is how 3ds files work. As with obj etc (which i would suggest as 3ds is crappy).

Another note is normally you manage meshes and textures via setMaterialTexture, manually ( at least in most game frameworks, for the reason of seperating data and sharing a common /textures folder).
Lukas
Posts: 4
Joined: Mon Aug 24, 2009 2:43 pm

Post by Lukas »

Thanks for the info, but wouldn't setMaterialTexture function apply only one texture to the whole model? As I mentioned before, I only started using this engine yesterday. Could you give me an example?

EDIT - I also have another problem with textures in my map. Take a look at screenshots

Rendered in 3ds Max :

Image

In Game :

Image

This happens if I use .obj file as my map. Here's the code I use to load my map :

Code: Select all

// Load map mesh
scene::IAnimatedMesh* mesh = smgr->getMesh("Data/Maps/Hospital.obj");

scene::ISceneNode* node = 0;
node = smgr->addAnimatedMeshSceneNode(mesh);
node->getMaterial(0).SpecularColor.set(0,0,0,0);
Sorry for asking so many things, really.

- Lukas
Post Reply