Master Of Animation, Games & Interactivity
Master Of Animation, Games & Interactivity

Outline drawing in unity:

The basic idea is to draw twice, the first time to draw the character, and the second time to draw the stroke. When drawing a stroke, the vertex shader shifts the vertex by a distance along the normal direction, so that the model outline is enlarged and rendered as a stroke. Use cull front when drawing strokes at the same time. In this way, the overlapping part of the stroke and the character will be culled because it cannot pass the depth detection, ensuring that the stroke will not obscure the character. It is also possible to reverse the order of the two drawing, but after drawing the stroke, you can filter out many pixels drawn by the stroke through depth detection, and the efficiency will be better.

Because the width of the stroke is now constant with respect to world space, after the camera is zoomed in, the display will become thicker. We expect that the thickness of the stroke will remain the same no matter the camera is zoomed in or out. To solve this problem, you can adjust the normal expansion to the distance using NDC space.

About This Work

By Raivis Su
Email Raivis Su
Published On: 30/04/2020