Aliasing for 3D modeler

Started by
5 comments, last by Dmnbp7ip 17 years, 4 months ago
Hi, I am programming a 3D modeler (http://www.macrocosm.0rg.fr), and I meet a little problem with rendering the edges. I render them with : DrawIndexedPrimitive(D3DPT_LINELIST , 0, 0, NVertex, 0, NEdgeSelected); The lines are very aliased... look at the following picture : http://www.macrocosm.0rg.fr/aliasing.png I have to say that I use the same vertex buffer for rendering faces, vertex and edges. Do you have an idea about how I could do to make edges cleaner ? Like on the following picture (from 3DSmax) : http://www.macrocosm.0rg.fr/max.png Thanks !
Advertisement
It looks like the faces are partially overlapping the lines, due to Z-fighting. To fix this, you can use the DepthBias render state to artificially push the lines "forward" a little bit (although they'll appear in the same place on the screen.)
It seems that depth bias do not affect the lines... here is an extract of the DXSDK documentation :

"The bias is not applied to any line and point primitive. However, this bias needs to be applied to triangles drawn in wireframe mode."

:(

Right. So all you need to do is draw the triangles in wireframe mode, and the bias will be applied. (alternatively, you could just bias the faces backwards.)

Yes, but I do not want to draw triangles, I want to draw the edges around a polygon : they may have more than 3 sides...

When they say "triangles" they mean "polygons of any number of sides". Polygons, you see, are drawn by DirectX as a series of coplanar triangles.
I found a simple solution !
I just move a bit the edges in direction of the camera, with the world matrix.


This topic is closed to new replies.

Advertisement