Making light nodes appear or disappear in SAMSON with visibility flags

Molecular modelers working with complex scenes often need to manage multiple light sources to optimize visual renderings. However, coordinating which lights are actually displayed in a rendered view—without deleting or restructuring the scene—can be tricky. What if you just want to temporarily hide a light, or toggle visibility for rendering comparisons?

Fortunately, SAMSON’s Node Specification Language (NSL) offers a straightforward way to handle this using light node visibility flags. Understanding and using these flags can make a big difference when polishing the visual aspects of your scene.

What are visibility flags for light nodes?

In SAMSON, each light node has several attributes that define its state. These include:

  • visible (li.v) — Whether the light is currently visible in the scene
  • visibilityFlag (li.vf) — Whether the visibility setting is active

These two attributes work together. For example, a light may be set as visible = true, but if the visibilityFlag is false, SAMSON will disregard its visibility during rendering. This allows modelers to tag lights with different combinations of attributes and then script or toggle their visibility dynamically during workflows.

Use cases

Consider a scenario where you’re fine-tuning the lighting in a macromolecular assembly. You’ve added several directional and ambient lights, but you want to compare the effects of different configurations without losing your current setup. Instead of deleting lights or restructuring the hierarchy, you can:

  • Mark some lights with li.v = false to immediately hide them
  • Toggle li.vf to completely enable/disable visibility control for a light

This flexibility becomes crucial when you’re preparing visuals for publication or presentation. You can set up multiple lighting scenarios and switch between them by toggling visibility flags in scripts, without needing to manually reconfigure light sources each time.

Example queries

Here are some ways to use these attributes in NSL:

Note that lights with visible = true but visibilityFlag = false won’t appear in the rendered view. To ensure a light is active, both li.v and li.vf must be true.

Managing visibility interactively

If you’re building NSL queries to manipulate light nodes in the SAMSON UI or using scripts, combining visible and visibilityFlag makes it easy to group lights by role—e.g., backlights vs. key lights—and toggle them in groups.

You might even use the name attribute (with li.n) to target specific lights by pattern, then change their visibility dynamically.

For example:

This provides a clean and systematic way to manage visual complexity.

Conclusion

Whether you’re staging molecules for a cover image or analyzing the impact of lighting on your models, visibility flags in SAMSON light nodes give you precise control over your scene’s illumination. It’s a subtle yet super practical feature that can save time, reduce clutter, and lead to better visual outcomes.

To learn more about managing light attributes in SAMSON using NSL, visit the official documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. Download SAMSON at https://www.samson-connect.net.

Comments are closed.