AC3D Loader

Hi
I’ve ‘finished’ porting my ac3d loader over to xith, when I say finished, I mean i fixed the two bugs. There is still one peice of it I don’t like, when loading textures I couldn’t work out the format, so I load it as a buffered image (real one using ImageIO), then it fails if I pass that into loadTexture in texture loader, so I pass in the filename and load it again. This way I know if it has alpha chanel or not, and can use the right format. This means I can do transparent textures on my ac3d models, which is nice :slight_smile:

So check it out, if you happen to have any ac3d models :slight_smile:

New Dawn Software, under resources and Xith3D loaders

Cheers

Endolf

I don’t have any AC3D models but if I read you correctly there is a limitation of the Xith3D TextureLoader which should be fixed?

I recall having transparency (partially) working with the ASE loader, the texture was transparent but there were one or two other problems which may have been my fault not xith’s.

Will.

Hi
The limitation as I see it is 2 fold, first, if you use the loadTexture method with a filename, when I tried to get the image format I got a format of 0, for every texture I tried, alpha chanel present or not. Then the other problem is that when I load a texture as a buffered image of my own, it throws an exception when I try to use said buffered image in the loadTexture method. I’ll posts some stack trace at some point, think it will be friday before I get to code again outside of work.

Endolf

Please post stack traces either here or in Issuezilla. I am very interested in this test case at least because of loading textures from buffered images work for me perfectly (both RGB and RGBA).

Yuri

[quote]the other problem is that when I load a texture as a buffered image of my own, it throws an exception when I try to use said buffered image in the loadTexture method.
[/quote]
As I recall, I also had similar problem until I wrapped BufferedImage into DirectBufferedImage.

To load textures, I use something like

BufferedImage bi;
...
String s = null;
if (bi.getColorModel().hasAlpha())
  s = "RGBA";
else
  s = "RGB";

texture = TextureLoader.getInstance().constructTexture(DirectBufferedImage.make(bi), s, mipmap, magFilter, minFilter, Texture.WRAP, false, TextureLoader.SCALE_DRAW_BEST);

This works fine with both RGB and RGBA textures.

Yuri

Hi
Thanks, i’ll give it a go when I get a chance, should be friday.

Cheers

Endolf

Hi
Using DirectBufferedImage.make fixed it, image is only loaded once now. New version uploaded

Cheers

Endolf

Edit: I’ve added a link to the loader from the xith-tk website, under file sharing

Cool, four loaders in the toolkit now and growing :slight_smile:

Do you plan on adding the code into CVS as well?

Will.

Hi
I admit that I hadn’t planned too. The source is in the download zip. There are 3 parts to my loader, a general parser/loader that loads the ac3d model into an internal format, and then there are 2 renderers, one for java3d and one for xith. I didn’t want to check just some bits in, but likewise didn’t want to check in the java3d renderer into a xith3d project. Currently there are two seperate downloads, so you only get the bits you need/want, but the source is in one place (different ant targets to generate the downloads).

Endolf

Thanks, this way to create an RGBA texture works fine for me, too.

Would it be possible to use Xith3d’s texture cache even when using textureLoader.constructTexture(…) ? (Usually the cache is being used when I call loadTexture and getTexture.)

The RGBA BufferedImage I construct from a RGB-Png file plus an Alpha-Png file, and feed the RGBA BufferedImage to your mentioned constructTexture(…). While this works fine, is this maybe too fussily? Maybe there is a simpler way in Xith3d to achieve this which I don’t know?

Just a question, no call for “more features” in Xith3d this time. :slight_smile:

[quote]Just a question, no call for “more features” in Xith3d this time. :slight_smile:
[/quote]
If that was aimed at me, no :), I’m still waiting for concave polygon triangulation and smooth normal generation :slight_smile:

Endolf.

Well, for the “smooth normal generation” (comparable to com.sun.j3d.utils.geometry.NormalGenerator maybe?) I say +1. :slight_smile:

Do any of these loaders support animation?

AFAIK:

MD3 Loader - Supports Animation, but not sure where this is available at the moment.

AC3D - File format and tool don’t support animation and hence the loader doesn’t

OBJ - File format doesn’t support animation and hence the loader doesn’t.

ASE - File format doesn’t support animation? (not sure about this one actually)

MD2 - Animation is supported but only the frames set out in the file.

3DS - Jointed animation is supported, Morped is not. Although, I suppose this could be added now Morph works :slight_smile:

Kev

3ds seems like the way to go. Do you know anyways to convert files into 3ds? I’m using milkshape3d right now.

If you’re using MS3D the best thing to do I would think is to write a MS3D loader :slight_smile: There seems to be a wealth of information about this and a couple of reference Java3D implementations to use.

Every conversion tool I’ve seen from 3D model format to 3D model format strips out animation…

I believe you can export to 3DS from Milkshape tho? Ahh… checked web site, export is to ASC.

Kev