View Full Version : Rendering Lightmaps

09-02-2003, 06:29 PM
Now that I have entities working with my Quake III BSP engine it would be nice if my engine looked as good as Quake III's, the problem is when a texture is rendered you cannt see threw it. Many textures like the textures for lights have this problem, there background color is black so I cannt make all black colors invisible because there are other things(floors and such) that do have black and need to be visible. Does anyone know how to make the lighting textures only show the light?

Here is my problem presented in pictures so you can really see the diffrence.

Quake III Screenshot (http://zonkbonk.virtualave.net/Quake3.png)
As you can see in the screnshot the lighting looks nice from all lights around(lamps and far skull light).

NuclearBSP Screenshot (http://zonkbonk.virtualave.net/NuclearBSP.png)
Here as you can see the lights are rendered but you cannt see threw them like in Quake III all you see is black with a little bit of white spots in it. The skull light isnt even seen and the lamps by the jump are just big black squares.


09-03-2003, 12:40 AM
I think that the transparency parameter for each texture are in the .shader files. As far as I remember, the textures that have to be transparent are TGAs.

09-03-2003, 06:13 PM
I cannt find the texture name of the lighting texture. I tryed with radiant but I dont know how to use it. Your idea might be true but itd be nice if I could find the texture name to find out.

09-05-2003, 10:22 AM
I cannt find the texture name of the lighting texture.
You cannot find the lighting texture because it is embedded in the bsp file.
In the Quake3 shader language, it is referred as $lightmap.

What texEnv are you using?

Parsing a q3 map is not just like q2. That strange black quads (light fog) and white quads (launch pads) are because those surfaces have "nolightmap" proprieties. Shader files are here for a reason. If you don't find the lightmap stage, you're better to skip it (I guess the same holds true for the sky).

09-05-2003, 08:56 PM
I realize that most lightmaps are stored in the Quake III BSP file but I did find a few in the /textures/ dir. Im thinking that this might be fixed by impelmenting shader files, know of any good resources on them? My texEnv is glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE).


09-05-2003, 10:09 PM
Nothing CAN possibly show up there. Just think about it: theyre BLENDED... You dont set blending anywhere in your renderer probably. Theyre all shaders... this is probably a scroll / scale effect ( cant remember ) and gl_one gl_one blending.

[This message has been edited by Dtag (edited 09-06-2003).]

09-06-2003, 10:34 AM
Ya im going to need to load the shader files. Know of any good resources, ive only got the q3radint man and the shader man from idsoftware. Would you happen to know if I load all the shader files in the /scripts dir?

09-06-2003, 10:51 PM
You need to create a cache so you parse all shader files and store which shader is located in which file. So later when you load the map and it requests shader x, you can look up in which file shader x is

09-07-2003, 08:26 AM
When it comes to lighting (and layering) you typically don't BLEND; you typically MODULATE (multiplication) or ADD (addition).

The fixed-function pipeline implicitly uses this model of lighting:

Lights add together to form brightness. Brightness modulates with colormap to form colored surface. Then specular highlights add to the surface to form shinyness.

You could do worse than starting by emulating this using texturing only. (Later per-fragment models use things like spherical harmonics for both illumination and radiance transfer, but forget about that for a while until you know the basics.)

PS: you also seem to load or apply textures upside-down, and upload them as RGBA when their in-memory format is BGRA.

09-07-2003, 11:05 AM
Yes as jwatte said, your textures are upside down and the wrong color fomat. That upside down Quake III texture on the bridge there should be red. http://www.opengl.org/discussion_boards/ubb/smile.gif

Anyway, I came across this engine with source called the Diesel Engine. It can render Q3 maps pretty much perfectly (it looked exactly the same as Q3 to me). Here is it's website: http://www.stud.tu-ilmenau.de/~amigo/ Check it out.


09-07-2003, 12:08 PM
it seems to me you aren't parsing any shaders.don't forget that the whole Q3 engine is built on them.