Game Development Community

dev|Pro Game Development Curriculum

Plan for James "Corvidae" Williams

by James \"Corvidae\" Williams · 10/20/2002 (4:49 pm) · 11 comments

I've managed to get portions of .dif objects to show up transparent. Best of all, it can be done entirely from within WC/Quark and doesn't require you to make seperate .dts windows, manually place them, etc. Here are a couple screenshots:

www.jrwill.com/trans.jpg
www.jrwill.com/panes.jpg

As far as I can tell, all the issues with the previous hack are resolved, including the depth test problems. In a nutshell, here's how it works:

* Make the interior as per normal in your map editor.
* Make brushes the size and shape of your windows, and place them where you want them.
* Tie each window to a 'trans' entity.
* Run the map through a hacked version of map2dif to export the .dif with transparent materials.
* If your engine's been properly modified (only takes maybe 30 lines of code), you should get transparent .difs!

Things I have left to do:
* Allow for per-window transparencies (currently, it uses the alpha channel of the texture).
* Enable an option for environmental mapping/reflection (could be a lot harder than I think)
* Allow for breaking of glass


A question, while we're on the topic: Are we allowed to distribute the full (edited) tool source? If not, it's going to be a bit of a pain to release this as a resorce, unless I just distribute the binary. Once I get the legality of this issue worked out, I should be able to compile and release this for other teams to use.

Any suggestions / comments? Let me know! :)

-Corvi

#1
10/20/2002 (6:13 pm)
Wow, this is great news. The lack of transparency has always been a shortcoming of the .dif format. Good work man. Now what I need is a max2dif plug-in. :)
#2
10/20/2002 (6:57 pm)
Very good news!
Great job.

Eric
#3
10/21/2002 (12:19 am)
You rock, Corvidae!! :) (btw., I've tested the code, and it works like a charm! finally, transparent windows in our DIF buildings... :))
#4
10/22/2002 (2:21 pm)
James,

A few months ago I posted a way to do UT-style polygon lights (the light beams) with the hacked transparency version of Torque (See this thread).

It's related to some of what you are doing, and I thought might interest you. Collision detection and lighting (it would still block light like a wall) are the two speedbumps now that you have transparencies. Of course, a step further would be some sort of "lightbuilder" tool in QuArK. ;-)

Anyway, I thought I'd pass that on to you in case it sparked some interest.

BTW, it sorts properly? Was that tough to do?

Eric
#5
10/23/2002 (8:51 pm)
Yeah, Eric, that's what I've been running into. I've been working on and off on trying to get the light transmittal to work. I've managed to turn the transparent entities into portals and detail brushes (the way they were originally), but not both at the same time; it gives an error with a brush being coplanar with a portal, which is a Bad Thing. =/

If I can't get it worked out in the next couple days, I'll post the version where they're detail brushes and the code that includes the portals and see if someone else can figure it out. Maybe if I just change the lightmap calculation to ignore transparent brushes... but that won't work if you have windows on the exterior of a .dif and want them to pass light in... bleah. I might have to have someone else work on it. :)

If any licensees want to see what I have so far, drop me a mail and I'll send you the code, no strings attached.
#6
10/24/2002 (4:46 am)
Making windows the same as portals makes sense. Why mess with detail brushes? The only reason for them, that I know of, is to make it so it won't fragment any polygons it touches.

Are you trying for a stained-glass effect? Where the light would be filtered by the glass?

Eric
#7
10/24/2002 (11:18 am)
Portal brushes don't show up at all in-game, while detail brushes do. It seemed a logical approach to extend detail brushes to make them able to be transparent, but that has the light propagation problems I talked about earlier. It's easy enough to make portals for windows, but those don't have collision detection or textures and are fully transparent all the time.
#8
10/24/2002 (11:30 am)
Ahh... I was under the impression it was the null that made the portal invisible.

Eric
#9
10/24/2002 (12:20 pm)
Nope... I'll post some screenshots when I get home from work, if you'd like. It's possible to render them with 'setInteriorRenderMode(7)' in the console (as colored quads), so the information IS in the .dif. However, making it draw in interiorRender.cc with the right texture and other parameters isn't something I'd like to do. In addition, portals are only 2D (flat quads), so making them render as-is would be less-than-optimal IMO.

I think I might have a solution, though. If I can somehow pull all the transparent detail brushes out of the processing, let the lightmap generator/BSP filler do their thing, then just stuff them back into the .dif at the very end, I should get around the detail/portal coplanar problem (as only one exists in the working geometry at a time). I'll have to try that and see how it works.
#10
10/25/2002 (3:19 pm)
James, I can't find the link somehow. Could you send the code to me? (desmond.fletcher@usm.edu)

Also, this appears to require a new "trans" entity in QuArK/WC ??
#11
02/20/2003 (5:25 am)
thanks heaps for the help on the glass issue all, after reading this thread, i've just about figured out the glass problem.

i'll be trying out your last idea aswell if possible, james. Could be a nice workaround for letting the light through properly. nice idea.