GAME PROGRAMMING
LAB ASSESSMENT – 4
Reg.no:17BCE0369
Name:D.Penchal Reddy
SLOT:L13+L14
7. Texture basics shaded models importing, normal mapping, Bump mapping.(Mixamo)
AIM:
Texture basics shaded models importing, normal mapping, Bump mapping.(Mixamo)
PROCEDURE:
Normal maps are a type of Bump Map. They are a special kind of texture that allow you to add
surface detail such as bumps, grooves, and scratches to a model which catch the light as if they
are represented by real geometry.
STEP1:Normal map (Bump mapping)
A sheet of aircraft metal with details modeled as real geometry.
Depending on the situation it is not normally a good idea to have such tiny details modelled as
“real” geometry. On the right you can see the polygons required to make up the detail of a single
screwhead. Over a large model with lots of fine surface detail this would require a very high
number of polygons to be drawn. To avoid this, we should use a normal map to represent the fine
surface detail, and a lower resolution polygonal surface for the larger shape of the model.
If we instead represent this detail with a bump map, the surface geometry can become much
simpler, and the detail is represented as a texture which modulates how light reflects off the
surface. This is something modern graphics hardware can do extremely fast. Your metal surface
can now be a low-poly flat plane, and the screws, rivets, grooves and scratches will catch the
light and appear to have depth because of the texture.
The
screws, grooves and scratches are defined in a normalmap, which modifies how light reflects off
the surface of this low-poly plane, giving the impression of 3D detail. As well as the rivets and
screws, a texture allows us to include far more detail like subtle bumps and scratches.
In modern game development art pipelines, artists will use their 3D modelling applications to
generate normal maps based on very high resolution source models. The normal maps are then
mapped onto a lower-resolution game-ready version of the model, so that the original high-
resolution detail is rendered using the normalmap.
STEP2: create and use Bump Maps
Bump mapping is a relatively old graphics technique, but is still one of the core methods
required to create detailed realistic realtime graphics. Bump Maps are also commonly referred to
as Normal Maps or Height Maps, however these terms have slightly different meanings which
will be explained below.
STEP3:Surface Normals
Two 12-sided cylinders, on the left with flat shading, and on the right with smoothed shading
In the image above, the left cylinder has basic flat shading, and each polygon is shaded according
to its relative angle to the light source. The lighting on each polygon is constant across the
polygon’s area because the surface is flat. Here are the same two cylinders, with their
wireframe mesh
STEP4: Normal mapping
The colours visible in a raw normal map file typically have a blueish hue, and don’t contain any
actual light or dark shading - this is because the colours themselves are not intended to be
displayed as they are. Instead, the RGB values of each texel represent the X,Y & Z values of a
direction vector, and are applied as a modification to the basic interpolated smooth normals of
the polygon surfaces.
An example normal map texture
This is a simple normal map, containing the bump information for some raised rectangles and
text. This normal map can be imported into Unity and placed into Normal Map slot of
the Standard Shader
The example normal map applied to the surface of the cylinder mesh used above
Again, this does not affect the actual polygonal nature of the mesh, only how the lighting is
calculated on the surfaces. This apparent raised lettering and shapes on the surface are not really
present, and viewing the faces at glancing angles will reveal the true nature of the flat surface,
however from most viewing angles the cylinder now appears to have embossed detail raised off
the surface.
STEP5:normal maps
Normal maps from a 3D application is beyond the scope of this documentation, however the
basic concept is that a 3D artist would produce two versions of a model - a very high resolution
model containing all detail as polygons, and a lower-res “game ready” model. The high res
model would be too detailed to run optimally in a game (too many triangles in the mesh), but it is
used in the 3D modelling application to generate the normal maps. The lower-res version of
model can then omit the very fine level of geometry detail that is now stored in the normal maps,
so that it can be rendered using the normal mapping instead. A typical use case for this would be
to show the bumped detail of creases, buttons, buckles and seams on a characters clothing.
Two examples, one is a simple repeating stone wall texture with its corresponding normal map,
and one is a character’s texture atlas with its corresponding normal map:
A stone wall texture and its corresponding normal map texture
A character texture atlas, and its corresponding normal map texture atlas
STEP6:Bump Maps, Normal Maps and Height Maps
Normal Maps and Height Maps are both types of Bump Map. They both contain data for
representing apparent detail on the surface of simpler polygonal meshes, but they each store that
data in a different way.
STEP7:import Normal Maps
“Texture Type” setting to “Normal Map” in the import inspector
settings.
8. Importing character animation and basic character.(Mixamo)
AIM:
Importing character animation and basic character.
PROCEDURE:
Setting the environment
• The Animations folder will store animations files.
• The Models folder will store any generic humanoid model to test the animations.
Mixamo Animations
If you will use Mixamo animations, log into your account (or register first if you have none,
remember it is free).
Download a simple animation including the model and any Pack. When you download a Pack, a
model will be included with the pack.
Also remember to export the animations in the correct format selecting the FBX For
Unity option:
STEP1: Importing model into Unity
Drag into your Models folder the model you want to use for this testing and be sure it is
configured as Humanoid.
Any Humanoid rigged model will work.
STEP2:Importing Animations into Unity
Processing single Files
This is simply dragging the animations into your Assets folder created before (Animations).
All the animations are .FBX files.
Select the Rig tab:
Change the Animation Type to Humanoid and hit Apply.
Malformed Avatars
If you downloaded the animation without a model, you will probably found problems with the
Avatar Rig. For this reason it is convenient to verify the avatar configuration.
To do this Click the configure option to access the Avatar configuration:
You can see that hands, legs a and feet are not properly aligned
Try to download the animation with a model or use the avatar found inside a Pack.
You can follow the steps described later on the animations packs section to change the avatar.
STEP3:Processing Animation Packs
Unzip the animation file and drag it into the animations folder. I use to keep the folder name for
easy reference.
The pack contains a model an the animations.
Select the model and mark it as Humanoid.
Once completed, select only the animation files (all the animation files together).
At the Rig tab select Humanoid and at Avatar Definition select Copy From Other Avatar.
Drag and Drop the avatar found inside the model included in the pack at the Source field.
Hit Apply and wait. Every animation will be adapted to work as a Humanoid Mecanim
animation.
STEP:4Testing the animation
If you select an animation file you will see on the inspector a generic model based on the avatar
included in the animation file.
Taping on the Play arrow you can play the animation clip.
Finally you can drag your own model inside the inspector window to test if it works properly.