jahrain
January 7th, 2008, 06:18 AM
Due to several requests, I decided to dig through some old back up disks and find that old lightmap extraction tool I started a long time ago and release it to the public. I never finished it. But its in a usable state. I was planning on adding the feature of extracting and placing scenery objects and such on the map for accurate texture baking, as well as setting the shader properties of each surface to reflect the actual bsp itself. I never got around to doing that, so all I have here is just a modded version of my bsp extractor that extracts the bsps with the UVs from the lightmaps.
Its up to you to figure out what all you can do with this tool.
Link to file (http://jahrain.com/stuff/bsp_lightmap_extractor.rar)
Also, read the readme before asking anything.
Hek BSP lightmap extractor
by Jahrain
NOTE: THIS TOOL IS UNSUPPORTED AND INCOMPLETE.
I am releasing due to several requests. What this does is extract the map BSP geometry from BSP tags with the lightmap UVs applied to them after radiosity has already been run. With this, you can import the geometry into an application such as Maya, or 3ds max and use the texture baking feature export your own lightmaps for a map. Lighting can be more customizable with this tool, as well as much high quality and resolution than HEK's radiosity.
Instructions:
Extraction:
Load up your scenario_structure_bsp tag into the app via File -> open.
Click Convert!
Wait for it to finish processing the file, then save the .obj file.
Lightmap baking:
NOTE: I will not go into detailed instructions for this. I assume the user of this tool already knows how to use the texture baking feature of what ever application this will be baking lightmaps. If you don't know how, google for tutorials.
First, load up your original lightmap bitmap tag in guerilla.
Take note of each bitmap size and their index. The obj file is grouped according to its corresponding lightmap index. When you bake the lightmaps, you want the size of each lightmap bitmap to be consistently scaled. If the size of one of the original bitmap is 64x128, in the texture bake options, set it to that same size, or any proportional power of 2 size if you want higher resolution lightmaps. BE SURE TO USE A CONSISTENT SCALE FOR EACH BITMAP!!! Make sure each individual group has its own texture baking set and name them by their its size and lightmap index.
Next, set up the lighting in the map to be consistent with your skybox. Add individual lights, or illuminated surfaces as well so that they may also emit light onto the map.
Place any scenery models you have in the map onto the geometry as well so that they may cast shadows.
Batch bake all your texture bake sets, then apply them to each surface to test how they look.
Compiling bitmaps:
Create a large blue (0,0,255 or 0000FF RGB color) sheet document in either mspaint of photoshop (just an empty document, with a pure blue background). Its size should be large enough to have each bitmap placed on the blue sheet with at least 2 pixels in between and around the edges. For example, if you have 4 bitmaps, each of 128x128, your blue sheet should be at least 524x132 to fit all of the bitmaps with a 2 pixel thick border.
Next copy paste each bitmap file onto the blue sheet. Order them so that the top left most bitmap is the first index, and the bottom right most bitmap is the last index. IT IS VERY IMPORTANT THAT YOU ORDER THEM BY LIGHTMAP INDEX OR ELSE THEY WILL NOT BE APPLIED PROPERTLY TO YOUR BSP!!! Its best to just line the up vertically in on your blue sheet regardless of size. MAKE SURE EACH BITMAP HAS AT LEAST 2 PIXELS OF BLUE INBETWEEN AND AROUND THE BOARDER OF THE BLUE SHEET OR ELSE IT WILL NOT COMPILE PROPERLY!
Save the blue sheet into what ever bitmaps folder you have for the map.
Using tool, compile the bitmap. It should create a single bitmap, just like your lightmap bitmaps. You may want to use 16bit uncompressed for the format so you don't have lossy lightmaps. Also, set the usage to Lightmaps. Be sure to recompile the bitmap.
Replace your old lightmap bitmap tag with your new one, or change the reference in the structure bsp tag.
Load your map in sapien to test how it looks. If anything is off, back track until you find the issue. The most common mistake is not ordering your bitmaps properly in your blue sheet. Also, ensure that your bitmap count in the bitmap tag matches the old lightmap bitmap. If any is missing, that’s not good. If it crashes sapien, then you probably didn't compile it correctly. If most things look good, but there is a black jaggies or lines on the lightmap texture seams, go back to your baking options and enable color bleeding.
I WILL NOT PROVIDE ANY FURTHER SUPPORT FOR THIS APPLICATION. DO NOT USE THIS TOOL OR METHOD FOR LIGHTMAPPING UNLESS YOU KNOW WHAT YOU ARE DOING!
Its up to you to figure out what all you can do with this tool.
Link to file (http://jahrain.com/stuff/bsp_lightmap_extractor.rar)
Also, read the readme before asking anything.
Hek BSP lightmap extractor
by Jahrain
NOTE: THIS TOOL IS UNSUPPORTED AND INCOMPLETE.
I am releasing due to several requests. What this does is extract the map BSP geometry from BSP tags with the lightmap UVs applied to them after radiosity has already been run. With this, you can import the geometry into an application such as Maya, or 3ds max and use the texture baking feature export your own lightmaps for a map. Lighting can be more customizable with this tool, as well as much high quality and resolution than HEK's radiosity.
Instructions:
Extraction:
Load up your scenario_structure_bsp tag into the app via File -> open.
Click Convert!
Wait for it to finish processing the file, then save the .obj file.
Lightmap baking:
NOTE: I will not go into detailed instructions for this. I assume the user of this tool already knows how to use the texture baking feature of what ever application this will be baking lightmaps. If you don't know how, google for tutorials.
First, load up your original lightmap bitmap tag in guerilla.
Take note of each bitmap size and their index. The obj file is grouped according to its corresponding lightmap index. When you bake the lightmaps, you want the size of each lightmap bitmap to be consistently scaled. If the size of one of the original bitmap is 64x128, in the texture bake options, set it to that same size, or any proportional power of 2 size if you want higher resolution lightmaps. BE SURE TO USE A CONSISTENT SCALE FOR EACH BITMAP!!! Make sure each individual group has its own texture baking set and name them by their its size and lightmap index.
Next, set up the lighting in the map to be consistent with your skybox. Add individual lights, or illuminated surfaces as well so that they may also emit light onto the map.
Place any scenery models you have in the map onto the geometry as well so that they may cast shadows.
Batch bake all your texture bake sets, then apply them to each surface to test how they look.
Compiling bitmaps:
Create a large blue (0,0,255 or 0000FF RGB color) sheet document in either mspaint of photoshop (just an empty document, with a pure blue background). Its size should be large enough to have each bitmap placed on the blue sheet with at least 2 pixels in between and around the edges. For example, if you have 4 bitmaps, each of 128x128, your blue sheet should be at least 524x132 to fit all of the bitmaps with a 2 pixel thick border.
Next copy paste each bitmap file onto the blue sheet. Order them so that the top left most bitmap is the first index, and the bottom right most bitmap is the last index. IT IS VERY IMPORTANT THAT YOU ORDER THEM BY LIGHTMAP INDEX OR ELSE THEY WILL NOT BE APPLIED PROPERTLY TO YOUR BSP!!! Its best to just line the up vertically in on your blue sheet regardless of size. MAKE SURE EACH BITMAP HAS AT LEAST 2 PIXELS OF BLUE INBETWEEN AND AROUND THE BOARDER OF THE BLUE SHEET OR ELSE IT WILL NOT COMPILE PROPERLY!
Save the blue sheet into what ever bitmaps folder you have for the map.
Using tool, compile the bitmap. It should create a single bitmap, just like your lightmap bitmaps. You may want to use 16bit uncompressed for the format so you don't have lossy lightmaps. Also, set the usage to Lightmaps. Be sure to recompile the bitmap.
Replace your old lightmap bitmap tag with your new one, or change the reference in the structure bsp tag.
Load your map in sapien to test how it looks. If anything is off, back track until you find the issue. The most common mistake is not ordering your bitmaps properly in your blue sheet. Also, ensure that your bitmap count in the bitmap tag matches the old lightmap bitmap. If any is missing, that’s not good. If it crashes sapien, then you probably didn't compile it correctly. If most things look good, but there is a black jaggies or lines on the lightmap texture seams, go back to your baking options and enable color bleeding.
I WILL NOT PROVIDE ANY FURTHER SUPPORT FOR THIS APPLICATION. DO NOT USE THIS TOOL OR METHOD FOR LIGHTMAPPING UNLESS YOU KNOW WHAT YOU ARE DOING!