Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

draw call batching

According to ( http://bit.ly/2cIWKVE ), UE4 does not support batching draw calls for actors that use the same material.

Eg if we have 100 actors and each actor uses 3 materials (call them A B C), that's 300 draw calls. All UE4 instancing does is group the order of the draw calls so we do 100 A draws, then 100 B draws, then 100 C draws.

I find this shocking. I would have thought the material system (without instancing) would automatically batch draw calls based on some generic algorithm.

I would've expected the above example to be done in 3 draw calls - not 300 draw calls. One draw call for each material. Batching draw calls in this way can be done by batching the vertices into a single vertex buffer per-material.

One concern I read was that this can hurt culling when actors are not in close proximity... But UE4 could solve this as follows. Just have the developer label each actor in a group to be batched. So when I create each of the 300 actors (in the editor, in Blueprints, or in C++ code)... I just assign each actor to a draw batch group. Then for each actor in a particular draw batch group, UE4 will automatically combine the vertices into a single vertex buffer for each material in that draw group.

So if the user assigns all 100 actors to a single draw batch group, then UE4 will do 3 draw calls (one for each material). Or, if the user assigns 50 to group G1 and 50 to group G2... Then UE4 will do 6 draw calls (one per material per group) (each actor has 3 materials).

Or the instancing system could do this? Based on the above link, it sounds like instancing would still do 300 draw calls... It just orders the draw calls so that it does each 100 draws material A, then 100 for material B, then 100 for material C. In other words - instancing does not reduce the number of draw calls.

So my question is... Does UE4 support this? And if not then why the heck not?

Aside - Unity does it, see ( https://docs.unity3d.com/Manual/DrawCallBatching.html )

Product Version: UE 4.12
more ▼

asked Sep 09 '16 at 05:59 PM in Rendering

avatar image

72 12 15 17

avatar image ColdSteel48 May 27 '18 at 03:47 AM

Maybe you can try to use this: https://api.unrealengine.com/INT/API/Runtime/Engine/FMeshBatch/index.html

I never used it myself yet, but it looks like this is what it does.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Currently the only way is to use the merge actor tool to combine actors. It takes some extra time, but than you do have a lot of control.

I'm not sure how the instancing is executed, but I compared a simple scene with a 1000 draw calls on a newer mobile device, with a scene where they were all instanced, which I then compared with a scene where they were all in a single draw call by using the merge actor tool. The conclusion: instancing had about the same performance as merging. So it is definitely a lot better than having it all separated.

more ▼

answered Sep 10 '16 at 01:43 PM

avatar image

2.4k 70 43 142

avatar image pemcode Sep 11 '16 at 03:53 AM

My actors are spawned dynamically at run-time in a 26x19 grid. Can I efficiently "use the merge actor tool to combine actors" at run-time in my C++ code? The goal is to spawn 26x19 actors on level begin, and then Destroy() actors gradually as the game continues (I'm basically using actors for fog of war). It's all the same actor just 26x19 copies of it.

According to ( http://bit.ly/2cIWKVE ), instancing does not batch draw calls and does not reduce draw calls. Instead, it just sorts the draw calls so that draw calls from the same material happen in a row. Again I'm assuming ( http://bit.ly/2cIWKVE ) is true, but I'd love to verify it if it's easy to do somehow?

avatar image Roel Sep 27 '16 at 07:46 AM

It might be better to check performance instead of just 1 number: draw calls. Performance is related to too many things. Instancing does boost performance in cases where you need to draw a lot of the same "small" meshes.

The merge actor tool is made for the editor itself. I don't know what you are trying to drawn, so can't really help you with how to solve the issue.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question