Jump to content
  • Advertisement
Sign in to follow this  
Drythe

speeding up rendering... (drawprimitive)

This topic is 4900 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

I'm trying to get a better frame rate and have a question about DrawPrimitive(DrawIndexedPrimitive). I've got 42000 vertices (14000 triangles) in the vertex buffer. If I don't call DrawPrimitive, I get 180fps.... when I do call it, it goes down to 90fps. I'm trying to account for the 90fps drop... so, I guess my question is: what exactly is going on when this function is called? I'm using transformed vertices and not using the Clear function. Even when the triangles aren't on screen, I get the same drop. What else would be happening during DrawPrimitive that would account for the framerate drop?

Share this post


Link to post
Share on other sites
Advertisement
The Draw*() series of calls do specifically what their name says they do: they draw polygons. Specifically, among other things, they push buffers to the GPU for rendering. Obviously, you are going to see a drop in framerate, because this is the call that actually renders all of those polygons. There is also a lot of additional overhead, so you *really* need to be careful with how many times you call it per second.

Share this post


Link to post
Share on other sites
what if the triangles are not even on the screen? Are you saying that the drop is coming from the actual data (position and color) getting passed into the GPU?

Share this post


Link to post
Share on other sites
I get a similar problem, When I just render my landscape I get 75fps
as soon as I start rendering my 8 meshes , I get 10-15 fps.. regardless of whether or not I'm even looking at the meshes

my guess is that the draw function simply draws everything , regardless of whether or not it is inside the view frustrum..

Share this post


Link to post
Share on other sites
Hi guys,
Well seems like you guys are heading towards frustum culling. Right now what your "engine" is doing is rendering/drawing everything you pass to the Draw* methods. If you want to speed up the process there is a term they use for it called Frustum culling where you basically test with an algorithm if your object is in view of the View Frustum and render/draw it.

View Frustum culling - link 1, link 2

Share this post


Link to post
Share on other sites
Are you using index buffers?

Few things:

- Use index buffers, they'll reduce your vertex count.
- Use indexed triangle lists for low-poly meshes and indexed triangle strips for bigger meshes
- Cache : reorder your vertex data (to use closest faces)
- Reduce degenerated faces (degenerated face = line)

- Don't do too small batches (DP and DIP call = batch)

Visibility:

- Use frustum to cull your objects that aren't visible
- Use some kind of tree to make the culling faster (octree, I recommend loose-octree if you have lots of objects)

Some basic stuff. :)

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!