-
Notifications
You must be signed in to change notification settings - Fork 6
Doc_Halo1_DirectionalLightmaps
Welcome to this tutorial on creating directional lightmaps for Halo Custom Edition using OpenSauce.
To follow this tutorial you will need:
- Halo CE v1.10 installed
- The Halo Editing Kit installed
- OpenSauce 4.0.0 installed with the OS HEK and OpenSauceIDE features included
- 3ds MAX
- OpenCOLLADA for 3ds MAX
Directional lightmaps (or Radiosity Normal Maps) are a technique developed by Valve for the source engine which allows a static lighting setup to use normal maps.
In Halo, the lightmaps you are used to contain lighting data that is accumulated using the surface normal of the BSP, and because the lightmap only contains data from a single direction normal maps cannot be applied.
Directional lightmaps on the other hand uses 3 sets of lightmaps, with each lightmap accumulating lighting data from a different direction. These 3 lightmaps represent a rough approximation of the light in a hemisphere around each texel, which can then be sampled using a normal map to create normal mapped static lighting.
To create these lightmaps you will need to use an external lighting method using 3ds MAX or Maya. This tutorial does this using 3ds MAX.
In OpenSauce 4.0.0 onward, OpenSauceIDE contains a new model extraction tool which exports your models to the COLLADA format.
First we need to export our BSP.
- Open OpenSauceIDE
- Open the model extractor tool under the Tools menu.
- Set your tags and data directories.
- Change the model type to scenario_structure_bsp.
- Set the extension you are using for your bitmaps.
- Tick overwrite files.
- Tick render mesh and lightmap sizes.
- Set the lightmap multiplier to the size you want you lightmaps to be multiplied by (or leave it at 1).
- Select Add Job and choose the BSP to export.
NOTE: The model exporter does NOT export bitmaps. You will need to export those yourself using another program.
Next we need to export our scenario. This will export all of the GBX models that are used in the scenario and will create COLLADA files that instantiate those models.
- Open OpenSauceIDE
- Open the model extractor tool under the Tools menu.
- Set your tags and data directories.
- Change the model type to scenario.
- Check all of the Extraction flags.
- Select Add Job and choose your scenario.
- Wait for all jobs to be completed.
When you installed the OS HEK a MAXScripts director was added to your Halo CE directory. Inside that folder is the RenderLightmaps script that you will be using to create your directional lightmaps.
- Start 3ds MAX.
- Run the RenderLightmaps.ms script via the MaxScript menu.
- Right click your top UI bar and select Customize.
- Change the category to Render.
- Find "Render Lightmaps" in the list and click-drag it to your top UI bar.
This should now persist between sessions.
To import your models you will need to have the latest version of OpenCOLLADA installed. This is because the build in COLLADA plugin is ass and barely works.
- Go to File -> Import and change the "Files of type" to "OpenCOLLADA (*.DAE)"
- Navigate to your scenario tag's relative location in your data directory.
- Import your BSP.
- Repeat for the scenario-scenery.dae, scenario-device_controls.dae, and such.
You will now have all of your model's imported.
NOTE: Because we are using COLLADA we can now have the lightmap UV's in channel 2 of the BSP meshes. So you will only import one set of BSP meshes.
To clean up the imported shaders (do a quick render and the textures will be washed out):
- Go to the hammer tab at the right hand side and select MAXScript.
- Run the MaterialFixer.ms script.
- Select "Material Fix" in the drop down menu.
- Select everything in your scene and press "Fix Materials".
Add lighting to your scene as you see fit. Once finished you can render your lightmaps.
- Using "Select by Name", select your BSP meshes in order from 0 to whatever, ignoring the transparent meshes object with -1 as it's index.
- Open the Lightmap Renderer (the button added to your UI previously).
- Select Setup Objects. This will add render to texture elements to your meshes for baking the lighting data.
- Select Import Bitmap Sizes and choose the lmsz file created for your BSP. This will set up the target texture size for each mesh.
- Modify padding and bitmaps sizes as you see fit.
- Select a directory to save your lightmap plates to (for instance a "lightmaps" folder in your scenario's data directory).
- Select a directory to save your raw lightmap's to (for instance a "lightmaps\raw" folder in your scenario's data directory).
- Select Render.
NOTE: Lightmap plates are bitmaps that have all of the individual lightmaps added to them in the correct order with a 1px blue border around them.
You now have your BSP's lightmap plates. The lightmaps in them may look a bit odd but that is intentional as the 3 component lightmaps had their normals skewed to accumulate light from a different direction.
Because the lightmap plates are set up with 1px of blue between all of the lightmaps you can just run them through tools bitmaps command to create your lightmap tags. You may want to open each tag and change the usage to "light map" and the format for each bitmap to "r5g6g5" (which required a re-run in tool) but it isn't critical.
The last steps to add the lightmaps to your map are as follows:
- Open your scenario in OS Guerilla.
- Add a BSP Modifier entry for the relevant BSP
- Add a Lightmap Set
- Point the lightmap tag references to the relevant bitmaps.
- Save and compile your map using build-cache-file-ex.
- Play your map!
-
Wiki Home
- Halo 1
- FAQ
- Getting Started
- Related Forum Threads (Legacy)
- Post-Mortem
- Gamers
- Modders
- Server Hosts
- HTTP Server
- Map Download
- Programmers