Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Phil Carlisle, posted on November 09, 2000

Image Description, by Phil Carlisle

Well, an IOTD to show the "almost" working HL rendering code :))

The map is avanti.bsp from the latest version of TFC. Currently, having a few problems with the lightmapping, I am almost certain the texcoords for the lightmap are correct, the lightmaps themselves are now ok (I had a problem with gluScaleImage and gluBuild2DMipmaps causing a bug in the lightmaps for non power of two lightmaps (i.e. if it had to scale the lightmaps up to 16x16 from say, 9x13, it screwed the whole thing up. I wrote a little function to do the scaling and all was better (although there is still some weird "banding" artifacts I havent gotten to the bottom of yet).

This thing is more of an experiment than anything useful. It'll be used to write out bsp files into 3ds format (along with multi textures for lightmaps), partly as an exercise in exporting INTO 3ds max, and partly because I kinda like lightmapped levels and know a lot of keen mappers.

One weird thing. Seems that Ive somehow inverted all the coords for the maps, as the whole thing is in reverse (so all the textures read backwards :)) I kinda like the effect tho.

If anyone has any experience with bsp loaders and has come across a lightmap "banding" syndrome, and a fix for it, please pass the info on.


Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

November 09, 2000, 05:18 AM

Looks a bit like the game Thief (or was TFC standing for that ?)

Anyway, looks fine to me. Hope your banding syndrome gets well soon ;)
Will it eventually become a part of a game engine (fast enough ?) or is it only for use as an export tool ?

Keep up the good work !

Phil Carlisle

November 09, 2000, 06:44 AM

Its intended to make it easier for people to make me stuff for the game library I am working on. (The library is for massively multiplayer games -, my main motivation is to be compatible with game content that people can get very cheap tools to create (i.e. milkshape etc), thus I can license the engine to mod creators (which are a pretty big resource).

The speed of that level was pretty slow (I am brute forcing it in the export app, just to preview the level), in game it will be significantly faster due to the octree.

TFC is team fortress classic, its an add on for halflife. This map is a halflife map released with a recent TFC update (probably should have made that more clear in the blurb, I'm just too familiar with the acronyms and didnt realise others might not know them :)).


Shattered Soul

November 09, 2000, 08:31 AM

Well Phil, it looks really neat. When I was looking at it, I had that late night ambience sounds around me, so it looked and felt especially neat.

I recon we need some really normal ambient sounds from night time in games today, not just super duper sound effects, or animals creaping in the background that are totally out of place.

Well done.

Shattered Soul

Mark Friedenbach

November 09, 2000, 10:12 AM

Very cool, Phil!

Which coordinate system are you using (right-hand or left-hand)? This could be the source of the mirror effect you are seeing.

Some TFC history: It was originally a really popular mod for Quake1 done under the name of Team Fortress by the poeple that would later come together to form Valve and make Half-Life (no need to explain the importance of this little game). After the release of Half-Life, Valve (being the really cool guys [and girls] that they are) released a remake of their old quake mod and added a "Classic" to the end of the name. Up until Counter-Strike came out, it was the most popular Half-Life "mod" played.


November 09, 2000, 10:19 AM

Very nice image; impressive. It looks like HL to me. Keep the good work up =)

William van der Sterren

November 09, 2000, 10:58 AM

The relation between TFC and Valve is different than you describe it. Valve was actually founded by an ex-MS employee (Gabe Newell) who wanted to have fun with his money.
They licensed the Q1 engine, tried to make Half-Life (HL), weren't satisfied, started from scratch again, and made it anew.
A few people from the TFC Q1 mod team (John Cook, and Robin Walker) were hired by Valve half-way the development of HL.

Originally, Valve promised a TFC successor dubbed TF2 as a free upgrade to HL owners. Upon discovering the potential (and/or the effort), they changed their mind, and announced TF2 as a product (for early '99). TF2 development got delayed and delayed etc., and Valve ended up providing TFC to keep gamers satisfied, to test engine improvement for TF2, and to keep the press buzzin' about HL (lacking other products to release).
Today, TF2 still isn't released (reportedly shipping early 01), and reportedly using a home made engine instead of the Quake2 licence.



November 09, 2000, 11:26 AM

Counter-Strike all the way!!! :)


November 09, 2000, 12:38 PM

Hey, very nice rendering! By the way, you can see that skybox edge a bit...



November 09, 2000, 12:47 PM

It Isn't and edge, it's a flare thingy


November 09, 2000, 12:48 PM

What do you mean by "banding" on the lightmaps? Sometimes cards will produce strange effects if you try and use very small textures, which can happen if you make individual textures for each lightmap. The solution there is to pack a bunch of lightmaps onto a single texture (which also results in better performance).



November 09, 2000, 01:13 PM

Phil, that screenshot is looking pretty sweet. I'd also like to exactly know what you mean with "banding". I think you are already using the many lightmaps in one bigger lightmap approach, since that should be the way the lightmap data and tex coords are stored in the BSP file. So, what might help is using a different blending mode ("Multiply by 2" comes to mind) or adjusting the gamma (which results in more dynamic range and therefore less banding).

- MK42

The Wolf

November 09, 2000, 01:17 PM

Very Nice, I played that level of TFC (my favorite). Do you know of any good BSP loader source code or toolkit (preferrably openGL, but DX is ok too)? which one do you use?


November 09, 2000, 01:42 PM

"I think you are already using the many lightmaps in one bigger lightmap approach, since that should be the way the lightmap data and tex coords are stored in the BSP file"

Quake 1/2 BSPs don't actually store texture coordinates; they store parameters for planar texture mapping. I'm assuming Half-life BSPs are the same way, although I could be wrong.


Phil Carlisle

November 09, 2000, 04:22 PM

Ok, here we go :))

Valve - Team Fortress..

The guys who started valve (gabe newell and Mike Harrington (cant remember, think its his name) moved from MS and started a game company. They started halflife by licensing the Q1 engine.

Sometime into development, they were playing Team Fortress for quake, and were impressed enough to hire the main developers for it (from australia). These guys went on to produce TFC for valve while the rest of the guys concentrated on Halflife.

Now the focus is on producing TF2 for the TFC guys, whilst the others work on other things.

I can tell you now, the valve guys are all VERY talented individuals, and are pretty nice people to boot. Most have come from the Quake scene, indeed a lot of em have come from quake editing tools as well as quake mods.

The Wolf: I wrote the loader, thats what the shot is for, its part of a project to export maps to 3d studio.

Banding: The best way I can think to explain it, is that when certain faces are lightmapped, they appear slightly darker than others, also you can see straight lines sometimes where one lightmap meets another and doesnt quite match up. If you look at the main lightmap for the building in the middle left of the picture on the floor, you'll notice there is a part of the shadow thats almost straight, this is where one faces lightmap is supposed to match up to another, but doesnt.

As for storing the lightmaps in a single texture, no, I dont do that yet, I didnt see any need to do it for my exporter, all I do is scale all lightmaps up to 16x16 (using my own scale because gluScaleImage has a bug) and render them. The lightmap data in Halflife files is exactly the same as in quake2 as far as I can tell. You calculate the min-max of the face extents of the face to get the width/height of the lightmap, then just load that as a texture and apply a similar mapping as the texture coords (there are some differnt things here tho).

The skybox was drawn with blending still enabled from the lightmap pass, so its not drawn right (but I liked the mood so I didnt fix it for the screenshot), I still need to overbright the base textures so that the lightmaps dont dull them as much.

If you want to see what I mean about the banding.. take a look at this shot.

I'm toying with the idea of releasing the code for this, but I'd hate to release the code in its present buggy state. Its certainly nothing special as it is, so Ive no qualms about releasing it, but I'd prefer to actually fix the problem first.

If anyone has any working Quake2 rendering code, and would like to share, please drop me a mail (I am figuring just seeing a working Q2 code would show me whats wrong).

Thanks for the comments though guys. Its nice to share sometimes :))



November 09, 2000, 07:09 PM

Maybe try not scaling the lightmaps?


November 12, 2000, 07:50 AM

Hi Phil!

You can find some Quake2 rendering code (OpenGL based I think) at


This thread contains 16 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.