SOLVED
Hello it is me again :D
Thanks to the help of Egon i applied textures to my .3ds object and load it successfully into android
now i got another question i have read all the posts about multitexturing but i still have a question about it
In some posts its said that .3ds doest not support multi texturing but there is also said that you can apply multiple textures by using the TExtureManager with the rigth names
so what do i have to do?
Do i have to load my model splitted up by texture like one .3ds file for the roof with the roof texture
another .3ds for the wall with the wall texture
and then merge them together
or
do i have to apply all the textures on one .3ds model and use the texture names for the texture manager??
i tried it using the texturemanager but i am not getting it to work the textures are not showed at all
so what is the best way and maybe some explination code would help
thank you
this is my code right now
try {
Texture teppich=new Texture(assetManager.open("teppichHems.jpg"));
Texture decke=new Texture(assetManager.open("StyroporDecke.jpg"));
Texture wand=new Texture(assetManager.open("WandBlech.jpg"));
TextureManager.getInstance().addTexture("Texture.001", teppich);
TextureManager.getInstance().addTexture("Texture", decke);
TextureManager.getInstance().addTexture("Texture.002", wand);
} catch (IOException e) {
e.printStackTrace();
}
try {
model = Loader.load3DS( assetManager.open("thirdfloorAndroid.3ds"), 1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
You are mixing multi-texturing with multiple textures here. Multi-texturing applies multiple texture layers to a polygon. 3ds doesn't support this. Mutiple textures simply means that a models contains multiple textures (but only one texture/polygon). 3ds supports this just fine. Your approach with the names in the manager is already fine, you just don't use the right names (most likely). Scan the log for messages about the texture names when loading the model and you should see if and how these names differ from the ones that you are using.
Thank you Egon you are the man :D
simple problems and you give directly simple solutions :)
hi egon, i don't understand about texture names in TextureManager. I have model with 3 texture file :Bear_Eyes+eeth+Nail_Diffuse.jpg, Bear_Specular.jpg, and Bear_Diffuse.jpg
teeth = new File(Environment.getExternalStorageDirectory(),"Folder/"+subfolder+"/"+"Bear_Eyes+eeth+Nail_Diffuse+".jpg");
body= new File(Environment.getExternalStorageDirectory(),"Folder/"+subfolder+"/"+"Bear_Diffuse".jpg");
TextureManager txtMgr = TextureManager.getInstance();
Texture texture1 = new Texture(new FileInputStream(teeth));
Texture texture2 = new Texture(new FileInputStream(body));
txtMgr.addTexture("texture1", texture1);
txtMgr.addTexture("texture2", texture2);
object.setTexture("texture1");
object.setTexture("texture2");
but texture of teeth and body not apply :( ..am i wrong using texture names and TextureManage?Please guide me. thanks egon
If you let the loader assign the textures, you must not call setTexture(...) on the object, because that will set the texture for the whole object. What you should do is:
- Find out about the proper names. The file names don't matter. It's the name that you give it in the TextureManager that counts and i highly doubt that these would be "textureX". Look at the log output or use the method to read the texture names that the Loader offers.
- Add the textures with the proper names to the TextureManager
- Load the object
- DON'T call setTexture() on the object
Thank you egon.it's work now :)
Hi egon, i have something to ask again.. if i want get proper texture name not from output log, how do that?
Thx you again
http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Loader.html#readTextureNames3DS(java.io.InputStream) (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Loader.html#readTextureNames3DS(java.io.InputStream))