Tuesday, 27 December 2011

Final Major Project: Self Illuminating Textures

During my research into current video games and the techniques they use in their textures. Whilst looking at the textures used in Super Mario 3D Land one of the techniques used to give the game this constant bright and colourful look was the use of a Self Illuminated Shader. When researching into Self Illuminated textures I found out several things, first was that the shader is a part of the Unity Family meaning that it's applied in the game engine rather than the modelling program (in my case maya), secondly there are a variety of types of Self Illuminated Shaders. As described by Unity the Self-Illuminated Shader works as such:

This shader allows you to define bright and dark parts of the object. The alpha channel of a secondary texture will define areas of the object that "emit" light by themselves, even when no light is shining on it. In the alpha channel, black is zero light, and white is full light emitted by the object. Any scene lights will add illumination on top of the shader's illumination. So even if your object does not emit any light by itself, it will still be lit by lights in your scene.

Below here is a list of the different types of Self Illuminated Shaders and their properties:

Self Illuminated Vertex-Lit:
Assests Needed: One Base Texture & one Illumination Texture with alpha Channel for Illumination Map.

This shader is Vertex-Lit, which is one of the simplest shaders. All lights shining on it are rendered in a single pass and calculated at vertices only.

Because it is vertex-lit, it won't display any pixel-based rendering effects, such as light cookies, normal mapping, or shadows. This shader is also much more sensitive to tesselation of the models. If you put a point light very close to a cube using this shader, the light will only be calculated at the corners. Pixel-lit shaders are much more effective at creating a nice round highlight, independent of tesselation. If that's an effect you want, you may consider using a pixel-lit shader or increase tesselation of the objects instead.

Self Illuminated Diffuse:
Assests Needed: One Base Texture & one Illumination Texture with alpha Channel for Illumination Map.

Diffuse computes a simple (Lambertian) lighting model. The lighting on the surface decreases as the angle between it and the light decreases. The lighting depends only on the this angle, and does not change as the camera moves or rotates around.

Self Illuminated Specular:
Assests Needed: One Base Texture with alpha Channel For specular map & one Illumination Texture with alpha Channel for Illumination Map.

Specular computes the same simple (Lambertian) lighting as Diffuse, plus a viewer dependent specular highlight. This is called the Blinn-Phong lighting model. It has a specular highlight that is dependent on surface angle, light angle, and viewing angle. The highlight is actually just a realtime-suitable way to simulate blurred reflection of the light source. The level of blur for the highlight is controlled with the Shininess slider in the Inspector.

Additionally, the alpha channel of the main texture acts as a Specular Map (sometimes called "gloss map"), defining which areas of the object are more reflective than others. Black areas of the alpha will be zero specular reflection, while white areas will be full specular reflection. This is very useful when you want different areas of your object to reflect different levels of specularity. For example, something like rusty metal would use low specularity, while polished metal would use high specularity. Lipstick has higher specularity than skin, and skin has higher specularity than cotton clothes. A well-made Specular Map can make a huge difference in impressing the player.

Self Illuminated Bumped:
Assests Needed: One Base Texture & one normal map with alhpa Channel for Illumination.

This shader allows you to define bright and dark parts of the object. The alpha channel of a secondary texture will define areas of the object that "emit" light by themselves, even when no light is shining on it. In the alpha channel, black is zero light, and white is full light emitted by the object. Any scene lights will add illumination on top of the shader's illumination. So even if your object does not emit any light by itself, it will still be lit by lights in your scene.

Like a Diffuse shader, this computes a simple (Lambertian) lighting model. The lighting on the surface decreases as the angle between it and the light decreases. The lighting depends only on the this angle, and does not change as the camera moves or rotates around.

Normal mapping simulates small surface details using a texture, instead of spending more polygons to actually carve out details. It does not actually change the shape of the object, but uses a special texture called a Normal Map to achieve this effect. In the normal map, each pixel's color value represents the angle of the surface normal. Then by using this value instead of the one from geometry, lighting is computed. The normal map effectively overrides the mesh's geometry when calculating lighting of the object.

The Normal Map is a tangent space type of normal map. Tangent space is the space that "follows the surface" of the model geometry. In this space, Z always points away from the surface. Tangent space Normal Maps are a bit more expensive than the other "object space" type Normal Maps, but have some advantages:

  1. It's possible to use them on deforming models - the bumps will remain on the deforming surface and will just work.
  2. It's possible to reuse parts of the normal map on different areas of a model; or use them on different models.
Self Illuminated Bumped Specular:
Assests Needed: Assests Needed: One Base Texture with alpha Channel For specular map & one normal map with alhpa Channel for Illumination

Using the same qualities as the bumped map with these properties on top,

Specular computes the same simple (Lambertian) lighting as Diffuse, plus a viewer dependent specular highlight. This is called the Blinn-Phong lighting model. It has a specular highlight that is dependent on surface angle, light angle, and viewing angle. The highlight is actually just a realtime-suitable way to simulate blurred reflection of the light source. The level of blur for the highlight is controlled with the Shininess slider in the Inspector.

Additionally, the alpha channel of the main texture acts as a Specular Map (sometimes called "gloss map"), defining which areas of the object are more reflective than others. Black areas of the alpha will be zero specular reflection, while white areas will be full specular reflection. This is very useful when you want different areas of your object to reflect different levels of specularity. For example, something like rusty metal would use low specularity, while polished metal would use high specularity. Lipstick has higher specularity than skin, and skin has higher specularity than cotton clothes. A well-made Specular Map can make a huge difference in impressing the player.

Self Illuminted Paralax:
Assests Needed: One base Texture & one normal Map with alpha channel for Illumination Map and Paralax Depth combined.

Parallax Normal mapped is the same as regular Normal mapped, but with a better simulation of "depth". The extra depth effect is achieved through the use of a Height Map. The Height Map is contained in the alpha channel of the Normal map. In the alpha, black is zero depth and white is full depth. This is most often used in bricks/stones to better display the cracks between them.

The Parallax mapping technique is pretty simple, so it can have artifacts and unusual effects. Specifically, very steep height transitions in the Height Map should be avoided. Adjusting the Height value in the Inspector can also cause the object to become distorted in an odd, unrealistic way. For this reason, it is recommended that you use gradual Height Map transitions or keep the Height slider toward the shallow end.

Self Illuminated Paralax Specular:
Assests Needed: One base Texture with alpha channel for specular map & one normal Map with alpha channel for Illumination Map and Paralax Depth combined.

This Shader combines both properties from the Paralax and Specular.

Each of these Self Illuminated Shaders have nice qualities that would add a little more professionalism to any amatuer work. When looking at the examples on the Unity website the best ones that would suit the aesthetic of the game would probably be either Diffuse, Bumped Specular, Paralax or Paralax Specular. Of course until I see the effects of each one I don't know which one would work better then of course there's the render time to factor in. so choosing one will have to be both a choice of what looks best and a compromise of rendertime.

No comments:

Post a Comment