When working with complex molecular systems in SAMSON, lighting plays a key role in visualization. However, troubleshooting or adjusting the lighting setup — especially in large, multi-light scenes — can become inefficient if you’re relying solely on manual selections and toggling visibility through the UI.
Wouldn’t it be easier if there were a way to instantly view or isolate only visible lights? Or perhaps hide all lights with a specific name? That’s where the Node Specification Language (NSL) in SAMSON becomes incredibly handy, thanks to the dedicated light attribute space.
Understanding the light attribute space
The light attribute space — which uses the short prefix li — targets only light nodes in your document. This allows selective operations on lights without affecting atoms, bonds, or other nodes in the scene.
The light space inherits standard NSL attributes from the general node category, and among them, two are especially valuable for managing visibility:
li.visibleorli.v– Whether a light is currently visible.li.visibilityFlagorli.vf– Whether the light node can be shown or hidden.
Let’s look at a couple of use cases where these queries can save you time.
Use Case 1: Highlight Only Visible Lights
Say you’re unsure which lights in your scene are active. Instead of scrolling through a list, you can simply use the following code in the NSL query box:
|
1 |
li.v |
This instantly selects all lights that are currently visible.
Use Case 2: Select and Hide All Lights
If you want to quickly hide all light sources (for example, to isolate ambient lighting effects or troubleshoot shading artifacts), try this:
|
1 |
li.v |
This selects all visible lights. Then, you can toggle their visibility using the inspector panel in the user interface.
Alternatively, you can combine this with the li.vf flag to ensure lights are not only visible, but also have visibility control enabled:
|
1 |
li.v li.vf |
Use Case 3: Filtering Lights by Name
If you follow a naming convention like KeyLight_1, KeyLight_2, etc., you can isolate all of them using a name-based query:
|
1 |
li.n "KeyLight*" |
This lets you change visibility or properties of just those lights without affecting others like fill lights or rim lights.
A Practical Tip
If you often switch lighting setups between presentations, simulations, or exports, storing and reusing these NSL queries can streamline your workflow.
To see a complete list of attributes available in the light attribute space and how they behave, check out the original documentation below.
Learn more in the SAMSON Documentation
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
