In molecular modeling and visualization, lighting plays a key role in making scenes more comprehensible. Lights can make molecular structures clearer, emphasize important regions, and improve overall realism — but working with complex scenes can quickly become frustrating when you’re not sure which lights are active or visible.
For those working in SAMSON, the integrative platform for molecular design, understanding the visibility controls for light nodes can help avoid confusion and save time. This post introduces a practical set of attributes from the Node Specification Language (NSL) that let you efficiently check and manage the visibility of lights in your molecular scene.
Why lights might disappear
When you load or build complex molecular models that include multiple light sources, it’s not always obvious which ones are visible at any moment. You might encounter cases where:
- A light is present but doesn’t affect the scene.
- You can’t tell if a light is disabled, hidden, or just not positioned in an effective location.
Instead of clicking through panels or guessing, NSL allows you to be precise and fast. Here’s how.
The visible and visibilityFlag attributes
In NSL, light node visibility can be managed through two attributes:
visible(v): A dynamic attribute indicating whether the node is currently visible in the scene.visibilityFlag(vf): A user-defined flag indicating whether the node is supposed to be visible.
The key distinction is that vf is more about intent (what you’ve set manually), while v reflects the actual visibility state, which might be affected by other conditions in the scene (e.g., parent node visibility).
Quick filtering examples
Want to find out which lights are actually visible? Use:
|
1 |
li.v |
To get the lights that are not currently visible:
|
1 |
not li.v |
If you’re interested in identifying lights you’ve marked as invisible:
|
1 |
li.vf false |
This kind of fine-grained control is especially useful when working on presentations, simulations with multiple lighting setups, or when debugging rendering issues in your molecular model.
Bonus: Check if lights are hidden
You can combine visibility filtering with the hidden attribute, inherited from the general node space. For example, to find all lights that are hidden, use:
|
1 |
li.h |
To get lights that are visible and not hidden:
|
1 |
li.v and not li.h |
Using visibility in automation
Since these attributes can be queried programmatically through scripts or automation tools in SAMSON, they also support batch lighting checks and scene management. If you’re preparing scenes for animation or publication, automating lighting controls can reduce errors and ensure reproducibility.
Learn more in the full Light attributes documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
