Adding Specular Highlights

Another type of lighting that hasn't been discussed yet is specular highlighting. Specular highlighting makes an object appear “shiny” and much more realistic when being rendered. It's possible to use the lighting objects in the fixed-function pipeline to enable specular highlights; however, these highlights will be calculated per-vertex. This example will show how to accomplish this with the programmable pipeline instead.

Like the other examples in this chapter, this one will be based on an earlier section of code; in this case, the lit cylinder example you wrote in the previous chapter. This code already handles the diffuse lighting case, which should stay in this updated example to show the differences between the ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming 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.