3ds texture loading problem (solved.....my way)

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
maranek
Posts: 5
Joined: Fri Dec 19, 2008 11:29 am
Location: Slovakia

3ds texture loading problem (solved.....my way)

Post by maranek »

hello...
i have problems with textures in irrlicht...
im using .3ds for models.
i just made a test model to show that the textures wont load properly..
im using D3D9 for rendering,and the texures are in the same folder as the models...it should be a texture of grass...i used blender for modeling
http://img187.imageshack.us/my.php?image=prob1hp8.jpg
and the console...
http://img187.imageshack.us/my.php?image=prob2ce0.jpg

and heres the code for loading that mesh

Code: Select all

scene::IMesh *map = smgr->getMesh("models/map1.3ds");
		scene::IMeshSceneNode *mapnode=	
		smgr->addMeshSceneNode(map,0,-1,
										core::vector3df(0,0,0),
										core::vector3df(0,0,0),
										core::vector3df(25.00,25.00,25.00)
										,false);
i want the engine to show the texures properly...
Last edited by maranek on Fri Dec 19, 2008 5:18 pm, edited 1 time in total.
skumar
Posts: 201
Joined: Thu Feb 14, 2008 6:24 pm
Location: kerala state india
Contact:

Post by skumar »

Are you sure you have done proper texture mapping????

If not this kind of situation may rise.....
skumar
SwitchCase
Posts: 170
Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK

Post by SwitchCase »

As far as I'm aware the current .3ds loader for irrlicht doesn't support textures. The reason for this likely because 3ds files handle materials and texture paths poorly. There are other issues with 3ds also.

You have two options:
1. Write a new / modify the 3ds loader
2. Use a different format

I recommend the second option.
maranek
Posts: 5
Joined: Fri Dec 19, 2008 11:29 am
Location: Slovakia

Post by maranek »

thank you for your replies....:wink:
which format do you recommend?
SwitchCase
Posts: 170
Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK

Post by SwitchCase »

It depends completely on your specific needs. However, .b3d seems to be a popular choice around here.


:)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Unless anything's changed recently then the 3ds loader certainly does support textures, i think the only one that doesn't load them whilst loading the model is md2.. but even then still allows you to set them afterwards.

maranek, using another format won't solve your problem, the model clearly has the texture applied because it's got a green colour and presumably your grass is green... the problem is the texture is not applied properly because you haven't done the texture mapping on it in your modelling program so each vertex has a texture coordinate of 0,0 so one pixel of your texture is used to cover the entire model, hence it's a single green colour all over.
Image Image Image
SwitchCase
Posts: 170
Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK

Post by SwitchCase »

Unless anything's changed recently then the 3ds loader certainly does support textures, i think the only one that doesn't load them whilst loading the model is md2.. but even then still allows you to set them afterwards.
Hmmmm... in that case then, ignore me. :P

Why I was led to believe the 3ds loader does not support textures I do not know... yes, I'm an idiot. :lol:

Still, 3ds isn't the nicest of formats. I.e. normals have to be calculated at runtime since 3ds does not store normal data. The performance hit is pretty much negligible in most applications but yeh.
Last edited by SwitchCase on Fri Dec 19, 2008 2:17 pm, edited 1 time in total.
maranek
Posts: 5
Joined: Fri Dec 19, 2008 11:29 am
Location: Slovakia

Post by maranek »

JP,thank you for your view on this problem...ill do something about it...
im not good at modeling...it will take time but i will edit this post, and tell what helped me, later...
SwitchCase-we cant know everything :wink: mistakes happen 8)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

i guess you might be able to texture map this simple model in irrlicht. If it's just a quad with the texture applied over the whole quad then you can use IMeshManipulator::makePlanarTextureMapping to do that.
Image Image Image
maranek
Posts: 5
Joined: Fri Dec 19, 2008 11:29 am
Location: Slovakia

Post by maranek »

eh strange....
before in 1.4.2 the obj didnt work...
now i downloaded 1.5 and it loads the mesh in obj..
but only it loads the uv textures...
but it WORKS!!! :twisted:
i think i will do all the mapping with UVs..
I really thank you guys...
my first impressions of this forum are very good..
keep on your good work :wink:
Post Reply