Working with view-space material maps. Also known as matcap-shading (greetings @ParadoxStudio), but I guess Pixologix will sue me if I call them so to advertise my game wink instead of processing the per-vertex normal for the cylinder hull (like ParadoxStudio), I calculate a per-pixel normal, knowing that the hull is cylindrical. That way, I get a per-pixel view-space normal, which I can use to fetch the view-space material map. It works nice! And is fast!



The caps are btw. quads:



I evaluate the per-pixel object space-position and clip the pixel, if it is outside the uniform circle. This technique guarantees me a perfect rendered circular cap + it reduces the amount of polygons by the half + a static amount of +4 polygons.

[EDIT] Plus, I store the diffuse in RGB channel, the specular & glow part in A, so that I can modulate with that grey material arbitrary colors!:



Last edited by HeelX; 07/25/12 21:47.