If you’re designing molecular scenes in SAMSON and using lighting to enhance visualization—whether for rendering presentations or exploring simulation results—you’ve likely faced the frustration of managing multiple light sources. As scenes get more complex, you’re forced to click light by light, toggling visibility or selection options, often repeating the same tedious steps.
Thankfully, SAMSON’s Node Specification Language (NSL) offers a powerful and precise way to manage and filter light nodes without GUI overhead. In this post, we’ll show how harnessing just a handful of NSL expressions can dramatically improve how you control lighting in your molecular models.
What Are Light Nodes, Really?
In SAMSON, light sources (such as directional and point lights) are represented as light nodes. These nodes influence how molecules and scenes render in terms of illumination and shading. Managing their visibility, selection status, or naming convention through NSL can simplify your workflow.
Accessing Light Attributes
To work with light nodes, use the light attribute space in NSL, abbreviated as li. This means that every reference to a light node attribute starts with li.—for example, li.v for visibility.
Want to hide all visible lights?
|
1 |
li.v |
This matches all visible light nodes. You can reverse it:
|
1 |
not li.v |
to target the hidden ones instead.
Need to find lights by name?
You can search using names with wildcards:
|
1 |
li.n "KeyLight"</code><br><code>li.n "Light*" |
This is especially useful when following naming conventions like “LightMain”, “LightFill”, etc.
Checking if lights are selected?
The selected attribute (no shorthand) lets you identify which lights are active:
|
1 |
li.selected |
Reverse it with:
|
1 |
not li.selected |
Use selection flags for more granularity
li.sf targets nodes with selection flags. This is distinct from selected and is useful in automation scripts or when combining queries.
Typical Use Case: Batch Manipulation
Let’s say you want to quickly hide all lights whose name begins with “Aux” and are currently visible. Combine filters like this:
|
1 |
li.n "Aux*" and li.v |
This query gives you just those lights. From there, you can hide them using context commands or automate via scripts.
A More Efficient Lighting Workflow
Overall, using NSL to manage your light nodes allows you to:
- Save time in complex scenes
- Quickly locate and modify lights by name, visibility, or selection
- Chain expressions to batch process node attributes
Getting comfortable with this syntax can free you from the tedious processes of manual selection and make your modeling sessions smoother and more focused. You can apply other combinations too: searching visible, selected lights with a specific prefix makes light management flexible and efficient.
To learn more, visit the documentation page on NSL Light Attributes.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
