Line 34: |
Line 34: |
| == Fragment Lighting Equation == | | == Fragment Lighting Equation == |
| There are two lighting equations: One for the primary color and one for the secondary color. Both of them are given in section 3.2.2 of the "Kazakov and Ohbuchi" source below. In addition, the fragment lighting can be set up to write to the alpha channel of the primary or secondary color depending on view angle and a LUT. The equations used can be found here: http://mathb.in/64690 | | There are two lighting equations: One for the primary color and one for the secondary color. Both of them are given in section 3.2.2 of the "Kazakov and Ohbuchi" source below. In addition, the fragment lighting can be set up to write to the alpha channel of the primary or secondary color depending on view angle and a LUT. The equations used can be found here: http://mathb.in/64690 |
| + | |
| + | Some common setups include: |
| + | |
| + | {| class="wikitable" |
| + | !Model |
| + | !LutD0 |
| + | !LutD1 |
| + | !ReflectionLuts |
| + | !Geometry factors |
| + | !SpotlightLut |
| + | |- |
| + | |Blinn-Phong |
| + | | Input: N dot H, Contents: x^s |
| + | | -- |
| + | | -- |
| + | | Disabled |
| + | | Spotlight setup or no-op |
| + | |- |
| + | |Cook-Torrance |
| + | | -- |
| + | | Input: N dot H, D(x) |
| + | | Input: V dot H, Contents: F(x) |
| + | | Enabled |
| + | | Spotlight setup or no-op |
| + | |- |
| + | |Schlick-like |
| + | | -- |
| + | | Input: N dot H, Contents: Schlick Z(x) |
| + | | Input: V dot H, Contents: F(x) |
| + | | Enabled |
| + | | Input: cos phi_i, Contents: Schlick A(x) |
| + | |- |
| + | |Subsurface scattering (not entirely sure) |
| + | | -- |
| + | | Input: N dot V, Contents: Transmittance by angle |
| + | | Input: L dot N, Contents: Reflectance by angle |
| + | | Disabled |
| + | | Spotlight setup or no-op |
| + | |} |
| + | |
| + | s is the specularity factor for Blinn-Phong. |
| + | |
| + | Spotlight setup means input -L dot P and contents spotlight falloff. |
| + | |
| + | F and D can be found in http://inst.cs.berkeley.edu/~cs294-13/fa09/lectures/cookpaper.pdf |
| + | |
| + | Schlick Z and Schlick A are defined in http://www.cs.virginia.edu/~jdl/bib/appearance/analytic%20models/schlick94b.pdf . |
| + | |
| + | The Fresnel LUT can be used to, for example, blend two colours according to how oblique the view angle is, or to simply additively blend white onto fragments with an exponential falloff, resulting in rim lighting. |
| | | |
| == Fragment Lighting Output == | | == Fragment Lighting Output == |