Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

http://toucharcade.com/wp-content/uploads/2009/01/picture-111-300x204.png

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
add comment

6 Answers

up vote 8 down vote accepted

Some links of interest:

Baerentzen et al. "Single-pass wireframe rendering" http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=4884

Nividia Corporation "Solid Wireframe" white paper http://developer.download.nvidia.com/SDK/10/direct3d/samples.html

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
add comment

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
add comment

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
add comment

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.