Highlighting Objects
-
Prerequisite
Description
Sometimes, you need to highlight an object in your scene to attract the user’s attention. A blurry border can be drawn around the object’s contour (outline), so it appears that the object is emitting some light around it. Note that these lights will not be drawn on the object itself, which makes sure we can still clearly view the original object.
Here are 2 examples:
To highlight an object, you need to take 2 steps:- Create a highlight layer. You can think of a highlight layer as a 2D canvas for painting on top of the 3D world.
- Add that object to the highlight layer, so that the contour of that object will be drawn in the highlight layer.
Create a Highlight Layer
Blur Size
This input controls how wide the highlight lines are. Usually you want to keep it no more than 5. When the blur size is large, it will take longer to draw. Here is a comparison:
Name
The second input specifies the name of the highlight layer. If you are only going to use one layer, then you do not need to name it. If you have multiple layers (discussed below), you will need to name them to refer to them later.
Add an Object to a Highlight Layer
Color
You can specify the color of the blurry contour. Note that you can specify different colors for meshes that are added to the same layer.
Highlight Layer Name
If there is only one highlight layer, you won’t need to specify its name here. If there are multiple highlight layers, this input allows you to specify which layer to add this object to.
Remove an Object from a Highlight Layer
After adding an object to a highlight layer, you can turn off its highlight by removing it from the highlight group, using this block:
For the input, if there is only one highlight layer, you won’t need to specify its name here. If there are multiple highlight layers, this input allows you to specify which layer to remove this object from.
Multiple Highlight Layers
When multiple objects are added to the same highlight layer, if they overlap, then their contours are merged, as if they are one object. In other words, no highlights are drawn at their overlapping edges.
Here is the program to achieve this result:
However, if you want each object to have a complete highlight around its own contour, you can create multiple highlight layers, and add each object to its own highlight layer.Here is the program to achieve this result:
Highlighted objects will stand out
When there are multiple objects in the scene, and some of them are highlighted. Then those highlighted objects will always “stand out” against those that are not highlighted. In other words, they will not be blocked behind the non-highlighted objects.
For example, in this program, the green ball is highlighted, but the orange ball is not.
As a result, when we rotate the camera, even when the green ball is behind the orange ball, we can still see it entirely:
-