3D Lightmaping

Started by
6 comments, last by NLDEV 19 years, 10 months ago
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.
Advertisement
Define "3D lightmapping". Do you mean lightmapping with 3D textures ?
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.
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]
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.
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.
The idea of 3D lightmap textures for lighting dynamic objects is definitely interesting. However, in practice, how would you actually implement this ?
Let`s say we have a 3d texture of dimensions 32x32x32 containing information of light intensity at each voxel of space. Also, let`s 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 wouldn`t be a problem to store the light direction at each voxel into separate array. But how do you actually light the dynamic model ? We can`t use directional lights, since if the model had a long triangle spanning over 4 or 6 voxels, the results would be disappointing.
Point lights aren`t an option too, since we`d need to have them 32x32x32. It might be an option with Pixel shaders, but we`d have to render the dynamic model voxel after voxel (I assume, we`d already have sorted the model`s triangles by voxels). Wouldn`t that be damn slow ?

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

VladR
Avenger 3D game (Last update MAR-26)

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

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]

This topic is closed to new replies.

Advertisement