Download

Foliage tool and draw calls

Ok somebody needs to re-explain to me how the foliage tool affects draw calls (preferably like I’m 6.) I was told that the foliage tool automatically batches (I know that’s probably not the right word but my vocab sucks) a set of foliage meshes in order to reduce the number of draw calls, so like you could place a patch of grass and have it be like 1-4 draw calls (dependent on the number of materials assigned to the grass asset of course.) But now I’m starting to think that I misunderstood the whole thing, because I put a set of 12 foliage meshes into a scene and, for the sake of this post, let’s just say each of them have 5 materials assigned to them. That, plus the landscape and the sky sphere should be 62 draw calls right? Well apparently not because this is what I’m getting:

http://i.imgur.com/fU9MZ7m.jpg

I mean, there must be something I’m misunderstanding, because I have no idea where all 330 of these draw calls are coming from.
Can somebody please explain to me what it is I’m missing? Please and thank you very much.

Addendum: Here’s what the scene looks like without the annoying words all over it.

http://i.imgur.com/MOUNjRp.jpg

I accually do some search, it seem like dynamic shadow and some post processing duplicated drawcalls

just send you the link, so you might found some cue there, hope it helps

That might explain a bit, but why do dynamic shadows duplicate draw calls? And which post process settings?

UPDATE: I fooled around with the lighting and the post processing, and even with the post processing turned off and all the lighting set to stationary/static (tried both), the number of draw calls did not decrease whatsoever

Sorry to have to bump this but I really need an answer to this.

The way it works (in theory) is this:

  • Each material on a model adds a drawcall, so 5 materials on a model = 5 drawcalls

  • Instances/foliage are drawn as one, so if you have 50 instances of one model with 5 materials, that’s 1 x 5 = 5 draw calls

  • Also, if you have 5 different models sharing the ***same ***material, that will still be 5 draw calls unless they are combined into one static mesh. This applies to instances too: if you have 5 different foliage models with 100 instances each that should = 5 draw calls

  • Adding a dynamic light to the scene multiplies the draw calls as it has to render the scene twice; once from the camera view and once from the light view/radius (but only if you have shadows). So the more dynamic lights you have with shadows, the more draw calls.

  • Some other things that might be increasing draw calls (although im not 100% on this yet) is LODs or LODs with different materials. Also foliage instancing may be breaking up foliage counts into small clusters for LOD-ing purposes (although i really need to test this) further increasing draw calls.

  • The best way to test this is to start a blank level, paint a foliage prop that only has one material and see what happens when you start adding more.

**EDIT: **Cleaned up some bad math

Ok that makes sense, but even with the dynamic lighting thing I should be getting a maximum of like 150 draw calls, There’s still 180 left unaccounted for. I’ll have to do like you said and start experimenting in a blank level.

Actually real quick, would masked transparency have any effect on draw calls?

Masked alpha shouldn’t increase draw calls, but transparent materials might

can you posible to show us the material of the assets?

330 draw calls is actually pretty normal for a scene like a forest. My character alone has 80 drawcalls :smiley:

However, I recommend cropping the meshes of leaves and other transparent/masked textures. https://forums.unrealengine.com/showthread.php?131783-Foliage-overdraw-testing!
Overdraw is much more expensive when it comes to foliage than DrawCalls.

Is 330 normal? Gosh it seems like a lot. What would be too much then?

Well most of these assets do have like 3 - 5 materials so I’d have to take screenshots of at least 36 different materials.

well, it might cause by the Subsurface material or other issue in your material, can’t judge anything yet cause we dunno how complex is your material

3-5 materials on one asset? If so that is way too many - ideally for foliage you want to keep it down to just one or two materials per model.

Only like two are drawn at a time on a single asset (for the trees), the other 2 - 3 materials are all for LOD sake, like the grass has two, one masked transparent material for up close and one opaque material for far away.

Like half of them have masked transparency, half of them are opaque. Almost all of them use either speedtree wind or simplegrasswind. That’s legitimately as complex as they all get.

hi, you can try temparory remove some of the speedtree wind or simplegrass wind or opaque of one of the material and check the drawcall, see is it the material effect the drawcall

Oh yeah, thats actually not a bad idea.