Quake 4 & Doom 3: Nested Lights for Volumetric Light Mapping
Posted: Fri May 06, 2011 12:11 am
After playing around in Doom 3's pak000.pk4 I stumbled upon a light shader with two map stages in it. After digging around the web I found an old Doom3world discussion that explains that having two maps in one light shader material definition is less expensive than two overlapping lights as the vertex and shadow calculations are only done once. Armed with this I am proposing a Volume Light Map solution for these engines that does not require any changes to the Interaction Shader.
The process:
1) Use some application to bake a 3D ambient map for your level to a 3D texture
2) Slice the texture into 2D projections and 1D falloffs (based on height)
3) Optimize the number of needed slices by combining parallel brightness values
4) Create a "texture atlas" that has all the slices for both image types
5) Use the scale keyword to only access the needed image within the atlas per stage
So the problem is:
Will anyone create a tool that automates this conversion from 3D texture to texture atlas?
Maybe someday I will be a good enough coder to achieve such a feat but I thought I would throw this possibility out and see if anyone will bite.
You could, of course, manually imagine the needed shapes and falloffs but it would be time consuming...
...and it would require a pretty high IQ...

Code: Select all
lights/My_Custom_Light1
{
{
lightFalloffImage makeIntensity( textures/My_Custom_Light1_Z ) // Falloff Image
{
forceHighQuality
map textures/My_Custom_Light1_XY // Z-Projection Image
zeroClamp
scale num, num
}
}
{
lightFalloffImage makeIntensity( textures/My_Custom_Light2_Z ) // Falloff Image
{
forceHighQuality
map textures/My_Custom_Light2_XY // Z-Projection Image
zeroClamp
scale num, num
}
}
}
1) Use some application to bake a 3D ambient map for your level to a 3D texture
2) Slice the texture into 2D projections and 1D falloffs (based on height)
3) Optimize the number of needed slices by combining parallel brightness values
4) Create a "texture atlas" that has all the slices for both image types
5) Use the scale keyword to only access the needed image within the atlas per stage
So the problem is:
Will anyone create a tool that automates this conversion from 3D texture to texture atlas?
Maybe someday I will be a good enough coder to achieve such a feat but I thought I would throw this possibility out and see if anyone will bite.
You could, of course, manually imagine the needed shapes and falloffs but it would be time consuming...
...and it would require a pretty high IQ...
