The Glow Boarder Effect Renderer contains shader setup with a glowing boarder effect for selected objects. The user can turn the glow border effect on and off and select glow color for individual objects. Either automatically or manual camera update can be selected. In automatic mode the the internal camera will use the current camera to align the internal rendering. See Manual updating the camera for details regarding manual mode.
The GlowBorderEffectRender scene is included in the scene tree and objects that should recevie the glow border effect must include the GDScript glow_border_effect_object.gd on a Spatial node that is a parent to any VisualInstances the object may consists of. In the demo project the GlowingObject is a Spatial node with a MeshInstance as the child.
If Automatically Update camera is uncheck on the Glob Boarder Effect Renderer the internal camera need to be updated manually. The script below show how to update the camera manually. This isn't needed if automatically update is selected.
# Called when the node enters the scene tree for the first time.
func _ready():
# Update the internal cameras in the glow border effect renderer.
_glow_border_effect_renderer.set_camera_parameters(self)
# Turn on notification for camera transform changes.
set_notify_transform(true)
# Called when the node receive notifications.
func _notification(what):
# Update the camera transform each time the camera transform change
if what == NOTIFICATION_TRANSFORM_CHANGED:
_glow_border_effect_renderer.camera_transform_changed(self)
Inside the GlowBorderEffectRender a number of ViewportContainers and Viewports are used with shaders that first in the prepass render a shadow instance of each of the objects with glow border effect enabled. The prepass is so filtered with a blure filter to produce the glowing effect. Finaly the scene is rendered with a shader that do:
scene_color + (blure - prepass)
The different steps are illustrated in the screendump below from the glow_border_efffect_explained scene.