• What is your GameDev Story?

Archived

This topic is now archived and is closed to further replies.

3D Lightmaping

This topic is 5350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey, this may be old, but I''ve just read about 3D lightmapping. It looks like an interesting technique, and I am wondering if any of you have attempted it. If you have, how practical have you found the method? What kind of speed penalties did you incur? Thanks in advance.

Share on other sites
Define "3D lightmapping". Do you mean lightmapping with 3D textures ?

Share on other sites
quote:
Original post by Yann L
Define "3D lightmapping". Do you mean lightmapping with 3D textures ?

Well, lightmapping with a volumetric lightmap. Instead of having only lighting information for a wall, for instance, every point in the scene will have a predetermined (obviously) light value assigned to it. I read about the technique (not very much to read) on the Humus site, but I was looking for other opinions.

Thanks.

Share on other sites
I think Quake 3 used a light grid to illuminate its dynamic meshes (along with regular lightmaps for the actual level geometry) which could be what you mean. However I have no idea how it was actually used, and google seems to turn up unhelpful modding info.

I assume actually generating the light grid would be much like for regular lightmapping, but I'm not sure how you could efficiantly draw models with the correct intensities from the light grid in an efficiant manner.

Edit: Best I could find. Although I think emulating it with positioned lights wouldn't give you very good results when a character is across a shadow boundary (say, legs in shadow and top illuminated). I wonder how well you could treat each grid sample as a point light and use a vertex program to interpolate the values inbetween them...

[edited by - OrangyTang on May 27, 2004 9:44:18 PM]

Share on other sites
I think you actually mean lightmapping with 3D textures. Basically, it''s a light intensity grid over the scene.

The visual results can indeed be very nice, especially for static lights when using a global illumination solution. It''s a good method to light dynamic objects moving through a static environment. You can get quite impressive results, if you combine this with volumetric fog, for example.

But there are problems, of course. First of all, and this is related to what OrangyTang mentioned, that grid doesn''t contain any directional information about the incident light. It only contains information about the light intensity at a specific point in space, but it doesn''t tell you from where the light came. This directional component is very important for accurately lighting dynamic objects in the grid (think Lambertian equation).

You could however encode directions into each grid point, in addition to the intensity. Conceptually, a little cubemap per grid point. Since that doesn''t work very well in practice, a 3D texture of spherical harmonic coefficients could be used to get the directional information.

Another possibility is to only encode shadow information in the grid, while keeping the (discrete) standard perpixel lighting computation for each light source. That would basically give you soft shadows for static direct diffuse lights on moving objects (but without self shadowing, and without volumetric shadows).

But keep in mind, that a 3D texture consumes a lot of memory, so don''t make it too big.

Share on other sites
Thanks for your insights, I''ll keep them in mind. I am thinking that the memory requirements for any large scene would be too costly for the 3D texture, as Yann made clear. In a real game situation, I think that the memory could be better used.

Share on other sites
The idea of 3D lightmap textures for lighting dynamic objects is definitely interesting. However, in practice, how would you actually implement this ?
Lets say we have a 3d texture of dimensions 32x32x32 containing information of light intensity at each voxel of space. Also, lets assume, for easy visual control, that this 3d texture is inside a cube where there are different colored lights at each side of the cube - this way we can see, if the relevant part of the dynamic model is lighted correctly. But how are we going to decide the correct light direction at each voxel from all those lights, when one voxel can be illuminated by 4-6 lights ? Probably it would be easier just to do with single light.

So, in the case of single light, there wouldnt be a problem to store the light direction at each voxel into separate array. But how do you actually light the dynamic model ? We cant use directional lights, since if the model had a long triangle spanning over 4 or 6 voxels, the results would be disappointing.
Point lights arent an option too, since wed need to have them 32x32x32. It might be an option with Pixel shaders, but wed have to render the dynamic model voxel after voxel (I assume, wed already have sorted the models triangles by voxels). Wouldnt that be damn slow ?

And, most of all, would that effect even be that awesome ?

Avenger 3D game (Last update MAR-26)

Share on other sites
quote:
YannL:
But there are problems, of course. First of all, and this is related to what OrangyTang mentioned, that grid doesn't contain any directional information about the incident light. It only contains information about the light intensity at a specific point in space, but it doesn't tell you from where the light came. This directional component is very important for accurately lighting dynamic objects in the grid (think Lambertian equation).

actually, that's not the case with the Q3 example OrangyTang gave, they did store both intensitites and light directions (vector encoded as their md3 format normals, two bytes for spherical coords, one for theta, and the otherone for phi).

in each lightgrid voxel, you basically had 3 things:
ambient rgb, directional rgb, and the light vector.
each of those being the values at the center of the lightvol.

as the lightgrid always enclosed the entire level (don't remember the size, I think it was something like x=64, y=64, z=128, something like that, nevermind...), you could very easily index directly the 8 surrounding lightvols of an object (or a vertex).
then just perform basic trilinear filtering on those 3 values to get the ambient term, the light vector and light color. and that's it, you had all you needed to compute your lighting...

Edit: spelling

[edited by - sBibi on May 28, 2004 1:22:09 PM]

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 28
• 16
• 10
• 10
• 11
• Forum Statistics

• Total Topics
634112
• Total Posts
3015566
×