x


How do I draw lines on the edges of meshes?

I simply want to draw custom lines on the edges of meshes, for example on a cube, while hiding the segments that are invisible to the game's camera. To create a toony look. A bit like the standard toon shader that's included, but I also want to draw lines on edges that you see in the middle of the mesh, not only at the currently visible borders.

more ▼

asked Jan 16 '10 at 09:43 PM

Micha Lewtak gravatar image

Micha Lewtak
130 7 7 10

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

The standard toon shaders approach to drawing the outlines is to draw the backfacing triangles of the shape in the outline color, and scale them up a little using the normals. This won't work for drawing edges in the middle of the mesh, though.

One approach to do that is to render the normals to the screen color buffer (using shader replacement, and a custom shader to render the normals to the screen), and then, using an image post-processing effect, to detect pixels where the normals are very different from the neighbor pixels, and draw those in the outline color.

more ▼

answered Jan 17 '10 at 03:14 PM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
9.7k 7 23 102

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1652
x491
x336
x56

asked: Jan 16 '10 at 09:43 PM

Seen: 2944 times

Last Updated: Jan 17 '10 at 01:26 AM