-
Notifications
You must be signed in to change notification settings - Fork 59
Stage Lighting
Forge can edit and save the light_set_param.bin from a stage's render folder. Forge will also label most of the values for easier editing. You can read more about editing param files in Editing Param Files. The above render uses the lighting from fig_photo3
.
Stages can have up to 16 different light groups used for stage models. Each light group contains 4 diffuse lights and has an associated fog color. Character lighting is found under the Misc
group. The fresnel lighting in the Misc
group affects fighters and stage models.
- Character Lighting
- Diffuse color
- Ambient color
- Fresnel Ground/Sky Colors
- Shadow Parameters
- Some character lights
- Stage light sets 0 - 15
- Fog sets 0 - 15
Diffuse lighting uses a directional light source. The color and intensity of the light is calculated using HSV values from the light_set_param.bin. The light is a simple directional source, so a single vector (direction) is used.
The diffuse lighting is separated into a diffuse and ambient component. A half lambert creates soft diffuse shading, similar to techniques used in TF2. The brightness of the half lambert term is used to blend between the diffuse and ambient colors, similar to the blending used with hemisphere lighting.
// simplified example code
// N = normal, L = light vector
halfLambert = dot(N, L) * 0.5 + 0.5;
diffuse = mix(ambientColor, diffuseColor, halfLambert);
Hemisphere lighting combined with fresnel creates a rim lighting effect with control over the ground and sky colors. Hemisphere lighting blends between the sky and ground color based on the world normal of the object. Multiplying the hemisphere lighting calculation by one minus the angle between the world normal and the view vector creates the “rim” effect. The sky and ground angles can be used to rotate the fresnel lighting.
// simplified example code
// I = view vector, N = normal, L = light vector
hemiBlend = dot(N, upVector) * 0.5 + 0.5;
hemiColor = mix(groundColor, skyColor, hemiBlend);
fresnel = hemiColor * pow(1.0 - dot(I, N), exponent)
Specular lighting controls the color and intensity of the Blinn-phong specular term.
The exponent can be either isotropic (NU_specularParams) or anisotropic (NU_reflectionParams). Specular lighting uses a directional light source. The color and intensity of the light is calculated using HSV values from the light_set_param.bin. The light vector and color are used to perform the specular calculations in the shader. The angle can be changed to rotate the specular light.
// simplified example code
// I = view vector, N = normal, L = light vector
halfAngle = normalize(I + L);
specular = pow(dot(N, halfAngle), exponent);
Distance based fog provides a sense of depth to stages. The object’s color is blended with the fog color based on the distance between the object and the camera. Farther objects have a more intense fog. NU_fogParams controls the minimum and maximum intensities and distances for the fog effect. The fog color and brightness is calculated from HSV values in the light_set_param.bin.
The stage lighting settings for Forge's viewport can be found under View > Render Settings
and View > Stage Lighting
. The Stage Lighting UI contains tabs for character lights, stage diffuse light sets, and area lights. The render settings can toggle stage lighting on/off. You can open the area_light.xmb
or light_set_param.bin
files individually or by using File > Open Stage
.
The character lighting tab contains the diffuse/ambient light and the hemisphere fresnel light from the first group of the light_set_param.bin. Note that the fresnel light affects stage models as well.
This light controls the diffuse and ambient color for character models. The colors use HSV. The diffuse/ambient color gradient is rendered in the color preview square.
This light controls the ground and sky color for the hemisphere fresnel lighting. The colors use HSV. The sky/ground color gradient is rendered in the color preview square.
The left list displays all of the light sets from 0 to 15. The right list displays each of the 4 lights in the selected light set. There are 64 diffuse lights for stage models in total, but most will be unused. Selecting a particular light will display the color and rotation for the selected light. The settings can be edited using the textboxes or sliders. The colors use HSV. Angles are in degrees. The lists and values are updated every time a light_set_param is opened.
Displays the color gradient, rotation, scale, and position values for all of the area lights for the stage. Not all stages use area lights, so the list may be blank. The UI is still a WIP at the moment.
The ceiling color functions almost identically to the diffuse color for regular directional lights. Note that colors use RGB instead of HSV.
The ceiling color functions almost identically to the ambient color for regular directional lights. Note that colors use RGB instead of HSV.
Controls the XYZ coordinates of the center of the area light region.
Controls the size of the area light region. The area light only brightens character models inside the area light region. Colors will blend between regions that overlap based on the distance.