Skip to main content
GameDev.net gamedev.net
🔒 Locked

Shaded + wireframe modes

Started by adriano_usp Dec 12, 2009 at 1:52 PM 1 replies 1.8k views
Original Post
adriano_usp
adriano_usp
Hi, Many modeling packages have options to show their models in shaded + wireframe mode, like this: torus Just out of curiosity... I wonder if there is a common method to drawn the wireframe lines. Nowadays, is there some direct resource in the graphics APIs to performe that? Thanks in advance
Krypt0n
Krypt0n
They just draw the object as wireframe, usually with some depth bias to avoid z-fighting.
A somehow better way would be to calculate per pixel the distance of the pixel to the edge of the triangle and based on this to blend in the black color. you would probably get smoother lines, but that's kinda just eyecandy and wireframe rendering is not an artistic goal but rather functional.
rubicondev
rubicondev
You can set a wireframe render as a global renderstate on most SDK's, but that's not the end of the story.

If you draw the object solid and then again in wireframe, the result will not be pleasing. Firstly there will be nasty artefacts due to z-fighting of the lines pass, which is often fixed by pulling back a bit towards the camera.

The real problem though is that your mesh if made of triangles, and if you want it to draw quads then you need a post-process pass on your model to pick only the lines you want to draw and then draw the thing as a linelist instead of a trilist iyswim.

Most modelling packages keep their mesh data in higher-order data systems and perhaps only cache into (say) a D3D VB for optimised rendering - all the work gets done on "faces" which will have flags to say which edges to draw etc. You need to fake that up somehow using an algorithm if you're starting with polygon soup.
------------------------------Great Little War Game

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.