Game Development Community

Transparency

by Fucifer · in Constructor · 04/08/2007 (2:37 pm) · 21 replies

Here is a simple build I did to see if the transparency code is working.

i141.photobucket.com/albums/r72/fuciferTorque/002-00001.png
Page «Previous 1 2
#1
04/08/2007 (8:28 pm)
I don't even know what the Transparency code is... perhaps you can explain... but the result looks cool. At least it works.
#2
04/09/2007 (5:33 am)
It is so when creating the dif in Constructor you dont have to do anything special in Constructor. Just assign a png texture with an apha channel and Torque does the rest. Mainly use for window and things like that.
#3
04/09/2007 (8:04 am)
Aren't portals for windows and such?
#4
04/09/2007 (8:13 am)
Yes you can use portal for window, but normal that will be just cut out. The windows I am talking about is like in building so give a appear of window is there a portal by itself looks like hold in the wall.
#5
04/09/2007 (9:14 am)
I would love to see an example of a staind glass window now. use those TGEA features of light refraction. Good work so far!
#6
04/09/2007 (2:33 pm)
Are you sure it works?

Previously zoned entities wouldn't display objects properly through a transparent brush.

If you stand outside can you see a player model inside? Vise versa?

I guess I'm just going to have to go home early and check it out myself. :)
#7
04/09/2007 (2:44 pm)
I am not using entities for that reason, I code my own from resource.
#8
04/10/2007 (3:09 am)
I am assuming this is in TGEA, because it doesn't work in TGE 1.5.1.
#9
04/10/2007 (6:47 pm)
This is TGE 1.5.1, I have TGEA but I am mainly working with TGE 1.5.1 for now.
#10
04/10/2007 (7:21 pm)
Well heck I don't get it. Are you using SuperPNG or just standard PNGs with an Alpha? I have tried both and it didn't work.
#11
04/11/2007 (6:39 am)
I am using png with mask from Paint Shop Pro 8 but TGE 1.5.1 out the box does not support this. I had to do some coding to get it to work like I want it. Now TGB out the box support this very well. I am currently looking at it to move over to TGE 1.5.1. In fact I am able to do percentage of transparency alot better there.
#12
04/11/2007 (1:45 pm)
I think you can get around the zoning problem by making the window a detail brush.

By the way, does it work with this?
#13
04/11/2007 (10:33 pm)
I would love to see an example of a staind glass window now. use those TGEA features of light refraction. Good work so far!
#14
04/11/2007 (11:06 pm)
Yes it does, Dan. I just merged in the resource today, and tested it with a quickie DIF from Constructor. Transparency doesn't seem to show in Constructor, but works fine in TGE 1.5.1, once you relight the mission.
#15
04/12/2007 (5:13 am)
Yes Dan that resource will work. That the one I start off with.
#16
04/13/2007 (10:26 am)
I downloaded the patch, but I have no clue on how to add the patch to my 1.5.1 SDK. (transparancy)

Is there a tutorial on how to merge this resource into the SDK so I can rebuild the .exe and use it.
or do I just replace the file and rebuild it.
#17
04/13/2007 (10:51 am)
Can't wait to see if shader materials transparancy works too...

It had a one sided bug in the past. Just another way to do the effect but hardware accelerated :)
#18
04/13/2007 (11:44 am)
James,
Personally, I hate patch files. They're a pain to integrate manually, and the automated patching programs rarely work well. But, you work with what you've got. =)

To manually apply the patch, open the .patch file in any text editor, and open your source code in another window.

The first few lines will tell you which file to modify.
diff -u -r1.10 interiorRender.cc
--- interiorRender.cc	2003/04/03 22:17:15	1.10
+++ interiorRender.cc	2003/04/28 15:19:50

Then it's just a matter of applying the changes in each section. Sections begin with a location, like this...
@@ -22,8 +22,9 @@

These are approximate line number ranges, but depending on how many modifications have been made to the source code since the .patch file was made, they can be useless in finding the right section.

The next lines will contain a "landmark" to look for. That's the real clue on where to go.
//!!!!!!!TBD -- there should be a platform fn called memMove!
 #include <string.h>

When you find that landmark, it's time to enter the changes.
You add the code with a plus sign in front of it, and comment out or remove the lines with minus signs.

+  //V23    (add this line)
+  #define ALPHA_TEST_VALUE 0.3f  (add this line too)
-   glBlendFunc(GL_ONE, GL_ZERO);   (remove this line)

After the changes, there will be another few lines of "landmarks".
glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, sizeof(OutputPoint), &pFirstOutputPoint->point);

Continue through the .patch file, applying the changes in each section. Then cross your fingers, say a little prayer, and compile.
#19
04/13/2007 (4:17 pm)
Thanks John

I built it after editing with no error's, I haven't used alpha channels before

I have the gimp, do I just layer 2 texture's together and export to a single .jpg

I think it was explained it in one of my book's for torque but don't really remeber. I'll look hopefully I can get this to work, and again thanks
#20
04/13/2007 (4:38 pm)
I haven't worked with GIMP, but a quick romp through Google turned up a short tutorial on it.

You're going to save your file as a PNG, not a JPG. Jpegs don't support an alpha channel, which is what you'll need for this bit of magic to work.

Complicating matters is the fact that not all PNG formats properly support alpha channels. Photoshop in particular made a mess of it, saving "transparency information" rather than a true alpha channel. Torque can't read that; it needs the alpha channel.

As far as I know, GIMP saves them correctly, so you should be fine.

Transparency is really useful; aside from the obvious use for windows, I use it for fences, wrought iron grillework, and lots of other places where modelling all that fine detail would send my poly count through the roof.

Damn those typos! Edit edit edit...
Page «Previous 1 2