<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- advancedcustommaterial.qdoc --> <title>Qt 3D: Advanced custom material QML Example | Qt 3D 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qt3d-index.html">Qt 3D</a></td><td >Qt 3D: Advanced custom material QML Example</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#running-the-example">Running the Example</a></li> <li class="level1"><a href="#description">Description</a></li> <li class="level1"><a href="#controls">Controls</a></li> <li class="level2"><a href="#texture-scale-slider">Texture scale slider</a></li> <li class="level2"><a href="#texture-speed-slider">Texture speed slider</a></li> <li class="level2"><a href="#specularity">Specularity</a></li> <li class="level2"><a href="#distortion">Distortion</a></li> <li class="level2"><a href="#normal-amount">Normal amount</a></li> <li class="level2"><a href="#wave-speed">Wave speed</a></li> <li class="level2"><a href="#wave-height">Wave height</a></li> <li class="level2"><a href="#mesh-rotation">Mesh rotation</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Qt 3D: Advanced custom material QML Example</h1> <span class="subtitle"></span> <!-- $$$advancedcustommaterial-description --> <div class="descr"> <a name="details"></a> <p class="centerAlign"><img src="images/advanced-custom-material.jpg" alt="" /></p><p><i>This</i> example demonstrates creating advanced custom materials.</p> <a name="running-the-example"></a> <h2 id="running-the-example">Running the Example</h2> <p>To run the example from Qt Creator, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit Building and Running an Example.</p> <a name="description"></a> <h2 id="description">Description</h2> <p>Advanced custom material example shows more complex shaders, and demonstrates controlling your shader properties with QtQuick user interface and Animation. Water is a 3D mesh, that is modeled and uv mapped inside Blender, and then brought into Scene 3D as an <code>.obj</code> file. Shader properties that user can control, are defined in <a href="qt3d-advancedcustommaterial-watermaterial-qml.html">WaterMaterial</a>.</p> <a name="controls"></a> <h2 id="controls">Controls</h2> <a name="texture-scale-slider"></a> <h3 >Texture scale slider</h3> <p>Multiplies texture coordinates inside the vertex shader. Controls the size of the textures on water surface.</p> <a name="texture-speed-slider"></a> <h3 >Texture speed slider</h3> <p>Offsets values for texture coordinates which are animated in <a href="qt3d-advancedcustommaterial-water-qml.html">Water.qml</a> and then passed to vertex shader. Creates the effect of textures scrolling over the surface.</p> <a name="specularity"></a> <h3 >Specularity</h3> <p>Multiplies specular texture values inside fragment shader. Makes the water reflective.</p> <a name="distortion"></a> <h3 >Distortion</h3> <p>Multiplies the offset in red and blue channels of wave texture in fragment shader. Makes the surface textures animate more randomly.</p> <a name="normal-amount"></a> <h3 >Normal amount</h3> <p>Multiplies the normal map values inside fragment shader. Controls the visibility of smaller waves on the water surface.</p> <a name="wave-speed"></a> <h3 >Wave speed</h3> <p>Modifies the frequency of the sine wave inside vertex shader. Controls the speed of the waves.</p> <a name="wave-height"></a> <h3 >Wave height</h3> <p>Multiplies the vertex <code>Y</code> position inside vertex shader. Controls the height of the waves.</p> <a name="mesh-rotation"></a> <h3 >Mesh rotation</h3> <p>Rotates the water mesh in <a href="qt3d-advancedcustommaterial-water-qml.html">Water.qml</a>.</p> <p>Files:</p> <ul> <li><a href="qt3d-advancedcustommaterial-sceneroot-qml.html">advancedcustommaterial/SceneRoot.qml</a></li> <li><a href="qt3d-advancedcustommaterial-water-qml.html">advancedcustommaterial/Water.qml</a></li> <li><a href="qt3d-advancedcustommaterial-watermaterial-qml.html">advancedcustommaterial/WaterMaterial.qml</a></li> <li><a href="qt3d-advancedcustommaterial-main-qml.html">advancedcustommaterial/main.qml</a></li> <li><a href="qt3d-advancedcustommaterial-shaders-es2-water-vert.html">advancedcustommaterial/shaders/es2/water.vert</a></li> <li><a href="qt3d-advancedcustommaterial-shaders-gl3-water-vert.html">advancedcustommaterial/shaders/gl3/water.vert</a></li> <li><a href="qt3d-advancedcustommaterial-main-cpp.html">advancedcustommaterial/main.cpp</a></li> <li><a href="qt3d-advancedcustommaterial-advancedcustommaterial-pro.html">advancedcustommaterial/advancedcustommaterial.pro</a></li> <li><a href="qt3d-advancedcustommaterial-models-qrc.html">advancedcustommaterial/models.qrc</a></li> <li><a href="qt3d-advancedcustommaterial-qml-qrc.html">advancedcustommaterial/qml.qrc</a></li> <li><a href="qt3d-advancedcustommaterial-shaders-qrc.html">advancedcustommaterial/shaders.qrc</a></li> <li><a href="qt3d-advancedcustommaterial-textures-qrc.html">advancedcustommaterial/textures.qrc</a></li> </ul> </div> <!-- @@@advancedcustommaterial --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>