Game Development Community

Transparency and Translucency

by Jim Chu · in General Game Discussion · 09/24/2003 (11:20 pm) · 5 replies

Both transparency and translucency are supported by the G3D rendering system. The alpha channel of a file can be used to depict the opacity of the texture. A value of zero indicates it is entirely transparent. A value of 255 indicates it is completely opaque. All intermediate values represent translucency.

However, when only transparency is required, it is a waste of valuable texture memory to use the 8-bit alpha channel to represent a 1-bit value. So we've set up the special color (0,0,0) to represent transparent. However, the current version of the renderer has no way of knowing if the texture contains any (0,0,0) values. So it has no way of determining if it should setup the transparent effect in the render queue.

Our solution (and it may be temporary) is to specify that a texture with the (0,0,0) value will use transparency only when the texture filename is terminated with "_t0.ext" (where ext is the file format of the texture.) If a texture contains a (0,0,0) value and is not terminated by this delimiter, then the (0,0,0) value is interpreted as pure black. For example if a bitmap contains (0,0,0) in at least one pixel it will:

Be transparent if the filename is name_t0.bmp
Will be drawn pure black if the filename is name.bmp


SUPPORTED FORMATS: The Reaction Engine now supports most texture formats. Monster Studios would like to acknowledge the use of the Corona public libraries and the work of Ken Paulson for implementing the multi-format support.


Please help. I can't get the alpha channel to work, the _t0.ext work fine but is there anything I am missing? Here is the files I have..

Thanks for any help.
neonate.caltech.edu/test.zip

About the author

Recent Threads

  • Monster Studios MIA

  • #1
    10/02/2003 (9:39 am)
    Jim,

    Sorry about not getting back to you sooner. I've been crazy busy.

    I used photoshop to examine your .pngs, and none of them have an alpha channel. They only have the RGB channels. Try using a .tga initially.

    Hope this helps.

    Chris
    #2
    10/02/2003 (11:58 pm)
    Chris

    Thank you for the info it did not help, I am having a really hard time on this do you have or know where I can get a tutorial on using Photoshop to do alpha for textures.

    Jim
    #3
    10/03/2003 (10:29 am)
    Jim,

    Sorry I'm not an artist. I only know Photoshop in passing. There must be some a ton of resources on this on GarageGames.

    Good luck!

    Chris
    #4
    01/22/2004 (11:39 am)
    This was a bug in the engine where we hade to rewrite some code to get it to work.
    #5
    01/26/2004 (4:00 pm)
    OK, the fix for this and for the lighting bug has been uploaded here.

    [edit: fixed url tag]