Model Outline
Overview
Interaction needs to be shown by the appearance change of the model when a 3D model is selected in the 3D scene. For example, if you want the model silhouette to glow when a model is selected in the game/Editor, it needs to be achieved through Model Outline, as shown below.
Enabling Model Outline Effects in the Engine
Click Windows (Menu Bar) -> Default Effect to open the Default Effect window in the Editor.
Find Model Outline in the Default Effect window and check Visible to enable the effect.
Select LSceneSettings-1 in the Hierarchy panel, and then check Enable Model Outline under Context Config in the Inspector panel.
Enabling Model Outline by Code
Model Outline can be enabled through code in the game. Obtain the Material List of this model object first, and then enable the outline effect for each material used. To enable the outline, the following four properties need to be set:
- To enable outline (OutlineEnable), you need to pass in true or false in the form of a string.
- Outline color (OutlineColor).
- Outline expand size (ExpandSize), If the given value is 10, then no expand by default.
if nx_name(visual) == "Model" then
if nx_find_method(visual, "GetMaterialNameList") then
local material_table = visual:GetMaterialNameList()
for i = 1, table.getn(material_table) do
visual:SetCustomMaterialValue(material_table[i], "OutlineEnable", nx_string(enable))
visual:SetCustomMaterialValue(material_table[i], "OutlineColor", "0.2, 0.95, 1.0")
visual:SetCustomMaterialValue(material_table[i], "ExpandSize", "0.0")
end
end
Different outline effects can be viewed by setting the related properties of Model Outline in the Default Effect window.
Property | Description |
---|---|
Visible | Used to control whether the outline is visible. |
Draw Seams | Whether to enable seams for overlapping parts of the model when drawing multiple outlines. |
Pixel Size | The thickness of the outline. |
Depth Offset | The offset value of the Model Outline during the depth test (This property is used to adjust the depth culling effect). |
To use the depth culling effect, select LSceneSettings-1 in the Hierarchy panel first, and then check Enable Outline Depth Culling under Context Config in the Inspector panel.
Displaying Effects
Seam Outline


Depth Culling

