CHAPTER 3

image

Textures and Lighting

In this chapter we will cover two topics that are fundamental to producing realistic scenes, texture and lighting. Specifically, we will

  • discuss what textures are and how to apply them
  • show what texture options are available and how to configure these
  • use multiple textures in a shader
  • present a basic lighting model
  • create a directional light shader

By the end of the chapter, we will produce the textured and lit mesh on the right of Figure 3-1.

9781430239963_Fig03-01.jpg

Figure 3-1 . Left - No texture or lighting; Right - both texture and ...

Get Beginning WebGL for HTML5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.