The first part of this
document has been dedicated to impressive rendering techniques.
This second part will present you more common shaders. Those shaders are all
implemented with GLSL and integrated in the Bonzai Engine.
This effect is very simple. Instead of using a
constant alpha (~ surface transparency) over all the surface, we uses a local
alpha stored in a texture. This information can be stored in the alpha component
of the diffuse texture, but there is lot of other ways.
For this screenshot, I've used a diffuse texture to get the rgb color. A second
texture, the opacity texture, is used to get the local alpha value. This value
is stored in the red component of the texture. This texture is below the
screenshot.
Opacity Mapping
Opacity texture pattern
Here is a screenshots of this technique applied to the spawn model. Classic
rendering of this model, ie with per-vertex lighting, can be seen here.
The body and the cape are shaded with double sided per pixel lighting and a normal map. Notice
the local highlights and mesh details increased.
Spawn model rendered with normal mapping
The view ray is reflected on the object surface (a
teapot here). The reflected vectors is used for the texture look-up in a
a cube map texture. A cube map textures is a texture made of 6 textures, each
texture for a side of a cube (+x, -x, +y, -y, +z & -z). Depending on the vector,
one of the 6 textures is selected for the color look-up.
Cube Map Reflection
This effect is similat to the cube map reflection. Instead of reflecting the
view ray, it is refracted
depending on the surface internal/external indices. The refracted vector is used
in the same way for the cube map texture look-up.
Cube Map Refraction
Note: The cube map used for this screenshot is
the same than the one used for the cube map reflection screenshot.
The view ray reflection is done similarly to the cbe map reflection shader. But,
instead of using a cube map textures (ie ~ 6 textures) we only uses a single 2D
texture. So the look-up is little bit different here. The reflected vector is
used to generate a vector suitable for making a sphere map texture look-up.
Sphere map reflection
Well, all the thing are explained in the previous shader screenshots, see here
the result :
Sphere map refraction
The F40 model uses different kind of shaders, all presented previously. You can
see the huge improvement on the rendering.
The tires are rendered with normal mapping for the tires to add roughness on the
flat surface. A sphere map reflection shader is apply to practically all parts
of the car. An opacity map is used for the top of the windscreen and the grids
located on the front and rear bumpers.
F40 with & without the use of shaders
The body of the zippo is renderer with using a normal
map for light calculation and a reflection.
The animation loop of the picture below :
- Body with diffuse color.
- Body with Reflection mapping
- Body with Normal mapping
- Body with Normal mapping + Reflection mapping
Zippo: Normal + Reflection mapping
Last modified on 17/07/2010 | |
Copyright © 2004-2012 Jérôme JOUVIE - All rights reserved. | http://jerome.jouvie.free.fr/ |