Graphics Reference
In-Depth Information
For our current simple model—a lone triangle—it is useful to disable this
optimization and show the back face in a contrasting color, by setting the
BackMaterial property to refer to a solid-red material that we will add to the
resource section with the key RSRCmaterialBack :
1
2
3
4
<GeometryModel3D
Geometry= "{StaticResource RSRCmeshPyramid}"
Material= "{StaticResource RSRCmaterialFront}"
BackMaterial= "{StaticResource RSRCmaterialBack}" />
Figure 6.8: First triangle's back
side, rendered using a uniformly
red material.
As a result, the back face now is visible when the front faces away from the
camera, as shown in Figure 6.8.
Inline Exercise 6.3: In the lab, check the box labeled “Use back material” and
keep the model spinning.
Positions
Index
X
Y
Z
With the first face of the pyramid now in place, let's add the second face, using
the strategy represented in a tabular form in Figure 6.9. Notice that the vertices
shared by the two faces ( V 0 and V 2 ) have separate entries in the Positions array,
effectively being listed redundantly.
0
0
75
0
1
2
3
4
5
-50
0
50
50
0
50
0
50
50
75
0
0
0
50
-50
1
2
3
4
<MeshGeometry3D x:Key= "RSRCmeshPyramid"
Positions= "0,75,0 -50,0,50 50,0, 50
0,75,0 50,0,50 50,0,-50"
TriangleIndices= "012 345" />
TriangleIndices
0,1,2
3,4,5
Inline Exercise 6.4: In the lab, select the “Two faces” model and keep the
model spinning.
Figure 6.9: Tabular representa-
tion of geometric specification of
a two-triangle mesh.
The result appears in two snapshots of the spinningmodel shown in Figure 6.10.
6.2.2 Producing More Realistic Lighting
There is an obvious problem with this rendering: A single constant color value is
being applied to both faces of the model, regardless of orientation. But in a day-
time desert scene, one would expect variation in the brightness of the pyramid's
faces, with a bright reflection from those facing the sun and lesser reflection from
those facing away from the sun.
The use of the artificial construct of nondirectional ambient lighting as the sole
light source produces this unrealistic appearance. In the real world, lights are part
of the scene and the light energy hitting a point P on a surface has a direction (a
vector, represented by the symbol
, from the light source to point P ). Moreover,
the energy reflected toward the camera from P is not a constant, but instead is
based on a number of variables such as the camera's location, the surface's orien-
tation at P , the direction
, the reflection characteristics of the object's material,
and others. In Section 6.5 we will examine a lighting equation that takes many of
these kinds of variables into consideration, but here let's take a high-level look at
one example of a more realistic light source: the point light, which is a geomet-
ric light, having a position in the scene and radiating light in all directions equally
(as shown in Figure 6.11). A point light's presence can introduce a great deal of
variation into a scene via its infinite set of values for
Figure 6.10: Renderings of the
partial pyramid in two distinct
orientations, in an environment
containing only ambient light.
, which ensures that each
point on a surface facing the light receives its energy from a unique
direction.
 
 
 
Search WWH ::




Custom Search