Qt 3D Studio Performance Improvements

December 19, 2018 Kimmo Leppälä

 

Good performance of 3D applications is essential for achieving the desired user experience. While the 3D assets are the most important items affecting the performance, the 3D engine itself needs to be highly efficient in what it does. We have been looking into ways for improving the performance of Qt 3D Studio and especially on how to reduce the CPU load and RAM consumption of 3D applications.

We released Qt 3D Studio 2.2 last week with a lot of cool features, explained in the release blog post. With this blog, the focus is on a couple of items provided by Qt 3D Studio 2.2 that significantly improve the performance and memory consumption. First, we’ll look into leveraging texture compression to reduce RAM consumption and to improve the startup time. Later in the blog post, we’ll dig into the new, still experimental, renderer provided by Qt 3D Studio 2.2. The new renderer, as well as the upcoming new animation system, is specifically developed to reduce the CPU load of Qt 3D Studio applications.

Using Texture Compression for 3D Assets

Qt 3D Studio 2.2 provides support for KTX texture format, enabling the use of various different compression algorithms, such as ETC and ASTC compression. Texture compression helps a lot in reducing memory consumption as well as application startup time. ASTC is a compression technique specified by the Khronos Group and stands for Adaptable Scalable Texture Compression. The ASTC compressed textures are then packaged into a KTX container (another Khronos Group standard, also used by Qt Quick) and used by the Qt 3D Studio. Use of compressed textures is enabled from the Qt 3D Studio Editor (see documentation). Currently, the compressed textures need to be created separately.

The graph below visualizes the impact of compressed textures for the RAM consumption.

qt3d_studio_ram

The impact depends on the application. In these measurements, we have three different 3D usage scenarios, called Scene 1, Scene 2 and Scene 3. These are benchmark applications created specifically for testing purposes. They run continuously as part of our performance testing system to detect possible regressions (and improvements as well, of course). The impact of texture compression on a real-life Qt 3D Studio application depends upon the application, but the test applications (scenes) give a good impression on how applications of varying complexity can benefit from texture compression.

With ASTC texture compression (we have set it with 4×4 block size and linear rgb format) the memory consumption is reduced by 23MB (20%)  in the simplest Scene 1 test case, by 41 MB (28%) in the Scene 2 and by 56 MB (25%)  in the Scene 3 test (the most complex one of the three). On average, the tests using texture compression yield a 24% reduction in RAM consumption, which is quite a nice saving of that scarce RAM.

The graph below visualizes the impact of compressed textures for the startup time of the application.

qt3d_studio_startup

The startup time improvement with texture compression is 57% (from 0,23 to 0,1 s) for Scene 1, 64% (from 0,55 to 0,2 s) for Scene 2 and 65% (from 0,85 to 0,3 s) for Scene 3. The time is measured from starting to load the presentation until the first frame is shown. On average, the startup time is reduced by 62%, so it really pays off to use compressed textures.

Note that all these can be directly achieved using the latest Qt 3D Studio 2.2 release and using the supported texture compression for the graphics assets.

Dragon – the New Renderer and Animation System for Qt 3D Studio

The default renderer and animation system of Qt 3D Studio 2.2 are still based on the same version as before. But behind the scenes we are also working on a new renderer and animation system codenamed “Dragon”, bringing performance improvements to the Qt 3D Studio Runtime. These are still experimental with Qt 3D Studio 2.2, but can be enabled to achieve some improvements. The intention is to make the “Dragon” renderer and animation system the default choice with the Qt 3D Studio 2.3 release (scheduled for March 2019).

To see the impact of the new renderer and the animation system on the CPU usage, we tested it on NVIDIA Jetson TX2 (64bit ARM embedded processor) and Intel i7-6700 equipped with NVIDIA Quadro P2000 graphics (i.e. a regular desktop PC), both running Linux as the operating system. Same test scenes as with the texture compression benchmark were used, but with no compression applied (as the texture compression is handled with the GPU, it’s not so relevant for the CPU benchmarking).

This time we compared the default Qt 3D Studio 2.2 with the Qt 3D Studio 2.2 running the new Dragon renderer (experimental with the 2.2 version) and the new animation system coming with Qt 3D Studio 2.3.

qt3dstudio_cpu_tx2

The CPU load is reduced on average by 45% with the NVIDIA TX2. The reduction varies a bit between the scenes, but is roughly on the same level (38-49% improvements in the different test cases).

qt3dstudio_cpu_i7

Running the same comparison on an Intel i7 desktop PC, the CPU load reduction is 63% on average (59-67% improvements in the different test cases).

As seen from the results, the new Dragon renderer provides important optimization for the CPU utilization. The new renderer improves the CPU usage especially in scenes where there are many objects, but only a few of them animated between frames. It detects changes in different objects and ensures that interdependent jobs only process necessary intermediate values. The new renderer alone will not improve scenes where all objects are continuously animated, but it can significantly cut down the CPU usage in certain scenes.

The animation system has also been overhauled to minimize the processing performed for animated values. Previously, animations would be offloaded to a backend job, but this turned out to degrade performance due to additional copying and processing in the offloading step. By coupling the animation system more tightly to the renderer, we have managed to bring down the CPU usage in highly animated scenes as well. The tighter coupling has also made the data flow simpler, which makes the code easier to reason about and maintain.

To enable the new Dragon renderer set the Q3DS_DRAGON environment variable to 1 using the new Qt 3D Studio 2.2 release. The animation system is part of Qt 3D Studio 2.3 release, so to try that one out, use the master branch and enable the animation system by setting the environment variable DRAGONWINGS to 1. The animation system feature is already merged and will be part of the Qt 3D Studio 2.3 release in March 2019.

Getting started with Qt 3D Studio 2.2

The easiest way to get Qt 3D Studio 2.2 is through the Qt online installer. The Qt online installer and offline installers can be obtained from the Qt Download page and commercial license holders can find the packages via their Qt Account. Binary packages are available for Windows, Mac and Linux. If you are using Qt for Device Creation 5.12 images the Qt 3D Studio 2.2 Runtime and Viewer are already included in the images. Please also note that Qt 3D Studio runtime uses Qt 3D module for rendering which means that Qt 3D Studio 2.2 requires Qt 5.12 LTS.

Get Qt 5.12 LTS & Try Qt 3D Studio 2.2 For Free  Now

The post Qt 3D Studio Performance Improvements appeared first on Qt Blog.

 

Previous
Tableview performance
Tableview performance

In my previous blog post, I wrote about the new TableView for Qt-5.12. What I didn’t mention was how the ne...

Next Article
Qt for Python 5.12 Released
Qt for Python 5.12 Released

As mentioned in the Qt 5.12 release blog we finally reached the point that we can announce the first releas...

When you play the Game of Code, you use Qt or it's the end for you!

Get Qt 5.12 LTS