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"

Serious performance bug with Instanced Static Mesh

Please let me start by saying that it is absolutely critical that I resolve this issue. If this issue is not resolved, our entire game design will not be feasible.

Summary of the problem:

Adding instanced static meshes in a random order by location gives 25% of normal frame rate, compared to adding them in order by X,Y,Z location.

It took me days to track down exactly why I was getting 30 fps when spawning 100k blocks using a random location, but when I spawn then in a grid, iterating over x and y, the fps is over 100. Everything else is exactly the same. PLEASE help me fix this problem. I would have to find another engine if this can't be fixed. I am providing a github link and screenshots.

Steps to reproduce the bug:

1.Load the attached project.

2.Begin Play.

3.Observe fps.

4.End Play.

5.Enable the bool "Use Random Order" in my ism_spawner blueprint.

6.Begin play

7.Observe fps.


alt text

alt text

alt text

Product Version: UE 4.15
blueprint.png (516.1 kB)
ordered.png (1.1 MB)
random.png (1.1 MB)
more ▼

asked Mar 26 '17 at 04:05 AM in Bug Reports

avatar image

92 11 22 30

avatar image mrcoolbp Mar 27 '17 at 02:54 PM

I downloaded the project and I have reproduced OP's result, it appears this is an engine bug.

avatar image mgumley Apr 03 '17 at 04:52 AM

It's been over a week since I posted this. Could someone on staff please respond? This is really important to our game.

avatar image IGorilla Apr 03 '17 at 05:15 AM

Have you tried cpu profiling? It might help you point out where all the cpu cost is going.

avatar image mgumley Apr 03 '17 at 08:06 AM

I have, and I think it has something to do with the way the physics engine handles collision. This project is very bare bones, so there isn't anything I can change. There needs to be a way to add and remove instances at random locations.

This is critical for cutting down a forest in game and having it grow back, or placing blocks for bases. If you were to say "try using less blocks", then we are simply ignoring this bug. There is no good reason that we get 4x performance for placing the instances in a specific order.

We have a situation where the number of blocks must be hard capped at a very low number, because the complexity of adding additional blocks becomes greater than O(N). See image below.

alt text

Please feel free to download the project using the link posted above, and try it yourself.

capture.png (31.6 kB)
avatar image lolmedve Apr 09 '17 at 02:53 AM

Workaround: link text This is a single blueprint (Yours but modified by me :D ) Hope it will help

avatar image mgumley Apr 09 '17 at 04:02 AM

Thank you for this attempt. Would it be possible to post a screenshot of the blueprint? I don't know enough about scanning files like this for malware.

avatar image mgumley Apr 10 '17 at 04:01 AM

lolmedve, I loaded your workaround and I was not able to reproduce any performance gains that address the subject of this post.

avatar image lolmedve Apr 10 '17 at 10:25 PM

Sorry for late reply. This attempt gave me different results because I've used high poly meshes with LOD enabled (I don't really know why the hell) Since then I've tried nearly every possible way to get it working, generated fully new array from the provided data (without any loss of the original array not like before) but it gave me the same result. Your problem will be with the engine itself if we can call this a problem. The engine is simply reading ordered data faster(only in case of having the same numbers through several datablocks) Sorry for the inconvinience that I've made. Have a nice day :)

avatar image mgumley Jun 11 '17 at 06:05 AM

It appears they have done something in 4.16.1, but the problem is still not fixed. If you look at these two screenshots, you'll see that there is an intolerable amount of frame rate jitter when using the random order mode.

Please note that the problem does not occur if the camera is not translating it's location. You must be moving to notice the effect.

alt text alt text

ordered.png (1.1 MB)
random.png (1.1 MB)
avatar image Panthre Aug 07 '18 at 03:52 AM

If the rendering is the problem, then there's functionally no difference between spawn type one and spawn type two except that when spawning in an orderly way, the instanced meshes are probably batched together more intelligently.

Wouldn't it be reasonable to assume that totally random spawning at runtime will cause the batching of meshes (and therefore your culling, occlusion, LOD's) to become intertwined in undesirable ways?

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

1 answer: sort voted first

Hi mgumley ,

Thank you for submitting a bug report. I have reproduced the issue and logged it as UE-43692 which you can track on the following link: Unreal Engine Issues. Please be aware that since the issue must be reviewed and prioritized by our development staff, it may be a while before it can be addressed.

-Steve H.

more ▼

answered Apr 05 '17 at 07:13 PM

avatar image mgumley Apr 06 '17 at 03:56 AM

Thank you so much for looking into this Steve.

There is one small mistake in your bug report. You accidentally reversed the outcomes. The frame rate is worse when using random order, not better.

avatar image Steve Hardister ♦♦ STAFF Apr 07 '17 at 09:18 PM

I have made this correction, thanks for pointing that out.

avatar image mgumley Apr 10 '17 at 04:03 AM

In the bug report UE-43692, step #1 says "linked removed", is this normal for non-staff? I'm not sure if they will be able to understand the bug without the content of this post.

avatar image Steve Hardister ♦♦ STAFF Apr 10 '17 at 03:53 PM

The link is still there for staff, we just remove links when making the ticket publicly visible.

avatar image Nachtmahr Apr 10 '17 at 11:44 PM

Want to add a bit of more info I could dig down to:

Can confirm it is related to the Order they Spawn in (still slow): https://gyazo.com/e556416a57ec6e9fdd94e63b36b921f6

Digged a bit deeper with the Profiler an noticed PhysXTask is going Mad with the Random Order (Console command "stat Physics") https://gyazo.com/b6db1a6b1e37d18fe382f1f017aa1de6

And indeed the Performance is the same as in Order if you Turn off Collision in the Instanced Static Mesh Component.

Thats how far I willing to go but should give the Staff a Hint in the right Direction. (Sry not in Sourcecode mood today ^^)

avatar image Steve Hardister ♦♦ STAFF Apr 12 '17 at 03:16 PM

Thank you for this additional information. I have added it to the bug report.

avatar image mgumley May 31 '17 at 06:56 AM

The bug report (UE-43692) is marked as "cannot reproduce"?! My project on Github demonstrates the issue very clearly. Could you please look into this?

avatar image mgumley Jun 06 '17 at 04:17 PM

So it's been nearly a week with no answers. This post have over a hundred views. It was acknowledged by Steve and many other people that were able to reproduce the problem. My team literally cannot continue making our game until this problem is fixed. The fps is unplayable. What is it going to take to get this resolved?

(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