Rendering thick lines?

Started by
5 comments, last by PlayfulPuppy 18 years, 10 months ago
Hey guys, I need to render some thick lines for a pick buffer, but I'm trying to avoid using D3DX (And subsequently D3DXLine). Main problem is that I'm going to need to draw a lot of them, so however I do it has to be reasonably fast, and this is where I'm stuck. I've considered rendering each line as an axis-limited billboard, but when it comes to drawing several thousand lines this seems sub-optimal. Is there any faster way that I can thicken up my lines, or am I just going to have to optimise the crap out of my billboard code? Actually, on that note, what's the fastest way to do an axis-limited billboard along an arbitrary axis? [Edited by - PlayfulPuppy on June 5, 2005 7:38:59 PM]
Advertisement
Using Line Lists is much slower than using triangle lists, so definitely stay away from them if you need the speed. Do you need these lines to be 3D? It sounds as if you need them to just be 2D. You could create a quad and assign it a material that is pure white (or whatever color the line should be) and then add the quads to a vertex buffer and draw them all at once.
Chris ByersMicrosoft DirectX MVP - 2005
Nah, they have to be 3D. I understand about using quads as faux-lines, the problem is trying to get these to work nicely in a 3D view, that and being able to rebuild/draw them reasonably quickly.
Quote:Original post by PlayfulPuppy
Nah, they have to be 3D. I understand about using quads as faux-lines, the problem is trying to get these to work nicely in a 3D view, that and being able to rebuild/draw them reasonably quickly.


Any reason you're avoid D3DX? That's pretty much what D3DXLine does. It also uses a band of alpha in its line texture to simulate AA lines. It's pretty accurate.
[sub]My spoon is too big.[/sub]
If I may ask... why are you needing to do this? Is this for a game?

J
if you are going to be drawing ONLY lines, then you can use line lists / line strips and make the backbuffer slightly smaller than the application. Ultimately, this will buldge the lines out. If you're going to be drawing other things, then you can draw these lines to a render target smaller than the back buffer, and then add it onto the screen as a huge screen space quad. Other than that, you can use cylinders and rotate them using trig, for as long as they don't need to move around much unless using a matrix transform.
Quote:Original post by Mite51
If I may ask... why are you needing to do this? Is this for a game?

J


In a way, for a level editing program.

Quote:
Any reason you're avoid D3DX? That's pretty much what D3DXLine does. It also uses a band of alpha in its line texture to simulate AA lines. It's pretty accurate.


I've been avoiding it mainly because of the additional DLL problems (Although apparently there are ways around that) and for cross-platformability. There's a good chance that DX9 isn't going to be the only platform that doesn't support thick lines nativley, and I'd like to have support for it in the engine across platforms.

Secondly, although I haven't thoroughly researched it, getting it to fit in with my mesh class nicely would probably be incredibly painful.

This topic is closed to new replies.

Advertisement