About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Draw Calls
Author Message
TBJokers Offline
Member

Post: #16
RE: Draw Calls
(05-06-2014 03:23 PM)Tottel Wrote:  I also want to add that it's pretty useless to blindly reduce drawcalls if they aren't even slowing down your game.
You could group objects together, but if sending information to the GPU isn't the bottleneck, then you might actually make performance worse.

Maybe it's not true, maybe it will always be more performant (Unless you group everything into huge chuncks, making frustrum culling pretty useless). I was taught to always start optimizing the slowest parts of your program, since they will be the most useful by far.

My point is that we need a way of knowing if the drawcalls are actually reducing performance -> Stats would be nice.

Yes they are, and they are by a chunk load.

http://msdn.microsoft.com/en-us/library/...s.85).aspx

You've got the source, go ahead and try the difference. smile
05-06-2014 04:10 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #17
RE: Draw Calls
(05-06-2014 04:10 PM)TBJokers Wrote:  Yes they are, and they are by a chunk load.

http://msdn.microsoft.com/en-us/library/...s.85).aspx

You've got the source, go ahead and try the difference. smile

But what if you don't have many drawcalls to begin with? For example, if you have an empty scene with 200 trees or so. Let's say you have 500 draw calls.

If you would instance all of those, that means they will all be done in a couple of draw calls (I guess you still need separate drawcalls for trunk/leaves?).

Your CPU should be able to send 500 drawcalls to the GPU without any problems. But if you group all of them together then you mess up your frustrum culling (If any of the trees are in view, all will be rendered even when they are outside of the camera). Shouldn't that make performance worse?

I should mention I'm a shitty graphics programmer, am I completely wrong here? grin
05-06-2014 04:33 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #18
RE: Draw Calls
You can combine frustrum culling and geometry instancing, there are however alot of discussions about doing geometry instancing for high poly count vertexes..

To clearify.. Geometry instancing sorts the geometry into chunks, where as all objects that are duplicate are called at one draw call instead of x.
Sorting the Geometry can be done after frustrum culling, or other way around.

So for example a scene of 100x100 with 1 poly per meter or so, would require 10k draw calls or so where as your CPU would not want that.. And this is why you can literally reduce it to 1 - Frustrum culling because your camera is looking the other direction which makes it 0 draw calls! smile And that saves performance..
05-06-2014 04:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #19
RE: Draw Calls
I've been working on performance tests. I've gotten to 6,000 objects(barrels and rocks from the tutorials) and I still get a minimum of 80fps. This includes a directional light from the 'sun'.
However, if I add a point light, I drop to 20fps; 2 cone lights takes me to 40fps. If I turn shadows off, I get bumped up to over 200fps.
This leads me to believe that the draw calls are a LOT less performance eating than the calculations done in the update methods and to calculate things like shadows.
Even resolution doesn't make that much difference- going from 1920x1080 to 960x540 yields only about 3% increase in fps.
Adding a force to all objects causes the FPS to drop to .2 or so-.4 without shadows. No, I don't think how long a draw call takes is really even an issue. xD
05-06-2014 08:32 PM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #20
RE: Draw Calls
Thanks Rubeus, that's kind of what I was thinking. It would be nice to address the real performance killers first. And to do that, you first need to know what they are.

Performance drops incredibly fast if I add a couple of lights.

EDIT: Anyway, back on topic.. Stats are nice. grin
(This post was last modified: 05-06-2014 08:55 PM by Tottel.)
05-06-2014 08:55 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #21
RE: Draw Calls
Quote:I don't think how long a draw call takes is really even an issue.
You will if you make enough of them as you will become CPU bound and negate the power of your GPU which will sit there twiddling its fingers! Of course this matters but so do other issues like dynamic shadows which do have a big hit on performance. Anyone wanting to optimize their game needs to look at many factors, some are more under their own control than others but it always helps to have feedback otherwise we tend to be operating blind. Try doing optimization tests without a FPS or frame delta display grin
05-07-2014 07:03 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #22
RE: Draw Calls
I understand what you are saying, but given my tests, couldn't we make the assumption that if you have enough objects to bottleneck that you would be well aware of the reason for poor performance already and would be waiting for hardware instancing? Even then, I don't think instancing will be a cure-all. Throw a flashlight on in a grassy field, and the shadows will violently murder one of the digits on your FPS.
I could be wrong, but this seems logical to me.
05-07-2014 07:56 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #23
RE: Draw Calls
For what i believe when casting shadows it does a 3d projection on the terrain texture which requires a new drawcall, where as dynamic shadows would have to be updated each time a light point moves/sun. That's where the drawcalls starts causing an issue..

I'm just talking out of theory as i yet do not know how he does the shadows.
05-07-2014 08:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
candam Offline
Member

Post: #24
RE: Draw Calls
Nice discussion we have in here smile Guys but let's all agree that performance should be optimized more . Don't forget performance issue was a back breaker for many projects in here so we should face the problem !
05-07-2014 09:19 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #25
RE: Draw Calls
.....why is hardware shadow rendering not a thing?
05-07-2014 09:45 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #26
RE: Draw Calls
I'm not sure why your 6000 object test gave the results it did Rubeus, I'm no expert on graphics engine design and how all the various factors interplay and effect the frame rate. But I'm having to learn, not as some academic exercise but because my frame rate is suffering and I need to improve it.

I do know that your test scene from your description was not very representative of a typical game scene, having few textures and geometry variations. It would only take some simple draw call batching in Greg's engine to explain that easily but it wouldn't necessarily extrapolate to more complex scenes.

This is why it really takes the engine designer to join the discussions as only they have a good enough overview of their engine design to know what are the important factors regarding performance.

As Greg has already stated:

-draw fewer objects
-merge some objects together
-use as few materials per mesh as possible

I'd say that's pretty indicative of the fact that the number of draw calls made per frame is important.

I've already improved my overall frame rate by reducing the quality and distance of my dynamic shadowing but I don't want to lose dynamic shadows altogether. So any further improvements are going to have to come from other optimizations and this is where I feel we would all gain from an open honest discussion of what additional factors are involved!
05-07-2014 10:22 PM
Find all posts by this user Quote this message in a reply
candam Offline
Member

Post: #27
RE: Draw Calls
There is a simple question to Greg smile

We have a lot of nice features in Esenthel specially Graphics features

then why do you care less about putting the most performance optimizations features on the top of your list !

performance is the key to construct huge games then I guess this is the most important features to be developed .

I think you may be having another opinion but this topic is for an honest discussion as Pixel stated : )

Cheers !
05-07-2014 11:44 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #28
RE: Draw Calls
(05-07-2014 09:45 PM)Rubeus Wrote:  .....why is hardware shadow rendering not a thing?

There's something called Shadow Batching which reduces the overhead meaning batch similar vertex etc and call them at once.. However as it seems current state we will have to wait or literally do it ourselves.
05-08-2014 06:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #29
RE: Draw Calls
I've been doing a lot of reading. I've seen a lot of people say how important batching is, but I've also read a lot of people saying that between the newer version of DirectX and queuing systems, it's not as important. Given that it's still a hot topic everywhere, there must be some benefit.
The thing I haven't seen, though, is a solid benchmark showing the difference with/without on a 3D scene. I've seen some 2D examples, but that's a different beast. I also maybe saw one for XNA, but I'm not sure that was the same thing. Has anyone seen a 3D batched draw benchmark?
05-10-2014 05:32 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #30
RE: Draw Calls
Use google, there's alot of papers etc about it. Quick google search and the first thing i found was http://timothyhkennedy.com/hardware-geom...directx-9/

Scroll down and watch, might now be all too interesting, if you want i can send you a copy of papers i have of how to optimize rendering (Hardware instancing) etc. That provides you with the complete idea and how it works etc.
05-10-2014 08:30 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply