0
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ What is your criteria for best? Fastest execution? Easiest to code? Fewest number of edge cases that cause visual artifacts? There's rarely a single best answer. \$\endgroup\$ – Pikalek Nov 29 '16 at 4:30
  • 1
    \$\begingroup\$ Possible duplicate of How can I draw outlines around 3D models? \$\endgroup\$ – Aaganrmu Nov 29 '16 at 8:52
2
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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.
\$\endgroup\$
  • \$\begingroup\$ As an alternative to the second option, one could first draw the object in wireframe mode with increased line width with single colored shader, and then draw it with a normal shader. \$\endgroup\$ – HolyBlackCat Nov 29 '16 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.