Jump to content
  • Advertisement
Sign in to follow this  
asishnr@gmail.com

D3D9 Line object hits performance

This topic is 2481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

[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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!