Lights and Camera

A 3D scene usually requires some light. If you don't have any light in a 3D scene, you'll still be able to see the figures you've created, but they won't have any color, and the only reason you'll see them is because they're usually displayed against a white background. Different types of light are available in WPF 3D, but for this first program, I'll stick to the simplest, which is a class named AmbientLight:

<AmbientLight Color="White" />

The AmbientLight class inherits the Color property from the abstract Light class, and it's white by default, so if you want white light you don't even have to include the attribute:

<AmbientLight />

Early in this chapter I described the three types of WPF 3D cameras. For this first example, I ...

Get 3D Programming for Windows® 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.