Model QML Type

Lets you load a 3D model data. More...

Import Statement: import QtQuick3D 1.14
Inherits:

Node

Properties

Detailed Description

The Model item makes it possible to load a mesh and modify how its shaded, by adding materials to it. For a model to be renderable, it needs at least a mesh and a material.

Mesh format and built-in primitives

The model can load static meshes from storage or one of the built-in primitive types. The mesh format used is a run-time format that's native to the engine, but additional formats are supported through the asset import tool Balsam.

The built-in primitives can be loaded by setting the source property to one of these values: #Rectangle, #Sphere, #Cube, #Cylinder or #Cone.

Model {
    source: "#Sphere"
}

Materials

A model can consist of several sub-meshes, each of which can have its own material. The sub-mess uses a material from the materials list, corresponding to its index. If the number of materials is less than the sub-meshes, the last material in the list is used for subsequent sub-meshes.

There are currently three different materials that can be used with the model item, the PrincipledMaterial, the DefaultMaterial, and the CustomMaterial. In addition the Material Library provides a set of pre-made materials that can be used.

Property Documentation

castsShadows : bool

When this property is true, the geometry of this model is used when rendering to the shadow maps.


edgeTessellation : real

This property defines the edge multiplier to the tessellation generator.


geometry : Geometry

Specify custom geometry for the model. The Model::source must be empty when custom geometry is used.


innerTessellation : real

This property defines the inner multiplier to the tessellation generator.


isWireframeMode : bool

When this property is true and the tessellationMode is not Model.NoTessellation, a wireframe is displayed to highlight the additional geometry created by the tessellation generator.


materials : List<QtQuick3D::Material>

This property contains a list of materials used to render the provided geometry. To render anything, there must be at least one material. Normally there should be one material for each sub-mesh included in the source geometry.


pickable : bool

This property controls whether the model is pickable or not. By default models are not pickable and therefore not included when picking against the scene.


receivesShadows : bool

When this property is true, shadows can be cast onto this item. So the shadow map is applied to this model by the renderer.


source : url

This property defines the location of the mesh file containing the geometry of this Model or one of the built-in primitive meshes listed below as described in Mesh format and built-in primitives.

  • "#Rectangle"
  • "#Sphere"
  • "#Cube"
  • "#Cone"
  • "#Cylinder"

tessellationMode : enumeration

This property defines what method to use to dynamically generate additional geometry for the model. Tessellation is useful if you are using a displacement map with your geometry, or if you wish to generate a smoother silhouette when zooming in.

ConstantDescription
Model.NoTessellationNo tessellation is used. This is the default.
Model.LinearTessellation uses linear generation.
Model.PhongTessellation uses Phong generation.
Model.NPatchTessellation uses NPatch generation.

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.