Light Volumes
Hello, I''ve been spending the past couple days working on my 3d engine, which I am quite proud of, even though it is nothing compared to most. Now, I''m using Q3 BSPs as indoor maps, so I can use Q3Radient to make my maps. I''ve been searching the net but I just can''t find out any information on this. I have all the faces working and textures and lightmaps, but how do I get light volumes to work? I was wondering if anyone had any info on this, or could push me in the right direction. Thanks in advance.
I haven''t implemented lightvols yet, but im sure you know that the Lightvol struct consists of 3 bytes for directional color, 3 bytes for ambient color, and 2 bytes for directions. And as far as I know its a fixed grid of 64x64x128 lightvols in the level. I have also heard that in Q3TA they made it a variable size. My guess would be to see the model or whatever you are illuminating with the lightvols is, and possibly interpolate between the nearest lightvols to create smoother transitions between each "cube"
Note, this is all just theory, I''ve never implemented it.
~Llama
Note, this is all just theory, I''ve never implemented it.
~Llama
Thanks, that helped me a lot visually in my head. The only question I have left is how do I tell which light volume is the one that goes with the part of the grid that the model is in.
well if you use the bounding box of the level you can tell how many units the level is in all 3 directions, and i guess then you can divide by the number of lightvols in each direction. and that will give you 3 unit:lightvol ratios.
That should help. btw, the level''s bounding box is in the bbox member of model[0]
~Llama
That should help. btw, the level''s bounding box is in the bbox member of model[0]
~Llama
Okay, I know I must seem like an idiot, but I have one final question. I have my light volume grid set up by using the bounding box. Now I have come across what I am hoping to be my final problem. Since my models coordinates are based on world coordinates, and not the light volume grid, how would I convert them to that grid? I have tried a lot of over complicated things and have not had any luck with any of them. Any help would be great. Thank you.
I'm still trying to figure out how I can tell which Light Volume an entity is in. This is my current attempt to figure it out, its my best idea I have so far.
Just to explain a bit, I'm using float[3] as my vertices. I'm dividing the vertices by two so they fit with the scale I made my maps. That works, but not right. It seems like the lighting is off or something. I'm getting the current light volume by doing this, I'm hoping this is the right way, but I can't find any info on it anywhere.
Also, with the light volumes, this may just be a problem with my code, but when my entity does move around, he changes lighting abruptly, like from completely lit, to dark. Anyways, please help me somebody. Thanks in advance.
Edited by - Lunatic Raven on February 4, 2002 8:13:16 PM
float cx = Entity.pos[0]/2 - (Map.models[0].mins[0]/64);float cy = Entity.pos[1]/2 - (Map.models[0].mins[2]/128);float cz = Entity.pos[2]/2 - (Map.models[0].mins[1]/64);
Just to explain a bit, I'm using float[3] as my vertices. I'm dividing the vertices by two so they fit with the scale I made my maps. That works, but not right. It seems like the lighting is off or something. I'm getting the current light volume by doing this, I'm hoping this is the right way, but I can't find any info on it anywhere.
float cr = Map.lightvols[(int)((cz * Map.ny * Map.nx) + (cy * Map.nx) + cx)].ambient[0];float cg = Map.lightvols[(int)((cz * Map.ny * Map.nx) + (cy * Map.nx) + cx)].ambient[1];float cb = Map.lightvols[(int)((cz * Map.ny * Map.nx) + (cy * Map.nx) + cx)].ambient[2];
Also, with the light volumes, this may just be a problem with my code, but when my entity does move around, he changes lighting abruptly, like from completely lit, to dark. Anyways, please help me somebody. Thanks in advance.
Edited by - Lunatic Raven on February 4, 2002 8:13:16 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement