D3D9 Line object hits performance

Started by
7 comments, last by NightCreature83 12 years, 5 months ago
Hi friends,

D3D9 Line object hits performance while drawing huge number of lines. I use Line object because I couldn't fine any help for drawing thick lines for other drawing mechanisms where as Line object does it in a pretty easy way. Some one please tell me any solution for this. Any help would be greatly appreciated.

Regards,
Ashie.
Advertisement

Hi friends,

D3D9 Line object hits performance while drawing huge number of lines. I use Line object because I couldn't fine any help for drawing thick lines for other drawing mechanisms where as Line object does it in a pretty easy way. Some one please tell me any solution for this. Any help would be greatly appreciated.

Regards,
Ashie.

Research D3DPT_LINELIST and D3DPT_LINESTRIP.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid


[quote name='ANR' timestamp='1320217471' post='4879568']
Hi friends,

D3D9 Line object hits performance while drawing huge number of lines. I use Line object because I couldn't fine any help for drawing thick lines for other drawing mechanisms where as Line object does it in a pretty easy way. Some one please tell me any solution for this. Any help would be greatly appreciated.

Regards,
Ashie.

Research D3DPT_LINELIST and D3DPT_LINESTRIP.


L. Spiro
[/quote]

Actually you are better of creating a rectangle for thick 2d lines and boxes for 3d lines as they will render faster then the line primitive will.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Thanks for your reply. I shall test it out and revert.
Hi, I implemented it with drawing a rectangle using 2 Triangles and by calling Primitive drawing using TriangleList. I achieved thick lines, but it doesn't get me a smooth line. Especially when I draw slightly slanting lines with respect to horizontal / vertical axis.

Hi, I implemented it with drawing a rectangle using 2 Triangles and by calling Primitive drawing using TriangleList. I achieved thick lines, but it doesn't get me a smooth line. Especially when I draw slightly slanting lines with respect to horizontal / vertical axis.


Yes anti-aliasing will fix that even if you draw a normal line primitive you would still not have a smooth line. Pixels are square so even if you used a normal line primitive it wouldn't be perfectly smooth, turn on 2-4x MSAA and it should be a bit better. There are other algorithms you can use for Anti-Aliasing but none of them are free. MSAA just doubles the back buffer and then scales down to the size you want, This way pixels colors are determined by a weighted average.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Hi, thanks a lot for the response. Do you have any idea how to implement Pixel Shader. I have seen few example, but no one has given a full set of example. I am bit confused with the writing of '.fx' file. Will this approach do the job better? Thanks for your solution. I will try this and shall update you.
http://www.toymaker.info/Games/html/pixel_shaders.html

This site has everything you need. Start with using seperate vertex and pixel shaders, then go for .fx-files. I just wonder why you need pixel shaders to draw a line? You should definately know how to use shaders, but still..

Hi, thanks a lot for the response. Do you have any idea how to implement Pixel Shader. I have seen few example, but no one has given a full set of example. I am bit confused with the writing of '.fx' file. Will this approach do the job better? Thanks for your solution. I will try this and shall update you.


Multi sampling isn't a pixel shader technique it is a present technique and you will have to tell D3D when creating the device which MSAA level you want to use. MSAA acts on the whole scene not just on the primitive you are rendering.

MSAA uses a back buffer that has twice the dimentions of the frontbuffer, once the device comes to the swap it takes multiple samples out of the backbuffer for each pixel in the front buffer. So if MSAA is set to 4 foreach pixel in the front buffer it has taken 4 samples out of the backbuffer for it to determine the final color.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

This topic is closed to new replies.

Advertisement