Dragon Project Description

My project was to modify an existing dragon mesh by giving the dragon realistic scales with reflective color.


Normal Mapping

The main technology I used was normal mapping. This is a form of texture mapping where you use an image file to generate varying normal vectors so that a smooth surface appears bumpy. This is done in tangent space, where the curent surface is mapped to be even with the x-axis and z-axis so that the normal is pointing along the y-axis. The color data read from the texture image is treated as a rgb vector and resized to be a vector with values that range from -1 to 1.

Skybox and Reflection

The skybox itself was a lot more challenging to create than the reflection on the dragon. If you are trying to make a skybox, remember to use GL_CLAMP_TO_EDGE and glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) to have a more realistic looking background. Also, if you are having trouble with glitches on the edges of each face of your cube map, use jpg files and the SOIL library to import them.

Skyboxes are cubemaps that are drawn onto a large object that encompasses your environment. I then used that same cubemap to draw the reflection on the dragon. I calculated a reflection vector between the camera and the dragon to get the pixel color from the cubemap. My reflection vector is the result of the equation max(0.4 * I - (0.4 * dot(N, I) + sqrt(1 - 0.4 * 0.4 * (1 - pow(dot(N,I), 2))) * N, 0) where N is the normalized normal vector and I is the normalized distance vector from the camera to the pixel. The value 0.4 is 1/2.5, which is the angle of refraction for diamond, and so simulates a diamondlike material. I eventually discovered that this vector can also be calculated by calling refract().

The Dragon

After modifying the dragon and splitting it into multiple shapes in Maya, I used normal mapping to create textured scales.

Next, I added reflection of the surrounding skybox.

Finally I added some color and had a dragon.

Here is a close up of some of the scales to show the detail normal mapping provides. This is actually the inside of the dragon to show more angles in one image.

What I Learned

I mostly learned a lot about texture mapping. I have a strong understanding of tangent space and how the shading data can be stored in an image for a normal or a displacement map. I learned a lot about cube maps and combining lighting with textures. I also spent a lot of time modifying the original dragon mesh in Maya and converting it to a obj file. I know have a huge appreciation for fbx files and feel more confident modifying and modeling objects in Maya.

References

Bump vs Normal vs Displacement Mapping
Cubemaps and Skyboxes Tutorial
Bumpmapping Overview
Normal Mapping