开发者

Direct3D line thickness, with a slightly different take

开发者 https://www.devze.com 2023-03-05 21:08 出处:网络
I realise that Direct3D doesn\'t properly support line thickness, and infact on most graphics hardware, lines are actually just collapsed rectangles.

I realise that Direct3D doesn't properly support line thickness, and infact on most graphics hardware, lines are actually just collapsed rectangles.

At least I thought that was the case, until I tried to actually implement line thickness by rendering rectangles instead of lines and found that they lost detail and were eventually invisible as I zoomed out; whereas line primtive types seem to be guaranteed to always be 1 pixel wide regardless of scale.

I'm creating an AutoCAD viewer, of which lines are a fairly staple entity, and need to support a thickness; but regardless of zoom level must always be at least one pixel wide.

Can anyone suggest a strateg开发者_开发技巧y for achieving this; ideally a rendering settings adjustment as opposed to working out if it should render lines instead of rectangles?

[Edit] Should have mentioned; it's Direct3D 9 in .Net via SlimDX.


The simplest approach I can think of would be to render the lines as simple quads in 2D, and have the pixel shader write an oDepth value containing the correct 3d perspective depth.

0

精彩评论

暂无评论...
验证码 换一张
取 消