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
qtquick3d-tool-materialeditor.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qtquick3d-tool-materialeditor.html
6
\title Custom Material Editor
7
\brief GUI tool for creating custom materials.
8
9
\section1 The Material Editor tool
10
11
The Material Editor tool is a GUI tool that makes authoring \l [QtQuick3D] {CustomMaterial}{CustomMaterials} for QtQuick3D
12
easier by providing: a real-time preview of the material, syntax highlighting, error reporting,
13
and the ability to export the material to a \l[QtQuick3D]{CustomMaterial} QML component.
14
15
\section2 Usage
16
17
The Material Editor can be launched by running the command:
18
19
\badcode
20
$(QTDIR)/bin/materialeditor[.exe]
21
\endcode
22
23
The Material Editor window consists of two main components, the editor on the left and the preview on the right.
24
25
\image MaterialEditor-main.png
26
27
\section2 Shader editing
28
29
In the editor view there are two editors, one for the vertex shader and one for the fragment shader.
30
When editing the shader snippets the result of those changes will immediately become visible in the preview.
31
If the material could not be assembled a message describing the problem will be visible in the output panel.
32
33
The language used for writing the \l[QtQuick3D]{CustomMaterial}'s shader snippets is Vulkan-style GLSL
34
with some additional keywords that are specific for QtQuick3D, these are easily identifiable by being
35
written in all upper-case characters. The QtQuick3D specific keywords will also be highlighted by the editor.
36
37
For a more detailed overview of the language used in shaders snippets and how they interact with the rest of
38
the rendering pipeline, see the \l {Programmable Materials, Effects, Geometry, and Texture data}{Programmable Materials}
39
documentation.
40
41
\image MaterialEditor-vertex.png
42
43
\section2 Material properties
44
45
The Material Properties section contains the common QML properties for the material.
46
These properties and how they affect the material are described in more details in the \l [QtQuick3d]{CustomMaterial} documentation.
47
48
\image MaterialEditor-properties.png
49
50
\section2 Preview
51
52
In addition to showing how the current material is rendered, the preview panel contains a selection of controls
53
that can be adjusted to see how the material looks under different conditions. These controls allows the
54
user to: Select a different model, toggle the usage of \l{Using Image-Based Lighting}{Image Based Lighting},
55
turn the scene light \b on or \b off, and adjust the rotation of the environment. It's also possible to orbit
56
around the model using the mouse.
57
58
\image MaterialEditor-preview.jpg
59
60
\section2 Uniforms
61
62
The uniform table is where the uniforms used by the shaders are listed. Uniforms can be added, removed or changed
63
at any time, but all uniforms used by the shader snippets needs to be added to the uniform table.
64
Once a uniform is added it will become accessible to both shaders.
65
When exporting the material to a QML component the uniforms will become properties on the material component.
66
67
\image MaterialEditor-uniforms.png
68
69
\section2 Output panel
70
71
The output panel shows diagnostic messages, for example, errors found in the shader snippets.
72
73
\image MaterialEditor-output.png
74
75
\section2 Importing shaders
76
77
Shaders snippets can be imported into the application, these have the file extension \c{.vert} and \c{.frag} and
78
are expected to contain plain-text.
79
Imported shader snippets will of course need to be adapted, manually, if the shader code is not in a language or in a form
80
that's compatible with the \l[QtQuick3D]{CustomMaterial} already (no translation is attempted by the tool.)
81
82
\section2 Saving and loading projects.
83
84
The Material Editor can save or load project files using it's own project format.
85
The extension of the Material Editor project files are \c{.qmp}.
86
\note The Material Editor's project file-format is not intended for runtime usage, it is only intended to
87
be used with the Material Editor.
88
89
\section2 Exporting.
90
91
For the material to be usable from an application it needs to be exported as a QML Component,
92
this can be done by opening the export dialog from the application menu. The export dialog will
93
ask for an output folder, the name of the material component, and the name(s) of the shader snippets.
94
When the material has been successfully exported the output folder will contain a QML Component
95
describing the material together with any shader snippet and texture needed by the material.
96
97
\image MaterialEditor-export.png
98
99
*/
qtquick3d
src
quick3d
doc
src
qtquick3d-tool-materialeditor.qdoc
Generated on
for Qt by
1.14.0