Context
Shader I made during my INRIA research internship while in my second year. This was the first time I programmed in GLSL and my first approach to real time rendering in general.
This shader was done in a week, most of it done on instinct without prior training. While this shader seems pretty simple to me, I really enjoyed thinking and trying out my ideas.
Technical Details
The objective was to make a real time mecha anime style shading that would require very little work on the part of the artist. As such, the model used for these tests has flat color textures, in order to showcase the shading and minimize the model creation process.
- The shading is done using a bidimentional toon ramp, with the x and y axes mapped to the diffuse and specular coefficient of a blinn phong model respectively.
- Each pixel of the toon ramp used the 3 color channels to encode a value : bloom, saturation multiplier, and lighting.
- In order to achieve a right balance of detail, the outlines were made using both the normal buffer and Z-Buffer. Three outlines are computed as follows :
- The silhouette, using a coarse Z-Buffer. This is then dilated to emphasize this specific part.
- The outline, using a fine Z-Buffer. This is added as is.
- The relief, using a fine normal buffer. This is then lightened before adding.
- A bloom buffer is computed from specifically illuminated parts (such as cameras) and especially lit areas (as specified by the toon ramp), reduced in size, blurred, and scaled back to original proportions in order to speed up the computation (this bit was taken from a Gamasutra article).
- The beams render a mostly white texture to the output buffer, and a colored one to the bloom buffer in order to mimic the shading used in anime
I made a document detailing the process, algorithm, and possible improvements and uses of the shader.
Downloads