Author Topic: Async Rendering performance in games at runtime  (Read 2615 times)

I'm sorry if this has been asked a thousand times but I only found vague answers on how to optimize graphs and not on how heavy the performance impact actually is. I tried out downloading the UE4 project files here:
https://forum.allegorithmic.com/index.php/topic,3242.0.html
Then I replaced the Sync Rendering nodes with Async Rendering nodes to see the performance impact. The framerate jumps from 120 to 60-80 and then jumps back to 120 immediately after a change is made. I have to guess how long it takes but it's probably about 100ms-300ms. My hardware is an i7 3930K, 16GB of ram and a 1080ti. One thing I noticed is that the utilization didn't change noticeably at all when using the CPU engine and that in general only one core is getting utilized a lot. When using the GPU engine, utilization jumped from 25% to about 50%. My guess is that it actually jumps to 100% but the monitoring programs don't catch that because it's too fast? The other substance settings in the project settings didn't do anything about that. Does this change after packaging the project or is changing substance parameters at runtime generally a bad idea for games? Also, is there a way to slow down the rendering process? For example, instead of losing 50% performance and the substance updating in <1 second, losing <10% performance and the substance updating in half a minute? We would like to have a dynamic snow system that slowly builds up snow on surfaces but if the performance hit is too extreme, we will have to go a different route.

Hello @pepri,
I believe I can help. You are correct, the Substance plugin is intended for run time updates.

Firstly for the rendering time and throttling the computation time, there isn't currently a way to limit this but we do have a limit within the Substance settings that allows you to set how many Async Substances can be processed at once.

As for the large performance hit you are seeing, Have you changed the generation mode on any of the Substance Instance Factories that your are updating at run time? By default, the generation mode is set to platform default which is a caching flag. This is the standard setting for all Substances that will be static. In the case this was left default, every time the Substance is processed, all of the textures are re-cached to disk. This is a performance improvement for Substances that will not change at run time but can have a negative impact for Substances that are.

To solve this, for all of the Substances you are updating at run time, can you switch the generation mode to just Load Async and try once more? This can be done by right clicking on an Instance Factory within the content browser -> Asset Actions -> Bulk Edit Via Property Matrix -> Right hand column you will see a Substance drop-down list. If you expand this, you will see the Generation Mode behavior for the selected Instance Factory.

This should eliminate the large performance drop you are seeing. =)

Lets us know if this solves this issue and if you run into anything else, please let us know.

Cheers!  :D
Last Edit: October 03, 2017, 09:48:35 pm
Software Engineer, Integrations
daniel.stover@allegorithmic.com

Thanks a lot for the explanation! I changed the generation mode to Load Async and it did help a lot(instead of getting 60-80 fps I got about 90-100 while updating). I also tried out other things, so here are the results:

1. Packaging the "game" with unlimited fps -> Way higher framerate and overall better performance -> around 250 fps avg and about 150-200 when updating a substance. Also, the other changes in the project settings(like the memory budget) actually did have an impact after packaging.

2. A very low memory budget -> Way slower updates and way less of a performance impact(so exactly what I wanted) -> 250 fps avg and 240 while updating

3. Not using the mesh and substance from the "Substance for UE4 Training Series" and instead using my own mesh with an optimized substance -> Way higher framerate and a way lower performance impact -> 350 fps avg and 340 while updating

GPU vs CPU Engine didn't really change the overall performance but the GPU Engine appears to be faster. We aren't sure which one to use. Is there a generally accepted standard for this? I see pros and cons for both options. Also, is there a way to change the memory budget during runtime(with code or blueprints)?

Other than that, I'm happy with the result and we'll use a combination of optimized graphs, a low memory budget and a low number of substances being processed at once to keep a good performance.

Thanks again and Cheers!


Hi @pepri,
So glad to hear you found a configuration that works for you.  :D

Through blueprint and external code, there currently isn't a way to change the memory budget but this is excellent feedback! In the case you don't want to wait and want to alter the plugin to expose this, it should be simple to achieve. I have added a ticket for this though.

 Cheers!

Software Engineer, Integrations
daniel.stover@allegorithmic.com