Can .X file format handle 32-bit textures?

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
Linkin Puck
Posts: 36
Joined: Sat Feb 06, 2010 11:52 am

Can .X file format handle 32-bit textures?

Post by Linkin Puck »

I was experimenting with the Dwarf.x file in the Irrlicht media folder, I changed his axe to a 32-bit PNG (and edited the .X file to point at the new image) and made parts of the axe transparent by making the alpha channel grey at certain places. Just to be sure I had the right image, I drew a pattern on the axe, so I know it was the right image.

It didn't show up as transparent in MeshViewer.

Does this mean the .X format can not take transparency from the textures? Or at least Irrlicht doesn't support it? :shock:
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

You'll have to tell the material on the mesh file that it's transparent.

use getMaterial(0) to get the material, then set the MaterialType type to EMT_TRANSPARENT_ALPHA_CHANNEL

It's kinda silly, IMO irrlicht should only read it's own mesh format so it can contain this information inside it, without programmer intervention.
Linkin Puck
Posts: 36
Joined: Sat Feb 06, 2010 11:52 am

Post by Linkin Puck »

So should I just do that for EVERY material? So that if there is an alpha channel it uses it, and it there isn't it doesn't matter anyway.

Wouldn't it be better if transparency was turned on by default in Irrlicht?

Or am I completely misunderstanding you?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

AFAIK, there's no transparency flag in .x, which means that we don't create transparency settings. Problem with enabling the transparency always is that suddenly many existing meshes don't work anymore.
Linkin Puck
Posts: 36
Joined: Sat Feb 06, 2010 11:52 am

Post by Linkin Puck »

hybrid wrote:Problem with enabling the transparency always is that suddenly many existing meshes don't work anymore.
Presumably because existing textures that are 32-bit and have transparency have been built in .x assuming that the transparency won't work, right?

Therefore it would be pretty dumb of people to use 32-bit textures on their .X models. Therefore not many people would do that. Therefore it's not going to be that much of a problem.

Therefore, if I am creating my own .X models, and I'm happily using 32-bit textures with perfect alpha channels, then I can switch this flag on for each material, right? Unless there is a performance reason not to do it.

Out of interest, what is the model format of choice for using transparent textures? I basically am using imported PNGs to make very simple rooms (texturing the inside of a cube) but I need to cut holes in the texture for windows etc.

Thanks (again!) for your help, Hybrid, and thanks to Pippy as well.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Model formats really don't matter just for a texture, they all get transformed to the same structure in irrlicht.
Linkin Puck
Posts: 36
Joined: Sat Feb 06, 2010 11:52 am

Post by Linkin Puck »

Lonesome Ducky wrote:Model formats really don't matter just for a texture, they all get transformed to the same structure in irrlicht.
They do if they can't handle transparency. :wink:
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

If you're setting the flag for transparency in irrlicht, ANY model format can handle it.
Post Reply