When working on complex molecular models, managing visualization elements such as lights can become overwhelming. Whether you’re lighting your scenes for rendering or just tidying up your workspace, it’s crucial to be able to filter and isolate visible elements efficiently. That’s where the Node Specification Language (NSL) in SAMSON comes in handy.
This post explores how to use the visible attribute in the light attribute space, which is designed specifically for light nodes. If you’re hoping to declutter your view or isolate only visible lighting elements in your scene, this feature might save you time and improve your workflow.
What does ‘visible’ mean in SAMSON?
In SAMSON, every node (object) can have visibility-related properties. For light nodes, which are found in the light (or li) attribute space, the visible attribute refers to whether the light is currently displayed or not.
This attribute is inherited from the general node attributes and can take the value true or false. You can use this flag in NSL queries to filter for visibility easily.
Using NSL to Filter Visible Light Nodes
Here are some practical examples of NSL expressions that selectively match light nodes with specific visibility states:
|
1 |
li.v |
This expression matches all light nodes that are currently visible (i.e., where visible = true).
|
1 |
not li.v |
This selects all light nodes that are not visible, making it easy to detect lights that may be affecting performance or not contributing to the rendered scene.
Why filter invisible lights?
One frequent issue modelers face is the accumulation of invisible lights that clutter the model, especially when copying, pasting, or duplicating scenes. These lights might still consume memory and slow down rendering or visualization pipelines even if they aren’t visible.
Filtering for visible lights helps in:
- Optimizing render performance
- Cleaning up unused or hidden lighting elements
- Ensuring reproducible and clean visual presentations
- Quickly verifying the light sources contributing to your scene
Combining filters for more precision
You can also combine the visible attribute with others like name or selectionFlag to refine your search. For instance:
|
1 |
li.v and li.n "KeyLight*" |
This will select visible lights whose names start with “KeyLight”.
|
1 |
not li.v and li.sf |
This will identify all invisible light nodes that are currently selected—as a quick way to manipulate or delete them.
Conclusion
Mastering simple queries like li.v in SAMSON’s Node Specification Language can save time during model cleanup, help with debugging rendering issues, and lead to cleaner scenes. Especially in larger projects, quickly understanding what’s visible in your environment allows you to focus on what matters most.
You can learn more about light attributes and other NSL features in the documentation page: https://documentation.samson-connect.net/users/latest/nsl/light/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
