C

Creating Binary Presentations

In order to optimize the load times and playback experience of a project, Qt 3D Studio allows a presentation to be compressed into and viewed in binary format. This is a recommended step of deploying a project in a production environment. There are two types of compilation, available in different formats:

  • Compiling the presentation assets for faster loading
  • Gathering shader information to precompile them at application launch

Read on for further descriptions of what these mean, how to accomplish them, and when and when not to do them.

Compiling Assets

What it Does

Compiles .uia and .uip files to a binary representation. This can speed initial loading of an application substantially.

How to Do It

From the command line on Windows, run the Qt3DCompiler.exe application (in your installation directory next to Qt3DStudio.exe) passing a command line argument of the .uia application file.

Qt3DCompiler.exe \path\to\project\MyAppName.uia

The files end up in a binary/ directory next to your .uia application file. You can then run your application by passing the .uib file to the Viewer.

Qt3DViewer.exe \path\to\project\binary\MyAppName.uib

When To Do It

Only perform binarization when:

  • you are about to deploy your content for production or demo, or
  • you need to test loading speeds of your content.

Once you perform binarization subsequent changes to your presentations will not be reflected in the runtime until you delete the binary folder, or re-run binarization. Prematurely running binarization, and then forgetting that you have done so, is a good way to run into head-scratching problems later on.

Gathering Shaders

What It Does

In short, it removes performance hiccups due to shader compilation in the middle of application execution by precompiling the necessary shaders when your application first starts.

Background

When you are working on a project you will see lines like this in the output each time you preview your presentation:

eDEBUG_WARNING Failed to find file: /path/to/project/binary/shadercache.xml
eDEBUG_WARNING Searched paths:
eDEBUG_WARNING /path/to/project/binary/shadercache.xml

Although it may look bad ("it has three lines, and said `failed'!") this is not an error. It is only a warning about potential performance problems. In short, ignore these log lines until you are either testing loading speed and performance, or you are preparing your content for final production use.

About Shaders and Shader Compilation

The Qt 3D Studio Runtime uses shaders to render your content at high speed. Shaders are mini programs that run on the graphics card. As programs, they need to be compiled to run, and they have to compile on the graphics card itself. Depending on the Standard Material settings or custom materials used in your presentation, you may have several shaders that need to compile. Compiling each shader takes a short amount of time (depending on the complexity of the shader)...but however slow or fast it is, it is not instant.

Because of the dynamic nature of Studio presentations, and the fact that different settings for a Standard Material may cause a different shader to be generated, the Runtime does not know in advance what shaders may be necessary. Only once you go to a particular slide where a combination of settings are applied does it "see" the material for the first time, and need to compile it to render your content. The result when this happens is that you may experience a slight lurch when you switch to a particular slide for the first time.

How to Do It

You can remove any performance lurches by pre-compiling the shaders you will need when the presentation starts up. This is what the shadercache.xml file is for. This file tells the Runtime all the information it needs about all the shaders that will be required. When present, the Runtime creates all the shaders at startup, so they are ready when needed.

When to Do It

The presence of a shadercache.xml file can cause old shader information to be cached and used instead of your current information. If custom materials are updated - or the implementation is updated in a new Qt 3D Studio releases - your old shader cache can override the new information, causing rendering problems. You should only generate a shader cache when you need to test final performance, or display a demo where you cannot pre-navigate the interface once to cause the compilation to occur and remove any hiccups.

Available under certain Qt licenses.
Find out more.