Tell game engine to use the alpha chanel from inside .png

Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Tell game engine to use the alpha chanel from inside .png
PostPosted: Sat Dec 15, 2007 8:24 am 
Blistered
Not Signed Up For Stats

Joined: Fri Dec 07, 2007 4:19 am
Posts: 32
Is it possible to use the alpha channel in a PNG file for the transparency in my placements ?



Right now I am using the blender MS3D exporter, and adding in a second greyscale image with the alpha painted on it to the models text file.

It would also be nice to use it in the ground map textures under my models.... right now I am doing code like this:

Code:
<groundmap>
                     <image>data/landscapes/palmplot.png</image>
                     <alpha>data/landscapes/palmplotalpha.png</alpha>
                     <invert>false</invert>
                  </groundmap>


TIA :D


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 8:13 pm 
User avatar
Reduced to ashes

Current Scorched3D Rank: Unranked






Joined: Wed Aug 25, 2004 3:54 pm
Posts: 538
Location: In a van down by the river.
this is a great idea.. no more seperate alphas..

but rather .png <--eww

I vote .dds
Image
GoPro + F18 = AWESOME Lap Around The Boat VFA-211 (CVN 65)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 10:50 pm 
User avatar
Obliterated

Current Scorched3D Rank: Unranked



Joined: Wed Jun 14, 2006 11:18 pm
Posts: 1517
Location: United Kingdom
I thought dds was a direct x thing.

Question (and I'm not completely sure of the answer):

Is it worth it?

I like the idea of a separate alpha file. It gives some flexibility in the option to use the original without alpha if you need to. Consider that a 32bit png is likely no smaller in file size than a 24bit png and a greyscale png combined.

Something I've wondered, why bother with png textures at all? All mods are compressed before transfer anyway. Surely there's some overhead in uncompressing png textures for use in the game. Sounds like they're more trouble than they're worth to me. (Probably included for avatars, and texture support came with it).

A possible exception, would an 8bit png uncompress faster? Possibly negating the overhead in using 24bit png as opposed to 24bit bmp? I suppose you could just as easily support 8bit bmps if the difference was significant. It's not like 32bit png files haven't been around since the dawn of time. I bet this has come up before.


Ps:
Wouldn't tga files make more sense in an ideal world?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 11:10 pm 
Blistered
Not Signed Up For Stats

Joined: Fri Dec 07, 2007 4:19 am
Posts: 32
Quote:
I like the idea of a separate alpha file. It gives some flexibility in the option to use the original without alpha if you need to. Consider that a 32bit png is likely no smaller in file size than a 24bit png and a greyscale png combined.


in lots of game engines they give an option weather to use the alpha or not... some even make it nice, so you can actualy tweak the transparency with a range of numbers rather than the alpha simply on or off.

other game engines wil give you an option on a "per face" basis.... the actual UV face tells weather or not to use the alpha.

as far as why to use PNG over bitmaps is the lossless compression rather then the sloppy RLE compression of bitmaps. PNG files compress better than bitmap files too when you use Gzip,zip, or 7zip.

Oh yea!

DDS ,DDR, and DXT files are all Direct Draw surfaces. It is propriatory, and to the extent of my knowlage we cannot use them in open GL yet.

it is no big deal if S3D dose not support the alpha channel of PNG files... it only takes me 2 keystrokes to have it extract the alpha channel , and save it as a greyscale image.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 4:49 am 
User avatar
Obliterated

Current Scorched3D Rank: Unranked



Joined: Wed Jun 14, 2006 11:18 pm
Posts: 1517
Location: United Kingdom
Mmph! wrote:
PNG files compress better than bitmap files too when you use Gzip,zip, or 7zip.

do you mean png files are smaller than zipped bmp's?

not from my experience they're not. in fact, i'm pretty sure they use the same algorithm. (or similar)

no idea what method scorched uses to compress mods before upload, but i know from experience, the file/transfer size isn't far off what it would be with any other lz whatever compression.

i also know next to nothing about opengl, but i bet textures have to be uncompressed before writing to vram, even if they're recompressed on the way in. i mean, surely you can't just have png textures floating around the graphics memory. so that means overhead, right?

: ) guess i wouldn't know. it's hyperpathetical.


Mmph! wrote:
...sloppy RLE compression of bitmaps

i think i meant uncompressed tga.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 5:46 pm 
User avatar
Reduced to ashes

Current Scorched3D Rank: Unranked






Joined: Wed Aug 25, 2004 3:54 pm
Posts: 538
Location: In a van down by the river.
alpha layers are better.. a layer is *a layer* within the same textured image format..

not rocket science people..

no need for seperate alphas if we can get a format that can be used
with alpha layers.
Image
GoPro + F18 = AWESOME Lap Around The Boat VFA-211 (CVN 65)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 7:33 pm 
User avatar
Site Admin
Not Signed Up For Stats

Joined: Mon Aug 04, 2003 4:09 pm
Posts: 4778
Location: Scotland
Alpha from png is supported by the game, but only in certain places.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © phpBB Group