Topic: Lightmaps in Jedi Knight
I may have found a way to do lightmaps in JK. A while back, Hellcat was showing off some 3do terrain for team battle. It included shadows that were actually part of the texture. The question came up on whether or not it was possible to use this same process on a whole level.
Yesterday, I realized that this was totally possible, yet extremely inefficient. Consider the Quake III lighting process:
typo- it should say “… from each texel (texture-pixel)
Jedi Knight does not support lightmaps (well duh). But it does however, allow you to scale texture sizes down indefinitely. This means that it is possible to use ultra high resolution textures by splitting them into tiles. Therefore, it is possible to create lightmaps on the textures at extremely high resolutions. But there is no real systematic way of doing this, besides however hellcat did it, which requires 3ds max. Now, JED actually supports texture resolutions up to 1024x1024 and maybe higher. One could complete an entire level, with high-res textures, and omit lighting. Now here comes the cool part:
1. Flag every surface as fully lit.
2. Load this theoretical program. It is 100% non-functional right now. However, there is no reason why it wouldn’t work if someone had the time and knowledge to program it. I did the Windows form in Visual Basic.NET, but I don’t know enough to finish it. I do know exactly how it would work though.
Theoretical Program
First the user would load the .jkl into the program and specify an output directory. Here is an explanation of the other functions:
“Pixels per lightmap pixel” Must be a perfect square or 1. (1, 2, 4, 9, 16, 25, ect…) If 1, the minimum, is selected, the generator would calculate the light intensity for each texel. The lower the number, the longer the generation would take, but would not affect performance in the game at all. Users would probably only set it higher if they had to test it our and didn’t want to wait forever.
“Split hi-res textures into tiles?” This handy function would split all textures over 256x256 into 256x256 tiles after the lightmap process is complete.
“Include things” This would tell the generator whether or not to include things, such as 3dos, in the lightmap calculation.
“Lights (things)” These things would be the lights used in the calculation. This option would not be included in the first version, as 3dos would be a more complex process, especially ones inside a GOB/GOO container.
“Exclude…” These features would prove to be useful in excluding things such as skyboxes, walkplayers, water, and other things that should be fully lit.
How it would work
--------------------------
1. User specifies input and output, sets options, and presses generate.
2. The generator would then enter a loop. If 1 pixel per lightmap pixel was selected, it would attempt to draw a line to each light specified from each texel. If 4, 16, 25, or higher, it would use a square and draw it from the middle. If there is no middle, it would use the texel to the top-left closest to the middle.
3. When the loop is completed, it would search each texture file for anything over 256x256. If it finds any, it splits them up, and change the jkl texture reference accordingly.
4. The entire level is dumped in the output directory, along with potentially hundreds of 256x256 tiles.
Known problems
The most obvious problem is that I don’t have any idea how to program this. I am not asking anybody to do it for me. I a question about editing BMP’s with a program. What I need to be able to do is edit each color value with the program… I remember seeing something like an RGB table in another format, like TGA or RAW, but I forget. Take a look at the contents of a 256x256 bmp file, which I opened with Visual Studio.NET’s binary editor:
Feel free to comment, question, and answer on anything above. Thank you.
------------------
Mystic0's Editing resources
Levels:
Temple of Flames
The Massassi Post Count Summary
"I am the signature virus! Copy me into your signature so that I can take over the world! Moohahahee!"
I may have found a way to do lightmaps in JK. A while back, Hellcat was showing off some 3do terrain for team battle. It included shadows that were actually part of the texture. The question came up on whether or not it was possible to use this same process on a whole level.
Yesterday, I realized that this was totally possible, yet extremely inefficient. Consider the Quake III lighting process:
typo- it should say “… from each texel (texture-pixel)
Jedi Knight does not support lightmaps (well duh). But it does however, allow you to scale texture sizes down indefinitely. This means that it is possible to use ultra high resolution textures by splitting them into tiles. Therefore, it is possible to create lightmaps on the textures at extremely high resolutions. But there is no real systematic way of doing this, besides however hellcat did it, which requires 3ds max. Now, JED actually supports texture resolutions up to 1024x1024 and maybe higher. One could complete an entire level, with high-res textures, and omit lighting. Now here comes the cool part:
1. Flag every surface as fully lit.
2. Load this theoretical program. It is 100% non-functional right now. However, there is no reason why it wouldn’t work if someone had the time and knowledge to program it. I did the Windows form in Visual Basic.NET, but I don’t know enough to finish it. I do know exactly how it would work though.
Theoretical Program
First the user would load the .jkl into the program and specify an output directory. Here is an explanation of the other functions:
“Pixels per lightmap pixel” Must be a perfect square or 1. (1, 2, 4, 9, 16, 25, ect…) If 1, the minimum, is selected, the generator would calculate the light intensity for each texel. The lower the number, the longer the generation would take, but would not affect performance in the game at all. Users would probably only set it higher if they had to test it our and didn’t want to wait forever.
“Split hi-res textures into tiles?” This handy function would split all textures over 256x256 into 256x256 tiles after the lightmap process is complete.
“Include things” This would tell the generator whether or not to include things, such as 3dos, in the lightmap calculation.
“Lights (things)” These things would be the lights used in the calculation. This option would not be included in the first version, as 3dos would be a more complex process, especially ones inside a GOB/GOO container.
“Exclude…” These features would prove to be useful in excluding things such as skyboxes, walkplayers, water, and other things that should be fully lit.
How it would work
--------------------------
1. User specifies input and output, sets options, and presses generate.
2. The generator would then enter a loop. If 1 pixel per lightmap pixel was selected, it would attempt to draw a line to each light specified from each texel. If 4, 16, 25, or higher, it would use a square and draw it from the middle. If there is no middle, it would use the texel to the top-left closest to the middle.
3. When the loop is completed, it would search each texture file for anything over 256x256. If it finds any, it splits them up, and change the jkl texture reference accordingly.
4. The entire level is dumped in the output directory, along with potentially hundreds of 256x256 tiles.
Known problems
The most obvious problem is that I don’t have any idea how to program this. I am not asking anybody to do it for me. I a question about editing BMP’s with a program. What I need to be able to do is edit each color value with the program… I remember seeing something like an RGB table in another format, like TGA or RAW, but I forget. Take a look at the contents of a 256x256 bmp file, which I opened with Visual Studio.NET’s binary editor:
Feel free to comment, question, and answer on anything above. Thank you.
------------------
Mystic0's Editing resources
Levels:
Temple of Flames
The Massassi Post Count Summary
"I am the signature virus! Copy me into your signature so that I can take over the world! Moohahahee!"