Author Topic: texture transparent alpha color is not working  (Read 1987 times)

Offline penprakash

  • byte
  • *
  • Posts: 26
    • View Profile
texture transparent alpha color is not working
« on: August 14, 2013, 05:37:12 pm »
Hi,

 I am loading obj file which defines the transparency of the material to be alpha in the mtl file. when i loaded the background black color is still displaying. I have used following code to load the texture images. Can you please tell me, what could be the problem.

BitmapFactory.Options options = new BitmapFactory.Options();
                        options.inDither = false; //Disable Dithering mode
                        options.inPurgeable = true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared
                        options.inInputShareable = true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
                        options.inTempStorage = new byte[4 * 1024];
                        File file = new File(filePath + "/" + s);
                        fs = new FileInputStream(file);
                        bitmapFile = BitmapFactory.decodeFileDescriptor(fs.getFD(), null, options);
                        fs.close();
                        if (bitmapFile.getWidth() > 512 || bitmapFile.getHeight() > 512) {
                           texture2 = new com.threed.jpct.Texture(
                              BitmapHelper.rescale(bitmapFile, 512, 512), true);
                        }
                        else {
                           texture2 = new com.threed.jpct.Texture(
                              bitmapFile, true);
                        }
                           
                        texture2.enable4bpp(true);
                        com.threed.jpct.Texture.defaultToMipmapping(false);
                        TextureManager.getInstance().replaceTexture(s, texture2);


MTL File :
newmtl Thalaiva
   Ns 92.1600
   Ni 1.5000
   d 1.0000
   Tr 0.0000

   Tf 1.0000 1.0000 1.0000
   illum 2
   Ka 0.5098 0.5098 0.5098
   Kd 0.5098 0.5098 0.5098
   Ks 0.2500 0.2500 0.2500
   Ke 0.0000 0.0000 0.0000
   map_Ka thalaivaa.png
   map_Kd thalaivaa.png
   map_d thalaivaa_opa.png

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: texture transparent alpha color is not working
« Reply #1 on: August 14, 2013, 08:07:21 pm »
Try to manually enable transparency in code.