Adding Fog Effects to a Course BMD

Getting started
The following process from here through Creating and editing the material json should not apply to retail tracks, they should all already have fog enabled. Something of note, fog is not a particle, It tints geometry the further away it is. Additionally, fog does not apply to the skyboxes or certain objects so bear these limitations in mind when creating your track. You can sidestep the skybox not being affected by fog by making it the same color as the fog, or making it part of the level geometry.

First, we are going to create a bat so when we convert our model it will use a materials.json file. Create a new txt file in your superbmd folder and name it whatever you want. Open this new txt file and paste the following:

"%~dp0SuperBMD.exe" %1 -m materials.json

pause

Save your txt file, and change the extension from .txt to .bat. Once this is done, it will not need to be repeated. From now on, once you configure your model to use fog you will drag your model onto this bat. (Note: without a materials.json file, your model will not convert so you will need to use an alternative .bat or the superbmd executable until you have your json file)

Creating and editing the material json
You are going to want the model you want to add fog to in the bmd format, so convert it first. Then we need to convert it back through superbmd. Once this is done, delete everything in your folder except the file "bmd_name_materials.json", where bmd_name is the name of your bmd. Once you do this, you want to rename it to "materials.json" and move it to the same folder as your model (Your original model you are converting to bmd). Next, we want to edit the contents of this json to enable the fog using a json editor of your choice. It doesn't matter what you use, however I highly recommend a json editor with a find feature. I will be using Notepad++. We are going to want to press ctrl + f to bring up the search menu, and search for "fog". You are going to go through and replace every instance of the following:

"FogInfo": { "Type": 0, "Enable": false, "Center": 0, "StartZ": 0.0, "EndZ": 0.0, "NearZ": 0.0, "FarZ": 0.0, "Color": { "R": 0.0, "G": 0.0, "B": 0.0, "A": 0.0 },

With:

"FogInfo": { "Type": 2, "Enable": false, "Center": 320, "StartZ": 17529.2969, "EndZ": 200000.0, "NearZ": 5.0, "FarZ": 200000.0, "Color": { "R": 1.0, "G": 1.0, "B": 1.0, "A": 1.0 },

Once this is done, convert your model to a bmd with the bat you created. Now we can move on to the bol.

Editing the bol
The fog data can be found in the header. The only functional fog types are fog types 0 - 4. The fog color is defined by RGB values. 255, 255, 255 is white, 0, 0, 0 is black. Find a color that works best for your track. For fog near and fog far, play with these values and find something that suits your course. For reference, the custom track N64 Choco Mountain uses fog near z 0.0 and fog far z 12500.0



Congratulations, your track now has fog enabled and fully functioning!