Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize Model entity highlight in Cesium Development

Shulou Source: shulou.com Published: 2022-06-01 03:41:40 10月05日 Update

This article is about how to achieve model entity highlighting in Cesium development. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

When selecting the model object of Cesium, you need to highlight the effect, by setting the highlight color to the surface or periphery of the model to achieve the effect of highlighting the model.

When the Entity entity looks up or clicks Entity, get the object, and then cover the surface of the model with a layer of color by changing the color of model in Entity. The specific effect is as shown below:

Highlight the model in red and use the color class of Cesium in the order that R\ G\ B\ An is transparent and the range is 0-1, so there needs to be a conversion of values in the middle when using color values in the range of 0-255. Entity.model.color = new Cesium.Color (1.0,0,0,1.0); if the model is not highlighted, you can set the model color to empty or white: entity.model.color = null; or entity.model.color = new Cesium.Color (1.0,1.0,1.0,1.0) When set in this way, although the transparency setting is opaque, you can still see the model, so that the highlighting effect is not obvious when the model is small or dark. At this point, you can set the colorBlendMode of the model to replace mode, so that the model is replaced with color.

Entity.model.colorBlendMode = Cesium.ColorBlendMode.REPLACE

The effect is as follows:

If you don't think this replacement works well, you can set contours around the model:

Entity.model.silhouetteColor = new Cesium.Color (1.0,0,0,1.0); entity.model.silhouetteSize = 2.0. The effect is as follows:

Thank you for reading! This is the end of the article on "how to achieve model entity highlighting in Cesium development". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Model color highlight effect entity development content perimeter object time more article scope surface transparency good practical obvious bad article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology vpn MariaDB Linux macOS