Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

No, I'm not looking for glPolygonMode. I'm searching for a method, possibly a GLSL shader that would produce that retro-style wireframe look for objects. Any suggestions?

Something like Vector Tanks had.

Preferably the solution should work on OpenGL ES 2.0 also.

Any hints and pointers (as long as not NULL) appreciated!

share|improve this question
up vote 10 down vote accepted

Some links of interest:

Baerentzen et al. "Single-pass wireframe rendering"

Nividia Corporation "Solid Wireframe" white paper

edit: I see the first one was already mentioned, sorry!

share|improve this answer
+1 will look into them, seems that is what I wanted :P – Kornel Kisielewicz Sep 6 '10 at 15:33

I would highly recommend using textures, as Dave said. It may be something of a pain, but it would provide much better performance, I think.

You could try searching for edge detection algorithms. If you create your meshes using vertex coloring with solid colors and medium alpha values (for slight transparency), and then use an edge detection shader, it might look good enough. It wouldn't be quite the same, but you might like it even more; or maybe not.

Otherwise you may be looking at a two-pass solution, drawing translucent polygons (again, set the vertex colors to a solid color with a medium alpha value), then setting glPolygonMode(GL_LINE) and tweak glLineWidth as desired (perhaps based on the object distance) and draw the polygons again.

It's a little late and I'm having a hard time reading through this, but a forum discussion points to this PDF: Single-pass Wireframe Rendering. My apologies if it isn't relevant.

share|improve this answer
+1 : it would be easier though if I'd find a way to generate the textures somehow. Can't use glPolygonMode due to later OpenGL ES targeting ( iStuff ). – Kornel Kisielewicz Sep 6 '10 at 15:35

I know it's probably not what you're after, but it looks like Vector Tanks just uses textured models. The texture gives the wire frame look, it runs on my iPod touch which doesn't support shaders.

share|improve this answer
I know, I know, but I could also paste pictures of Subversion, and it doesn't use textures at all (AFAIK) – Kornel Kisielewicz Sep 6 '10 at 2:25

The only way I've seen it done is with high-resolution, mostly-black textures, such as the ones in Tron 2.0. Their textures are almost universally either a flat black with a thick, colored border, or a simple Perlin noise texture.

They applied some simple post-processing to achieve the glow effect.

share|improve this answer
+1: I knew the article, but thanks for reminding -- it is a good article indeed (and helps with the second problem I had -- glow). – Kornel Kisielewicz Sep 6 '10 at 15:36

You could try some kind of simple distance function in the pixel shader. Perhaps something like barycentric coordinates (store different RGB at the vertices and the rasteriser will do most of the work for you).

Then your pixel shader will have the information it needs about where on a polygon the current pixel is - near a vertex, near an edge, or in the middle...

I suspect in practice it'd be easier to texture it though.

share|improve this answer

How about this: Take your model, and bevel the edges you want to appear as outlines. Color the faces that were created with a bright opaque green, while all the old faces are a dark translucent green.

This requires no use of pixel shaders at all. (No textures either, in fact; just face colors.) It does require some model preprocessing on your part, which may or may not be an issue.

You won't be able to see the outline when the beveled surface is perpendicular to the view. If this bothers you, you can extrude the beveled surface out a bit, coloring the extrusion as you would have the bevel. You can play around with different degrees of bevelling and extrusion to make thinner and thicker lines.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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