Skip to Main Content
Programming WPF, 2nd Edition
book

Programming WPF, 2nd Edition

by Chris Sells, Ian Griffiths
August 2007
Intermediate to advanced content levelIntermediate to advanced
864 pages
25h 52m
English
O'Reilly Media, Inc.
Content preview from Programming WPF, 2nd Edition

Lights

A 3D model can incorporate any number of light sources. It should include at least one so that you are able to see the objects in the model. In practice, you might want to add a few—a single light source can produce a somewhat stark appearance. WPF offers four different kinds of light.

Tip

Although lights form part of the model—the base Light class derives from Model3D—they are not visible. They affect only the way in which other elements in the 3D scene are rendered. If you want a bright-looking object to be visible, representing the light, you would need to add one or more 3D shapes to provide that appearance.

AmbientLight

The simplest light source is AmbientLight. This provides an even illumination of all objects in the scene regardless of their location or orientation. Example 17-13 shows an AmbientLight.

Example 17-13. AmbientLight

<AmbientLight Color="White" />

The only property to set on an ambient light is Color. This property is present on all lights, and it indicates the color of the light emitted by the source. Note that the Color property determines not just the color of illumination, but also the intensity—White is the brightest color; a darker color such as Gray will provide less illumination. Figure 17-18 shows the results. This makes it clear that you would not normally use an AmbientLight as your only source of illumination. The sphere rendered in this example is the same one shown in Figure 17-14, but in that earlier figure, we could see reflected highlights and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming C#, 4th Edition

Programming C#, 4th Edition

Jesse Liberty
Programming C# 10

Programming C# 10

Ian Griffiths

Publisher Resources

ISBN: 9780596510374Supplemental ContentErrata Page