Yup, finally we learnt the "normal map" that Derek mentioned when we did the texture for the first time and Gabriel Olson, the Game Arts teacher I am sitting on mentioned. I had already seen how amazing normal map is to fake your simple object to look like something complicated with detailed texture. However, doing it myself in my renderer program is another thing. It was fun to see the carved word in my cubes.
Normal map in diffuse lightning
Normal map in specular lightning
It's interesting to see that the 'sunken' looks really sunken under specular lightning and the 'raised' word looks more raised than the diffuse lightning. It is also interesting that the UV mapping in Maya is upside-down in some surface. Maya flattened the surfaces on creating the UV map. When I saw it in Maya UV-editor, the UV layout looked like upside-down T. I knew how to fix this however I didn't think it's necessary. The focus of this class the graphics pipeline not the arts :)
I did a little experiment with this normal map. I added normal mapping into my alpha-binary effect and applied it into my floor with hepatica texture. I used CrazyBump, the software Gabe introduced us to make the normal map for this hepatica texture. This is what it looks like:
Can you tell that the leaves look more realistic especially the farthest one
Compare with this?
Yup, my renderer world looks more darker now with new floor. It made sense since the alpha binary clipped some part of the plane. This effect also made some of my entities are floating.

I couldn't tell the differences between the right-handed winding order tangent and bi-tangent or bi-normal and the left-handed one with cube. But with cylinder, I could tell that the "A" of my "Raised" text is really raised in correct winding order than the mesh with different winding order.
Maya Attribute Editor
Left-handed Winding Order TBN
Left-handed winding order mesh - similar to DirectX
Right-handed winding order mesh - opposite of DirectX
Oh, for this assignment I changed my database multi-level sorting. Now the sequence is render state --> vertex shader --> fragment shader --> material --> mesh. This made more sense now since most of the entities use the same vertex shader. Only those with normal mapping using new vertex shader. Also for this normal mapping, I - finally - applied the texture mode in effect file. This texture mode will tell DirectX to set texture for particular effects.
So,
- What is normal map? Simply said, normal map is a clever technique we can use to make our simple object look bumpier (has more geometric detail).
- Why using normal map/why not making the mesh more detail? It is more expensive to render more triangle than using normal map to 'fake' how the flat surface looks in other words to get a more detailed surface.
- What is the differences between bump map and normal map? While bump map tells how height the particular fragment from the original surface, normal map tells the facing direction of the particular fragment.
- How did this normal map working? Even though every surface by theory can only have one normal direction, we can 'add' more normal direction using normal-map texture. This normal-map tells fragment shader how the normal should be changed for every fragment.
- Why normal map is better than bump map? In bump map, we need to move the normal around using the the surrounding fragment's height and figure out how the fragment changing and calculate the normal. With the height we only know how we supposed to change but we don't know the changing direction. We need to know somehow in this fragment, how it supposed to move in direction and position. In other hand normal map tell the direction of each fragment. This is why normal map has better quality and less expensive.
- Why we don't save the normal in texture? In games the object are not static. When the object is moved or rotated, the normal is not good anymore. Also often the texture is often reused texture in many object with different texture detail.
- The idea behind the normal map: given some agreed upon orientation normal, how to make that normal correct regardless the position of the object and the orientation in the world. To achieve this, we need some additional information to tweak the stored normal to get the detailed texture.
- The more the normal rotated to +x direction, the redder the normal map colour. The more the normal rotated to +y direction, the greener the normal map colour. The more the normal rotated to +z direction, the bluer the normal map colour.
- [UPDATE] Technique: For every vertex, we are going to store the normal, the tangent and bitangent in model space. This going to give us the orthonormal three vectors which perpendicular to each other. In vertex shader, each normal will be transformed from model to world and pass those to fragment shader to be interpolated. Then using those normals to create matrix rotation to rotate the normal in normal map. This tweaked normal from texture then can be used as normal vector.
The topic of this assignment is normal and environment maps. We already talked about normal map but we never mentioned about environment maps. I am wondering what this environment map is.
How to see the normal map is correct: The red one looks like coming from right. The green looks like coming from below.
ReplyDelete