Subtitles section Play video
-
The Mesh Renderer.
-
To render a mesh we need 2 components.
-
The Mesh Filter
-
and the Mesh Renderer.
-
When importing a mesh model
-
Unity will automatically create a
-
prefab asset that includes a mesh filter
-
component to hold the mesh data for the model
-
and a mesh renderer component
-
to render this mesh data in our scene.
-
The mesh renderer does not
-
render skinned meshes.
-
Skinned meshes are used for rendering characters.
-
Characters are animated using bones
-
and every bone effects part of the mesh.
-
If the model is skinned,
-
Unity will create a skinned mesh renderer
-
for the imported model instead.
-
Information on skinned mesh renderers
-
can be found in another lesson.
-
Each mesh asset needs it's own mesh filter
-
and mesh renderer.
-
If the model is made of several
-
separate meshes each will have it's own
-
prefab game object with it's own
-
mesh filter - mesh renderer pair.
-
The mesh filter holds the mesh data of the model
-
and passes it to the mesh renderer
-
for rendering on screen.
-
The mesh filter component
-
has only one property and this is
-
a reference to the mesh asset itself.
-
The mesh renderer takes the mesh model
-
data from the mesh filter and renders
-
it in our scene at the position,
-
rotation and scale defined by
-
the object's transform component.
-
The mesh renderer has properties that
-
define how the model will be rendered
-
or drawn in our scene.
-
These fall in to 3 broad categories.
-
Shadows, materials and light probes.
-
With shadows, if there is a shadow
-
casting light on the object we can
-
set whether the mesh renderer will
-
cast and or receive shadows.
-
Next there is a list of materials
-
to render the object with.
-
Unity needs at least one material assigned
-
to the mesh renderer to be able to draw
-
that object in our scene.
-
For more information on materials themselves
-
see the appropriate lesson.
-
Meshes imported in to Unity can
-
use multiple materials, if the mesh
-
model has been setup to do so
-
in the original modelling application.
-
The mesh renderer maintains a list
-
simply called Materials for all materials
-
used by the mesh model.
-
Often this list only contains one material.
-
This materials list should have one slot
-
in the list for each sub mesh
-
on the mesh model.
-
If any given slot has no material assigned
-
the associated mesh will show pink
-
indicating that the material is missing.
-
Lastly, there are light probes.
-
A mesh can be lit by light probes.
-
Light probes sample the lighting of a scene
-
at a point and cast that light on
-
on to the rendered mesh.
-
This is often used in conjunction
-
with light mapping.
-
Light probes light dynamic objects
-
such as characters that would not receive
-
baked lighting information from a light map.
-
To use light probes,
-
the Use Light Probes option must be enabled.
-
For more information on light probes,
-
including the Anchor Override property,
-
please see the appropriate lesson
-
and documentation link below.