Skip to content

Commit ac965c5

Browse files
author
Nick Desaulniers
committed
shading
1 parent c8db99d commit ac965c5

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

flat.jpg

10.4 KB
Loading

index.html

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,56 @@ <h4>Sampling</h4>
551551
imgArrayBufferViewVideoOrCanvas);
552552
</code></pre>
553553
<p>Can be done during initialization for static images.</p>
554-
<p>Must be done during rAF loop for video.</p>
554+
<p>Must be done during requestAnimationFrame loop for video.</p>
555555
<p>Must be done when limited on texture units per draw call.</p>
556556
<a href="examples/texture.html" target="_blank">Example</a>
557557
</section>
558+
<section>
559+
<h2>Warning</h2>
560+
<p>Uploading textures to the GPU can be expensive.</p>
561+
<p>Try to minimize texture swapping between frames.<p>
562+
</section>
563+
<section>
564+
<h2>Shading</h2>
565+
<h4>Interpolation Techniques</h4>
566+
<p>Flat shading - Each polygon has its own color - Disco Ball</p>
567+
<p>Gouraud shading - Normals at each vertex - Mach Bands</p>
568+
<p>Phong shading - Interpolate normals across surface</p>
569+
<img src="flat.jpg"/>
570+
</section>
558571
<section>
559572
<h2>Shading</h2>
573+
<h4>Illumination Models</h4>
574+
<p>Lambert - The shade is the cosine of the angle between surface normal and light vector.</p>
575+
<p>Blinn-Phong - The shade is composed of a specular, diffuse, ambient, and shininess components of the material.</p>
576+
<img src="phong.png"/>
577+
</section>
578+
<section>
579+
<h2>Shading</h2>
580+
<p>All of this can be done with what you now know.</p>
581+
<p>Light directions and material reflective coefficients are buffered.</p>
582+
<p>Calculations done in shaders.</p>
583+
<p>Exercise left to the reader.</p>
584+
</section>
585+
<section>
586+
<h2>Recommended Reading</h2>
587+
<img src="webgl_book.jpg"/><br/>
588+
<p><a href="http://fabiensanglard.net/Computer_Graphics_Principles_and_Practices/index.php" target="_blank">More recommendations</a></p>
589+
</section>
590+
<section>
591+
<h2>Inspiration</h2>
592+
<p>Tony Parasi</p>
593+
<p><a href="http://www.youtube.com/watch?v=me3BviH3nZc" target="_blank">Eric Möller</a></p>
594+
<p><a href="https://github.com/gameclosure/webgl-2d" target="_blanks">webgl-2d</a></p>
595+
</section>
596+
<section>
597+
<h2>Thanks</h2>
598+
<img src="nick_face.jpg"/>
599+
<p>Nick Desaulniers</p>
600+
<p><a href="https://twitter.com/LostOracle" target="_bank">@LostOracle</a> on Twitter</p>
601+
<p>\n on mozilla.irc.org</p>
602+
<p><a href="https://github.com/nickdesaulniers" target="_bank">nickdesaulniers</a> on GitHub</p>
603+
<p><a href="http://nickdesaulniers.github.io/" target="_bank">nickdesaulniers.github.io</a>-&gt; blog</p>
560604
</section>
561605
</section>
562606
</div>

phong.png

50.2 KB
Loading

texcoords.png

27.9 KB
Loading

webgl_book.jpg

10 KB
Loading

0 commit comments

Comments
 (0)