What platform would you run Quetoo on if it was on Steam?:

Torn Glory, deluxe edition

Some screens showing off deluxe and bump mapping on Cardo's Torn Glory. The effect is intentionally overdone so that it's evident in still images. I owe LordHavoc for guiding me through this implementation, and taking the time to point out defects and shortcomings in my approach. Thanks very much, LH.

September 12, 2008 - 08:50am

looks pretty nice, reminds me a nexuiz a bit. where did the bump maps come from?

September 12, 2008 - 10:09am

It's a combination of two techniques, one of which is relatively unknown (at least, that's my impression). LordHavoc described it to me as "deluxe mapping." To take advantage of bump mapping, parallax, or whatever kind of per-pixel lighting you want to do, you need light direction information. Ideally, you want this information in "tangent space" (the XYZ coordinate system centered at each vertex) to simplify the lighting calculation per-fragment. It's very difficult to calculate all of this information in real-time, especially given the number of light sources that Quake .bsp's typically have (a hundred point lights in PVS at any given spot is not unheard of). However, the vast majority of light sources in a Quake .bsp are stationary, meaning that it should be possible to pre-compute the lighting directions and store them in tangent space coordinates.

Deluxe mapping is an extension to the radiosity compile stage of the .bsp file, in which not only the static light colors are accumulated (lightmap), but also the normalized lighting direction at each lightmap sample point. This directional information can be encoded in texture format, where XYZ directional values become RGB "color" values. Storing this information as a texture simplifies sending it over to the GPU; you just bind your "deluxemap" texture, re-use the lightmap texture coordinates, and let GL's rasterization provide each fragment with it's lighting direction.

So you take your diffuse sample, your lightmap sample, your deluxemap sample, and your normalmap sample at each fragment, do some fancy dot products and exponents, and tada, you have fairly convincing bump mapping.