kev 3ds loaders setBounds

Yes, using 32bpp PNG textures solved the problem :), but it wasn’t easy to find a tool that is able of writing/converting 32bpp PNGs (What are you guy using?)

XFrog textures are TIFFs with alpha channel. In the first place I converted them to PNG, but only to 24bpp with transparency based on color opacity (-1 for Photoshop7 and PaintShopPro7 >:() AC3D imported and displayed the XFrog-3DS model with 24bpp PNGs correctly, tough (as far as I remember DE didn’t)

Now, I am using ImageMagick to convert the RGBA-TIFF to 32bpp PNG and bingo, xith-rendered XFrog trees looks sweeeet… :smiley:

Thanks for support,
gismo

[quote]Yes, using 32bpp PNG textures solved the problem :), but it wasn’t easy to find a tool that is able of writing/converting 32bpp PNGs (What are you guy using?)
[/quote]
Basically I always use the free XnView. However it’s a viewer, not an image editor (but then I’m no artist, so it’s OK :slight_smile:
Regularly I’ve to create RGBA images on the fly from an RGB plus Alpha image, so I use a small method.


...
BufferedImage imgRgb = ImageIO.read(newFile("PicutureRgb.png"));
BufferedImage imgAlpha = ImageIO.read(newFile("PicutureAlpha.png"));
BufferedImage imgRgbA = makeRgbPlusA(imgRgb, imgRbba);
ImageIO.write(imgRgbA, "png", new File("PictureRgbA.png");
...

private final static ColorModel modelRGBA = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8, 8, 8, 8}, true, false, ComponentColorModel.TRANSLUCENT, DataBuffer.TYPE_BYTE);

/**
 * Add RGB-image plus Alpha-image (both same sized) to a new RGBA-Image.
 *
 * @param  rgbImg  RGB-BufferedImage, 24 Bit.
 * @param  alphaImg  Alpha-BufferedImage, 8 Bit.
 *
 * @return  BufferedImage of Type RGBA (32 Bit).
 */
public static BufferedImage makeRgbPlusA(BufferedImage rgbImg, BufferedImage alphaImg)
{
  final int xdim = rgbImg.getWidth();
  final int ydim = rgbImg.getHeight();
  WritableRaster raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, xdim, ydim, 4, null);
  BufferedImage newImg = new BufferedImage(modelRGBA, raster, false, new Hashtable());

  Graphics2D g2d = newImg.createGraphics();
  g2d.drawImage(rgbImg, 0, 0, xdim, ydim, null);

  Raster alpharaster = alphaImg.getData();
  WritableRaster zielraster  = newImg.getAlphaRaster();
  zielraster.setRect(alpharaster);

  return newImg;
}

using Photoshop here. but Photoshop itself has problem exporting png- the workaround is to make yer texture in Photoshop then open ImageReady to save the PNG and it all works sweet!

I would ask you to re-run tests with normal probelms. When I was checking Stripifier stuff, I found a bug in

GeomContainer.setNormal(int vertexIndex, Vector3f vector3f)

so if you used this one, some of normals were definitely worng.

Yuri

all seems to be ok still with that fix dude. part from the shadow volumes dont work still. not sure if its the loader or zith3d?

love to see that working mind :slight_smile:

tops stuff this loader- kev what would it take for a write?

kev dude- can your loader take other texture formats then .png for transparent textures? seems i cant export a sodding .png from PolyTrans.

or can i some how tell the loader to override the file type name from .whaterver to .png. i can make png files. but the 3ds file i make points to a different file type.

just wondered :slight_smile:

ok things are going mad :frowning:

i have a model with more then one texture (8 textures). now when i load the model the textures load ok also- well ok’ish.

they dont apear on the model unless i call ‘model.setShowBounds(true, true);’. as u can guess i dont want all the bounding stuff on screen. if i dont call this nothing is textured?

i had to hack the ‘TexMapProcessor.java’ so i could overide the texture file format to load ‘png’ files. just hacked the ‘process’ with:

String filePNGLocation = imageName.substring(0, imageName.length() - 3) + “PNG”;

shouldnt give it any hassle? just tells the loader to load .png of its files.

my textures are png 1024*1024. shouldnt be a problem?