This is the general interface that describes a Mesh style object.

The Mesh style object defines styling expressions used by TileSet3DLayer layer to style Mesh data. All properties are optional.

Since

2019.0

Hierarchy

  • MeshStyle

Properties

colorExpression?: null | Expression<string>

An expression to specify what colors to apply to mesh data.

To create expressions, you must use the factory methods in the ExpressionFactory module. The expression must be well-formed and resolve to a color value.

If you want to update the styling very often, consider using parameters in your expression. Changing the values of parameters is more efficient than replacing the whole expression.

If you define a colorExpression, the texture data, if any, will not be displayed. The color expression will determine the color.

Note that the alpha component of the color is ignored so the color will be fully opaque, unless you enable TileSet3DLayer.transparency.

Default

<code>null</code> If not set, the mesh will use the texture data of the mesh, if any.
displacementExpression?: null | Expression<Vector3>

An expression to displace mesh data.

To create expressions, you must use the factory methods in the ExpressionFactory module. The expression must be well-formed and resolve to a point value.

If you want to update the styling very often, consider using parameters in your expressions. Changing the values of parameters is more efficient than replacing the whole expression.

  // Example of a displacement expression that pushes down everything inside a shape.
var _ = ExpressionFactory;
var shape = _.orientedBox(layer.orientedBox);
meshStyle.displacementExpression = _.pushDown(shape);

Default

null meshes are not displaced by default.

Since

2020.0

facetCulling?: FacetCullingType

This setting determines which side of the surfaces (facets) that make up a mesh are omitted (culled) from the rendering result.

When rendering meshes, all surfaces that make up the mesh face a certain direction. This direction is often called the normal direction. This normal is used to determine if the surface is being seen from the front or the back. When rendering objects that have no holes in them, it is only possible to see the front of all surfaces. Graphics pipelines therefore often don't render the back sides of those surfaces to speed up rendering.

Apart from performance, some applications are made possible by enabling back-face culling. Consider for example a mesh that represents a room. Its normals would all point to the inside of the room. When enabling back-face culling, you can see the walls and floor of the room, without having to move the camera inside the room itself.

In some cases however, enabling back-face culling (i.e. not rendering the back-side of surfaces) can have undesired artifacts. This can for example happen:

  • for objects with incorrect normals. In that case, you will for example only see the inside of a mesh instead of the outside
  • for objects with holes in them. In that case, you won't be able to see the inside of the mesh, even when looking through the hole

Both can be resolved by disabling culling.

By default, no culling takes place and both sides of a surface are painted.

  // Example of enabling backface culling
meshStyle.facetCulling = FacetCullingType.BACKFACE_CULLING;

Since

2021.0.1

lighting?: boolean

Boolean indicating whether lighting effects should be applied to the mesh.

The graphics effects. This boolean indicates whether the lighting graphical effects should be applied to meshes styled with this style.

Default

<code>true</code>
pbrSettings?: null | PBRSettings

Configures the PBR shading effects applied to the mesh.

Default

<code>null</code>

Since

2021.1

selectedColorExpression?: null | Expression<string>

An expression to specify what colors to apply to selected mesh data.

To create expressions, you must use the factory methods in the ExpressionFactory module. The expression must be well-formed and resolve to a color value. This value can also be set to null to prevent selection from changing the color.

If you want to update the styling very often, consider using parameters in your expression. Changing the values of parameters is more efficient than replacing the whole expression.

If you define a selectedColorExpression, the texture data, if any, will not be displayed while selection is active for the selected part of the mesh. The color expression will determine the color.

import {color, defaultColor, multiply} from "@luciad/ria/util/expression/ExpressionFactory.js";
import {OGC3DTilesModel} from "@luciad/ria/model/tileset/OGC3DTilesModel.js";
import {TileSet3DLayer} from "@luciad/ria/view/tileset/TileSet3DLayer.js";

layer.meshStyle = {
selectedColorExpression: multiply(color("rgb(255,148,76)"), defaultColor()),
lighting: false
};

Note that the alpha component of the color is ignored so the selection color will be fully opaque.

Since

2020.0

Default

An orange color expression.
visibilityExpression?: null | Expression<boolean>

An expression to filter mesh data.

To create expressions, you must use the factory methods in the ExpressionFactory module. The expression must be well-formed and resolve to a boolean value.

If you want to update the styling very often, consider using parameters in your expressions. Changing the values of parameters is more efficient than replacing the whole expression.

  // Example of a visibility expression that makes everything inside a shape invisible.
var _ = ExpressionFactory;
var shape = _.orientedBox(layer.orientedBox);
meshStyle.visibilityExpression = _.not(_.isInside(shape));

Default

null meshes are visible by default.

Since

2020.0