How to attach multiple textures to single .3ds file

Started by mallikpavan, March 13, 2015, 07:44:15 AM

Previous topic - Next topic

mallikpavan

Hi

   I tried to load a house.3ds file using JPCT-AE. i have multiple texture files to add. Below is the way how i am attaching the textures.


house= load3DSModel(
            mActivity.getResources().openRawResource(R.raw.cottagen131214),
            0.5f);

      TextureManager.getInstance().addTexture(
            "003.jpg",
            new Texture(
                  BitmapHelper.rescale(BitmapHelper.convert(mActivity
                        .getResources().getDrawable(R.drawable.c003)),
                        128, 128)));

      TextureManager.getInstance().addTexture(
            "009.jpg",
            new Texture(
                  BitmapHelper.rescale(BitmapHelper.convert(mActivity
                        .getResources().getDrawable(R.drawable.c009)),
                        128, 128)));

      TextureManager.getInstance().addTexture(
            "119.jpg",
            new Texture(
                  BitmapHelper.rescale(BitmapHelper.convert(mActivity
                        .getResources().getDrawable(R.drawable.c119)),
                        128, 128)));

      TextureManager.getInstance().addTexture(
            "221 roof gray.jpg",
            new Texture(BitmapHelper.rescale(BitmapHelper.convert(mActivity
                  .getResources().getDrawable(R.drawable.c221roofgray)),
                  128, 128)));

      TextureManager.getInstance().addTexture(
            "Doski113.jpg",
            new Texture(BitmapHelper.rescale(BitmapHelper.convert(mActivity
                  .getResources().getDrawable(R.drawable.doski113)), 128,
                  128)));

      TextureManager.getInstance().addTexture(
            "old3.jpg",
            new Texture(
                  BitmapHelper.rescale(BitmapHelper.convert(mActivity
                        .getResources().getDrawable(R.drawable.old3)),
                        128, 128)));

      TextureManager.getInstance().addTexture(
            "OLDMETAL.jpg",
            new Texture(BitmapHelper.rescale(BitmapHelper.convert(mActivity
                  .getResources().getDrawable(R.drawable.oldmetal)), 128,
                  128)));

      TextureManager.getInstance().addTexture(
            "stone_paving_01.jpg",
            new Texture(BitmapHelper.rescale(BitmapHelper
                  .convert(mActivity.getResources().getDrawable(
                        R.drawable.stone_paving_01)), 128, 128)));

It seems not working. Please help me to apply the multiple textures to my .3ds model. thanks in advance.

EgonOlsen

You have to assign texture names when adding the textures to the manager that match the ones from the file (before loading the file). If you are unsure, how the textures are actually named in the file (these names aren't always identical to the file names!), have a look at the log output when loading the file. More information can be found here: http://www.jpct.net/wiki/index.php/Loading_models

In addition, try to get rid of this rescaling stuff in your loading code. Just save the textures in a power of two format and load them without any rescaling.

mallikpavan

Thanks a lot for quick reply.

My exact problem is, I downloaded one .3ds model object from net. i found multiple textures in that folder i.e 003.jpg,009.jpg,119.jpg... .

My question is what are the names i need to give while loading textures.

ex:  TextureManager.getInstance().addTexture(
            "003.jpg",
            new Texture(
                  BitmapHelper.rescale(BitmapHelper.convert(mActivity
                        .getResources().getDrawable(R.drawable.c003)),
                        128, 128)));

         is the above is correct or is there any chance to know the given texture names of .3ds file? Please help me. i have been stuck from past 1 week.

EgonOlsen