Skip to main content
GameDev.net gamedev.net
🔒 Locked

Quake bsp lightgrid

Started by JokerX Apr 8, 2006 at 5:50 PM 2 replies 1.9k views
Original Post
JokerX
JokerX
In quake3 bsp map it is lump called Lightvols. It contains uniform grid of lighting informations. It would be nice to use this information to light up dynamic objects. Lightvols make up a 3D grid whose dimensions are: nx = floor(models[0].maxs[0] / 64) - ceil(models[0].mins[0] / 64) + 1 ny = floor(models[0].maxs[1] / 64) - ceil(models[0].mins[1] / 64) + 1 nz = floor(models[0].maxs[2] / 128) - ceil(models[0].mins[2] / 128) + 1 I wonder how to use this formulas. How can I figure out dimensions of the lightgrid and particular cells?
Zakwayda
Zakwayda
Although it takes a little digging, you can find all this in the Q3 source code. I think the dimensions of individual cells are right there in your example (64x64x128), and the dimensions of the grid as a whole can be deduced from these values and the dimensions of the world (models[0]) bounding box.

The lighting effect on vertices of models is computed via interpolation, based on the position of the model relative to the lightgrid cells around it. The code that performs these calculations can be found (I'm pretty sure) in tr_light.c.
JokerX
JokerX
From where can I download Q3 source code?

I found this
http://www.idsoftware.com/business/techdownloads/
but there's seems to be no code that handles bsp map rendering.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.