Pro OpenGL ES for iOS

(singke) #1

CHAPTER 7: Well-Rendered Miscellany (^243)
In all of these images, the background is black. Change the coloring of the background
and run. What’s going on in Figure 7-16?
Figure 7-16. Surprise! The shadow is not clipped to the platform.
What’s happening here is that we were cheating when it comes to clipping the shadow
against the platform. With the background black, the part of the shadow that rendered
off the platform was invisible. But now as the background is brightened, you can see the
full shadow. What happens if you need a light background in the first place? Use
stencils to clip around the platform, blanking out any extra part of the shadow that we
don’t need, similarly to the earlier reflection exercise.

Free download pdf