This section describes fragment lighting.
To read about the methods for calculating fragment lighting and other details, see the separate document Introduction to CTR Graphics.
Fragment lighting is a process that applies shadows on a per-fragment basis to information output from the vertex process.
Complicated lighting can be expressed by utilizing lookup tables.
Fig. 1 Shadow applied on a per-fragment basis to the values for interpolated normal vectors provided as input from the vertex shader.
Note: The quality of the fragment lighting is not affected by the polygon density.
In fragment lighting, the lighting is calculated from the settings for light and material (as based on the information input from the vertex process) and two types of color (primary color and secondary color) are output.
Fig. 2 The process flow up to the output of primary color and secondary color
This section describes the settings for lights and materials when performing per-fragment lighting.
Table 1 The items set each type of light
Categories | Item | Description |
---|---|---|
Light color | Ambient color (environment light) |
The color and alpha values for the light that will effect the ambient color of the material. Set in a fragment light. |
Diffuse color (scattered light) |
The color and alpha values for the light that will effect the diffuse color of the material. Set in a fragment light. | |
Specular color 0 (surface reflected light 0) |
The color and alpha values for the light that will effect the specular color 0 of the material. Set in a fragment light. | |
Specular color 1 (surface reflected light 1) |
The color and alpha values for the light that will effect the specular color 1 of the material. Set in a fragment light. | |
Light orientation | Position | The light position. For fragment lighting, this is set in the world coordinate system. |
Direction: | The light direction. For fragment lighting, this is set in the world coordinate system. By combining the nodes and hierarchies of animations you can inherit values from the top level. | |
Light attenuation rates | Distance attenuation | Specifies how far the light will reach in terms of an attenuation rate Used for point lights and spotlights. |
Spotlight attenuation | Specifies how wide the light will reach in terms of an attenuation rate using a lookup table. Used for spotlights. | |
Highlight adjustments | Geometric factor | Adjusts how specular is entered. Enabled/disabled depending on the material settings. |
Fig. 3 The kinds of lights that can be used for fragment lighting, and how that light spreads.
Note: The more lights you use, the greater the processing load for that fragment.
Ambient light is light that shines evenly on the entire polygon model. For this reason, the light has no parameters for items like direction and attenuation.
Table 2 Items that can be set for each material
Categories | Item | Description |
---|---|---|
Material color | Emissive color |
The overall color illuminating the object. This is set in a material. |
Ambient color |
Color expressing the shaded side of the object. This is set in a material. | |
Diffuse color |
Color expressing the surface "feel" of the object. This is set in a material. | |
Specular color 0 |
Color expressing object highlights. This is set in a material. | |
Specular color 1 |
Color expressing object highlights. This is set in a material. | |
Environment light of entire scene | Global ambient color | Color expressing the ambient light that is blending of all objects in the scene. Set in a fragment light. |
Light Controls | Distribution 0 | Uses lookup table to control highlight shape of Specular color 0. |
Distribution 1 | Uses lookup table to control highlight shape of Specular color 1. | |
Reflection | Uses lookup table to control the RGB color components of specular color. | |
Fresnel | Uses lookup table to control the Alpha component of specular. |
Material color refers to the polygon model color required for fragment lighting calculations.
Five colors can be set.
Fig. 4 Spherical model with light shinning from the upper-left direction
The above figure shows where the various material colors are applied on a a spherical model when light is shinning from the upper-left direction.
Geometric factor is a feature for adjusting how the specular appears.
By using this feature, specular appears weak when it comes in from the front relative to the viewpoint direction, and strong when it comes in from the side.
Geometric factor 0 affects Specular color 0, while Geometric factor 1 affects Specular color 1.
Fig. 5 Difference in appearance when Geometric factor feature is and is not used.
Distribution is a component used to apply changes to the shape of the specular as a secondary color calculation.
The distribution settings are made using a lookup table.
Distribution 0 affects Specular color 0, while Distribution 1 affects Specular color 1.
Fig. 6 Control of specular shape using a look-up table
Reflection is a component used to control the specular color as a secondary color calculation.
Reflection is set using a lookup table.
Fig. 7 Control of specular colors using a look-up table
Fresnel is component used to control the material transparency (alpha value) as a secondary color calculation.
Fresnel is set using a lookup table.
Fig.8 Expressions using Fresnel
CONFIDENTIAL