Managing complex molecular scenes in SAMSON can quickly become challenging when multiple lights are added for visualization. Lighting plays a crucial role in highlighting structural details, but keeping track of what’s visible — especially when debugging rendering settings — can become tedious.
This blog post focuses on an often overlooked but highly useful feature in SAMSON’s Node Specification Language (NSL): the visibilityFlag for light nodes. This small feature can simplify your workflow significantly when dealing with intricate scenes that include multiple light sources.
What is visibilityFlag and Why Should You Care?
Simply put, visibilityFlag (short name: vf) is an attribute inherited from the general node namespace but applicable to light nodes in the li attribute space. This flag determines whether a node — in this case, a light — is flagged as visible or not.
It is distinct from the visible attribute (v), which represents the actual visibility state. Think of visibilityFlag as potential visibility, i.e., whether an element can become visible depending on other conditions — for example, global settings or group states.
Querying Light Visibility
The strength of NSL is that it allows you to query and select nodes programmatically. Here’s how you can use it to retrieve or manipulate visibility flags for lights:
|
1 |
li.vf |
This selects all light nodes where visibilityFlag is true.
On the other hand, to identify lights that are currently not set to be visibly active, use:
|
1 |
li.vf false |
This can be especially helpful for debugging scenes where certain lighting effects are missing or inconsistent. Instead of manually inspecting each light in the hierarchy, you can run a quick query to identify non-visible candidates.
When Would You Use It?
- Diagnosing Rendering Problems: If your scene looks darker than expected, your lights might be flagged as not visible even though they are added correctly.
- Cleaning Up the Scene: Filter and remove unused/invisible lights to declutter your workspace.
- Batch Editing: Combine NSL with scripting to toggle visibility flags across sets of light nodes.
Visibility vs VisibilityFlag vs Hidden
It’s useful to distinguish between these related attributes:
li.v(visible): Current visibility state — influenced by multiple factors.li.vf(visibilityFlag): Whether the object is flagged to be visible.li.h(hidden): Explicitly hidden, overrides other visibility attributes.
Understanding this interaction lets you manage visibility in a more controlled and intentional way. This is particularly valuable in large-scale projects with multiple contributors or multiple light setups for different rendering passes.
Examples
- Find all light nodes intended to be visible:
li.vf - Find all light nodes not flagged for visibility:
li.vf false - Toggle visibility of specific light by name:
li.n "Spotlight1" and li.vf false
These queries will save time and effort when optimizing scenes or diagnosing lighting configurations.
For a complete list of light attributes and their description, visit the official documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.
