|
|
|
The
Viewport3D’s child must be a ModelVisual3D. This has a Content property that
contains the ‘model’ – the set of objects that define the contents of the 3D
scene.
|
|
|
|
The
model is a tree of objects, all of which derive from Model3D. The nodes are
of type Model3DGroup, and the leaves are other Model3D-derived types.
Surfaces are represented as GeometryModel3D objects, lights are Light
objects, and wireframes are represented as ScreenSpaceLines3D objects.
|
|
|
|
A
GeometryModel3D represents a surface in the model. The shape of the surface
is defined by an associated Geometry object, while its surface color or
texture is defined by an associated Material. As with Model3D in the model
tree, an optional transform may be applied.
|
|
|
|
The
reason for separating out the Geometry from the GeometryModel3D is that it
lets us define the actual shape just the once (as a resource) and then reuse
it. We can apply a different Material with each GeometryModel3D, and also a
different Transform to get the shape to appear in lots of different places
with various orientations and sizes.
|
|
|
|
Note
that the ‘resolution’ of your model, in the sense of how densely packed are
the triangles that form its surfaces, is important for lighting. Lighting
calculations are performed at vertexes and then spread over the triangle. So
if you draw a large rectangular surface with just a couple of triangles,
specular highlights won’t look very convincing. You need to put in a lot more
triangles if you want specular highlights to work well.
|
|
|