[SOLVED]How To Load Texture from 3dsMax into Irr?
[SOLVED]How To Load Texture from 3dsMax into Irr?
I have draw a object in 3dsmax and i have assign some texture by 3dsmax, but when i load this obj which exported by 3dsmax into Irr, it disappear all the texture and need to write the code:
setMaterialTexture
so how can i load the texture which assign from 3dsmax into irr without using setMaterialTexture??
setMaterialTexture
so how can i load the texture which assign from 3dsmax into irr without using setMaterialTexture??
I am not sure if .obj files store the texture filename or not. Open the .obj file and the .mtl with a text editor and see if the texture name is present anywhere. If not it's either a limitation of the .obj format or your exporter. or irrlicht.
Google the .mtl format, it seems you can use textures
for example
map_Ka my_texure.bmp
map_Kd my_texure.bmp
Try editing the .mtl file!
Google the .mtl format, it seems you can use textures
for example
map_Ka my_texure.bmp
map_Kd my_texure.bmp
Try editing the .mtl file!
yes try adding the filename and see what happens!
In the mtl file there should be sections for each material,
Example with texture added:
newmtl Material_Name
Ns 96.078431
Ka 0.764102 0.764102 0.799580
Kd 0.581219 0.621303 0.609937
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Ka my_texure.bmp
You could also try replacing "map_Ka" with map_Kd, map_Ks, or even having all three.
(I think they are different texture maps for ambient, diffuse, shinyness but am not sure)
In the mtl file there should be sections for each material,
Example with texture added:
newmtl Material_Name
Ns 96.078431
Ka 0.764102 0.764102 0.799580
Kd 0.581219 0.621303 0.609937
Ks 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Ka my_texure.bmp
You could also try replacing "map_Ka" with map_Kd, map_Ks, or even having all three.
(I think they are different texture maps for ambient, diffuse, shinyness but am not sure)
1. are you UV mapping your meshes?
2. are you using multi-layered materials?
exporting multi-layered materials will go nuts in Irrlicht. Try to create a separate material for each mesh in your scene. When exporting accept on the preserve coordinates message you get, then place all of the textures you used (jpgs, bmps, etc) in the same folder as the .3ds. If you're just exporting materials with colors in the difuse channel (no bitmaps) you'll also get errors. Finally, remember to set "EMF_LIGHTING, false" on your 3ds mesh node.
If you don't go over the 65k poly limit in 3ds you should be ok.
2. are you using multi-layered materials?
exporting multi-layered materials will go nuts in Irrlicht. Try to create a separate material for each mesh in your scene. When exporting accept on the preserve coordinates message you get, then place all of the textures you used (jpgs, bmps, etc) in the same folder as the .3ds. If you're just exporting materials with colors in the difuse channel (no bitmaps) you'll also get errors. Finally, remember to set "EMF_LIGHTING, false" on your 3ds mesh node.
If you don't go over the 65k poly limit in 3ds you should be ok.
@hybrid: that's a new one for me! It's great to know Irrlicht can read the info in the .mtl file, thanks!
@Thomaskkc: sorry for not using the proper term, that's what I meant "Multi/sub-object" materials. Avoid using them as Irrlicht goes crazy with those and will end up showing you some weird scenes or untextured models. Try starting by keeping it simple; separate texture per mesh and try it out.
Also try hybrid's latest info with your .obj file (and please report back if you succeeeded).
One last thing you could do is unwrap your model and use a single texture with all of your textures in it. May I ask what your model is? I mean, is it a level map or a character?
cheers.
@Thomaskkc: sorry for not using the proper term, that's what I meant "Multi/sub-object" materials. Avoid using them as Irrlicht goes crazy with those and will end up showing you some weird scenes or untextured models. Try starting by keeping it simple; separate texture per mesh and try it out.
Also try hybrid's latest info with your .obj file (and please report back if you succeeeded).
One last thing you could do is unwrap your model and use a single texture with all of your textures in it. May I ask what your model is? I mean, is it a level map or a character?
cheers.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Correct code is
and then inside a group
And this has been supported since the obj+mtl patch which is now part of Irrlicht core.
Code: Select all
mtllib filename.mtl
Code: Select all
usemtl materialname