Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qt6-changes.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qtquick3d-changes-qt6.html
6
\title Changes to Qt Quick 3D
7
\ingroup changes-qt-5-to-6
8
\brief Migrate Qt Quick 3D to Qt 6.
9
10
Qt 6 is a result of the conscious effort to make the framework more
11
efficient and easy to use.
12
13
We try to maintain binary and source compatibility for all the public
14
APIs in each release. But some changes were inevitable in an effort to
15
make Qt a better framework. Parts of the Qt Quick 3D API have been
16
substantially modified.
17
18
In this topic we summarize those changes in Qt Quick 3D, and provide
19
guidance to handle them.
20
21
\section1 RHI
22
23
From Qt 6.0 onwards, the default adaptation of Qt Quick always renders via a
24
graphics abstraction layer, the Qt Rendering Hardware Interface (RHI),
25
provided by the \l QtGui module. This means that, unlike Qt 5, no direct
26
OpenGL calls are made by the scene graph. Rather, it records resource and
27
draw commands by using the RHI APIs, which then translate the command stream
28
into OpenGL, Vulkan, Metal, or Direct 3D calls. Shader handling is also
29
unified by writing shader code once, compiling to
30
\l{https://www.khronos.org/spir/}{SPIR-V}, and then translating to the
31
language appropriate for the various graphics APIs.
32
33
For Qt Quick 3D the biggest change in Qt 6.0 is the migration to the common
34
Rendering Hardware Interface, which allows Qt Quick 3D to run on Direct3D,
35
Metal and Vulkan in addition to OpenGL and OpenGL ES.
36
37
Qt Quick and Qt Quick 3D are now fully unified in this regard. Any
38
configuration setting related to the RHI, for example, which graphics API to
39
choose to render with, are applicable to both.
40
41
See \l{Qt Quick 3D Graphics Requirements} for further details.
42
43
\section1 Other API changes
44
45
\section2 QML import version
46
47
Starting with Qt 6.0, the version number for QML import statements is the
48
same as the Qt version number. It is now also possible to import a module
49
without specifying a version: this will import the latest version of the module.
50
51
52
\section2 Lighting
53
54
\l {Light::brightness}{Light brightness} now represents an energy multiplier defaulting to 1.0, where
55
Qt 5 would use a percentage value defaulting to 100. In practice this
56
means that all \c brightness values should be divided by 100.
57
58
\c SceneEnvironment.probeBrightness is renamed to
59
\l {SceneEnvironment::probeExposure}{probeExposure} and is also redefined to
60
be a multiplier with a default value of 1.0. That is, all \c probeBrightness values
61
should be renamed to \c probeExposure and divided by 100.
62
63
64
\c AreaLight has been removed for performance reasons. In many cases it can be replaced
65
with \l SpotLight, which was added in Qt Quick 3D 5.15.
66
67
\section2 Custom Materials
68
69
The custom materials API has been completely reworked in 6.0. This means
70
any existing custom materials will have to be substantially rewritten.
71
See the \l CustomMaterial documentation for details of the new API.
72
73
\section2 Post-processing Effects
74
75
\l Effect has been enhanced to allow for shader code that is very close to
76
what \l CustomMaterial supports, following the same patterns when it comes
77
to structure and built-in keywords. This means that existing effects
78
involving custom shader code will need to be migrated before they can
79
function in Qt 6.0. See the \l Effect documentation for details.
80
81
\section2 Principled Material
82
83
The \l PrincipledMaterial QML type has been greatly improved in Qt Quick
84
6.0, and now more closely follows the principles of Physically Based
85
Rendering. Imported models should now render correctly without changing
86
properties of the materials. Existing materials will need to be changed to
87
undo any compensations for previous inaccuracies.
88
89
\table
90
\header
91
\li PrincipledMaterial in Qt 5
92
\li PrincipledMaterial in Qt 6
93
\row
94
\li \image quick3d-principled-qt5.png
95
\li \image quick3d-principled-qt6.png
96
\endtable
97
98
Some properties change their defaults:
99
100
\list
101
\li \l{PrincipledMaterial::metalness}{metalness} defaults to 0 instead of 1.
102
\li \l{PrincipledMaterial::specularAmount}{specularAmount} defaults to 0.5 instead of 0.
103
\endlist
104
105
\section2 Default Material
106
107
Some properties change their defaults:
108
109
\list
110
\li \l{DefaultMaterial::specularRoughness}{specularRoughness} defaults to 0 instead of 50.
111
\endlist
112
113
\section2 Predefined materials
114
115
There are no predefined materials included in QtQuick3D 6.0. Any
116
materials added in future releases will probably not be compatible with
117
the old ones. The Materials import does not exist. (The CustomMaterial
118
type is moved to the base QtQuick3D import.)
119
120
These are the material QML types that have been removed in Qt 6.0:
121
122
\list
123
\li AluminumAnodizedEmissiveMaterial
124
\li AluminumAnodizedMaterial
125
\li AluminumBrushedMaterial
126
\li AluminumEmissiveMaterial
127
\li AluminumMaterial
128
\li CopperMaterial
129
\li FrostedGlassMaterial
130
\li FrostedGlassSinglePassMaterial
131
\li GlassMaterial
132
\li GlassRefractiveMaterial
133
\li PaperArtisticMaterial
134
\li PaperOfficeMaterial
135
\li PlasticStructuredRedEmissiveMaterial
136
\li PlasticStructuredRedMaterial
137
\li SteelMilledConcentricMaterial
138
\endlist
139
140
\section2 Tessellation and displacement maps
141
142
Model tesselation mode is gone due to increased focus on supporting
143
embedded hardware. In addition, as a result, displacement map support has
144
been removed from materials. Similar effects can be achieved with a
145
\l {CustomMaterial}{custom material}.
146
147
\section2 Qt Quick \l{Item}s as children of 3D \l{Node}s
148
149
While syntactically identical, the way 2D child items are handled is quite
150
different internally. In Qt 6.0 there is no implicit render to texture
151
step. Rather, the 2D Qt Quick content is rendered in line, with the
152
appropriate perspective projection, in the same render pass, which provides
153
better performance, lower resource usage, and in some cases potentially
154
improved visual fidelity (with \l Text, for example). See \l{Qt Quick 3D
155
Scenes with 2D Content} for an overview.
156
157
If going through a texture is important for some reason (clipping, opacity),
158
make the 2D \l Item subtree a layer explicitly by setting \c{layer.enabled:
159
true}. This way the behavior is closer to what Qt 5.15 provided.
160
161
The 2D content is no longer centered at the parent Node's origin. Rather, it
162
is the top-level 2D Item's top-left corner that is placed to the 3D Node's
163
origin. Therefore, the top-level 2D Item will often want to specify an
164
anchor, such as, \c{anchors.centerIn: parent}, to get results matching Qt
165
5.15.
166
167
*/
qtquick3d
src
quick3d
doc
src
qt6-changes.qdoc
Generated on
for Qt by
1.14.0