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

Line AA

Started by tomek_zielinski Jul 12, 2004 at 1:33 PM 4 replies 950+ views
Original Post
tomek_zielinski
tomek_zielinski
Hey! I'm drawing outlines of objects in the scene using indexed line list. Is there any possibily to antialias lines(in D3D)?
www.tmreality.com
Namethatnobodyelsetook
Namethatnobodyelsetook
nVidia cards reserve anti-aliased lines for their workstation Quadro cards... for LINELISTs anyway... you can fake it with polygons, and D3DX happens to have something already.

From the help file, the first entry after doing a search for "Lines":

"For antialiased line rendering in multisample render targets, use ID3DXLine, which generates textured polygons. The pixel coverage values, generated by antialiased line rasterization, modulate the pixel's alpha value computed by the pixel shader. To draw an antialiased line, an application must enable alpha blending, and then it must set the D3DRS_ANTIALIASEDLINEENABLE render state to TRUE."
Agony
Agony
I don't think so, from what I've read. What you could do is use very thin triangles (or pairs of triangles, more likely) to draw the lines and get AA. ID3DXLine might already do that, and manage everything for you (but I can't guarantee anything, having not used it myself).

[edit]I was beaten... Oh well.[/edit]
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
tomek_zielinski
tomek_zielinski
thx huys - I knew that but thought I not overlooked sth....

the problem is that I need to draw about 100000 lines per frame and 'emulating' this with tris or d3dxline would suicide.

BTW: Quadro is an ordinary GF with hard/soft locked lines - you can find an article somwhere on the net how to make Quadro from GF in two minutes:)
www.tmreality.com
Namethatnobodyelsetook
Namethatnobodyelsetook
Quote:
Original post by tomek_zielinski
the problem is that I need to draw about 100000 lines per frame and 'emulating' this with tris or d3dxline would suicide.

Lines draw much slower than polygons, so emulating lines as polygons might actually be faster, and give you variable width at the same time. Creating the list of polygons for the lines yourself may be faster than using the D3DX line interface. I have no idea if the line interface batches lines or not, and you'd definately want to batch as many as possible.
tomek_zielinski
tomek_zielinski
Quote:
Original post by Namethatnobodyelsetook
Quote:
Original post by tomek_zielinski
the problem is that I need to draw about 100000 lines per frame and 'emulating' this with tris or d3dxline would suicide.

Lines draw much slower than polygons, so emulating lines as polygons might actually be faster, and give you variable width at the same time. Creating the list of polygons for the lines yourself may be faster than using the D3DX line interface. I have no idea if the line interface batches lines or not, and you'd definately want to batch as many as possible.


When I implemented outlines for the very first time my framerate dropped too much so I realized that lines are very slow kind of primitive to render. But now my lines are using visible geometry vertices and to draw lines I'm only using indixes. If I emulated lines with triangles they would rasterize faster but new vertices would occupy a lot of VRAM and indices would also grow in number so I'm afraid that it would be a good solution.
I cannot afford testing it at the moment, so what do you think??

And lines are guaranteed to be one pixel wide while triangles might suddenly disappear. How to cope with that? Dynamically calculating line width in vertex shader would be a solution, but I couln't use vertex shader because my game habe to run on GF1/2 and 700mhz CPU(software fallback isn't a good idea).

On the other hand i would have ability to influence parameters of such lines...
www.tmreality.com

Topic Locked

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

Sign in to reply to this topic.