If you’re working on scene composition or molecular visualization in SAMSON, there’s a good chance you’re regularly managing light sources—either for clarity, aesthetics, or scientific accuracy. But as complex molecular systems grow, so do the number of light nodes. This can make it tedious to find and tweak specific lights, especially when developing reproducible scenes or automating workflows in the Node Specification Language (NSL).
Good news: SAMSON provides a clean and systematic way to filter and manipulate your light nodes efficiently using light-specific attributes in NSL. These attributes belong to the light attribute space (short name: li) and allow for powerful queries. Here’s how you can use them to quickly streamline your work.
Filtering Hidden or Visible Lights
Want to isolate hidden lights or show only those currently affecting the scene? Use the li.h (hidden) or li.v (visible) attributes.
li.h– selects all hidden light nodesnot li.h– selects all visible onesli.v– similar, selects visible lightsnot li.v– selects lights currently invisible to the viewer
This is extremely handy when you want to remove all invisible lights or identify lighting elements that might be affecting rendering.
Select Lights by Name Patterns
If you or your collaborators follow a naming convention for lights (e.g., “KeyLight”, “FillLight”), use the li.n attribute to filter them.
li.n "Fill*"– selects all lights with names starting with “Fill”li.n "*Light"– selects lights ending with “Light”
This is ideal when working on scene templates where lights are reused across simulations or presentations. You can rename lights programmatically or manually, then use queries to isolate and manipulate groups of lighting elements.
Use Selection Flags Like a Pro
Two lesser-known but useful attributes are li.sf (selectionFlag) and li.vf (visibilityFlag). While “selected” is a status in the UI, these flags provide an extra layer of logic, especially when you’re scripting or running batch operations:
li.sf– selects light nodes with their selectionFlag enabledli.vf– selects lights marked for visibility without depending on external conditions
Use these when you want to isolate lights marked for editing or lights that are conditionally visible in template workflows. They can also be helpful for maintaining visual consistency when switching between different molecular assemblies with the same lighting schema.
Put It All Together
Here are a few practical combinations you might find useful:
|
1 |
li.h and li.n "DebugLight*" |
Selects all hidden lights used for debugging.
|
1 |
not li.h and li.vf |
Selects visible lights that have their visibilityFlag enabled—these are likely the ones directly illuminating your scene.
|
1 |
li.sf and not li.v |
Finds lights marked for editing but currently invisible—possibly a mistake to correct before exporting.
As your NSL skills grow, these kinds of attribute inspections can save time and help avoid rendering issues due to misconfigured or hidden lights.
To explore the full list of light-specific attributes and see usage examples, visit the full documentation:
https://documentation.samson-connect.net/users/latest/nsl/light/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
