Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found a suitable illumination model myself in the <a href="http://local.wasp.uwa.edu.au/~pbourke/dataformats/mtl/" rel="nofollow">documentation for .mtl files</a>:</p> <pre><code>color = KaIa + Kd { SUM j=1..ls, (N*Lj)Ij } + Ks ({ SUM j=1..ls, ((H*Hj)^Ns)Ij Fr(Lj*Hj,Ks,Ns)Ij} + Fr(N*V,Ks,Ns)Ir}) + (1.0 - Kx)Ft (N*V,(1.0-Ks),Ns)TfIt </code></pre> <p>This is dense and actually has some typos (like <code>Kx</code> and <code>Ft</code>), so I corrected it:</p> <pre><code>I = Ka * Ia + Kd * [sum for each light: (N . L) * Il] + Ks * [sum for each light: ((R . V) ^ Ps) * Fl * Il] + Ks * Fr * Ir + Kt * (1 - Ks) * Ft * It I := surface point's color V := ray direction P := surface point N := surface normal L := light's position - P R := L - 2 * (N . L) * P Ka := surface material's ambient coefficient Kd := surface material's diffuse coefficient Ks := surface material's specular coefficient Ps := surface material's shininess Kt := surface material's transmission coefficient Ia := ambient light color Il := light's color Ir := reflected ray's color It := transmitted ray's color Fl := light's Fresnel coefficient Fr := reflected Fresnel coefficient Ft := transmitted Fresnel coefficient </code></pre> <p>This model makes sense to me, especially after reading <a href="http://www.cgcoach.com/articles/the-fundamentals/cg-lighting-101/" rel="nofollow">Lighting 101</a> -- Phong specular reflection is a performance-minded hack for reflecting light sources, so it's natural to use the same coefficient for specular highlights and reflected rays.</p> <p><strong>There's still one thing I don't understand.</strong> If I don't want to bother with Fresnel terms, I can set <code>Fl</code>, <code>Fr</code>, and <code>Ft</code> to 1. If I want that extra accuracy, though, how would I calculate them in terms of my already-defined variables?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload