| 1 |
// Copyright (C) 2017 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only |
| 3 |
|
| 4 |
/*! |
| 5 |
\example advancedcustommaterial |
| 6 |
\title Qt 3D: Advanced Custom Material QML Example |
| 7 |
\ingroup qt3d-examples-qml |
| 8 |
\brief Demonstrates creating advanced materials in Qt3D. |
| 9 |
|
| 10 |
\image advanced-custom-material.jpg |
| 11 |
|
| 12 |
\e This example demonstrates creating advanced custom materials. |
| 13 |
|
| 14 |
\include examples-run.qdocinc |
| 15 |
|
| 16 |
\section1 Description |
| 17 |
|
| 18 |
Advanced custom material example shows more complex shaders, and demonstrates controlling your |
| 19 |
shader properties with QtQuick user interface and Animation. Water is a 3D mesh, that is |
| 20 |
modeled and uv mapped inside Blender, and then brought into Scene 3D as an \c {.obj} file. |
| 21 |
Shader properties that user can control, are defined in \c {advancedcustommaterial/WaterMaterial.qml}. |
| 22 |
|
| 23 |
\section1 Controls |
| 24 |
\section2 Texture scale slider |
| 25 |
|
| 26 |
Multiplies texture coordinates inside the vertex shader. Controls the size of the textures |
| 27 |
on water surface. |
| 28 |
|
| 29 |
\section2 Texture speed slider |
| 30 |
|
| 31 |
Offsets values for texture coordinates which are animated in |
| 32 |
\c {advancedcustommaterial/Water.qml} and then passed to vertex shader. |
| 33 |
Creates the effect of textures scrolling over the surface. |
| 34 |
|
| 35 |
\section2 Specularity |
| 36 |
|
| 37 |
Multiplies specular texture values inside fragment shader. Makes the water reflective. |
| 38 |
|
| 39 |
\section2 Distortion |
| 40 |
|
| 41 |
Multiplies the offset in red and blue channels of wave texture in fragment shader. |
| 42 |
Makes the surface textures animate more randomly. |
| 43 |
|
| 44 |
\section2 Normal amount |
| 45 |
|
| 46 |
Multiplies the normal map values inside fragment shader. Controls the visibility of |
| 47 |
smaller waves on the water surface. |
| 48 |
|
| 49 |
\section2 Wave speed |
| 50 |
|
| 51 |
Modifies the frequency of the sine wave inside vertex shader. Controls the speed of the waves. |
| 52 |
|
| 53 |
\section2 Wave height |
| 54 |
|
| 55 |
Multiplies the vertex \c {Y} position inside vertex shader. Controls the height of the waves. |
| 56 |
|
| 57 |
\section2 Mesh rotation |
| 58 |
|
| 59 |
Rotates the water mesh in \c {advancedcustommaterial/Water.qml}. |
| 60 |
*/ |