I want to select the best way to draw outline of 3d human like object and what would be the best way to draw outline for this kind of objects. I found about stencil buffer based methods, geometric shader based methods and toon shader based methods is one if this is good if so which method. or is there any other best way to draw a outline.
One way would be to draw the object or character you wish to outline by itself into a depth-only buffer. Then you could run an edge detector on the depth buffer to find the edges of the object. Finally, take the resulting edge image and overlay it on the scene.
Apart from your suggestions about the geometry shader, stencil buffer, and the previous answer's edge detection methods, there are other methods which could work for you.
- Draw your object into a texture with a single color, which will be your outline color, blur it, and draw it behind your object. This will produce a smooth outline.
- Just draw your object twice. The first time it is with a single colored shader which also extrudes vertices along the normal vector, and front face culling (keep the back faces). The second time you draw it, use the normal shaders. This can produce incorrect results (holes in the outline) when there are per-face normals instead of per vertex normals.