How to Quickly Select and Organize Light Sources in Your Molecular Scene

When building a molecular scene in SAMSON, lighting plays a key role in making sure that your visualizations are both scientifically clear and aesthetically compelling. But if your project involves multiple light nodes—think of directional lights, spotlights, or ambient light sources—it can be difficult to keep track of what’s turned on, what’s visible, or even which one is which. This blog post explores how you can use the light attribute space in SAMSON’s Node Specification Language (NSL) to efficiently select, filter, and organize light nodes in your molecular design.

Why This Matters

In molecular modeling, visual clarity is essential. Whether you’re preparing publication-quality figures, aligning structural features, or analyzing systems under varying illumination, knowing which lights are active and how to manage them efficiently saves time and reduces errors.

The Node Specification Language (NSL) provides a powerful way to query and manipulate objects in your scene. The light attribute space (abbreviated li) targets only lighting nodes, allowing fine-grained control over your light sources.

Quick Selection Examples

Using NSL, here are a few practical examples you can use to quickly manage your light sources:

  • Find all visible light nodes:
    li.v
  • Find all invisible light nodes:
    not li.v
  • Select lights by partial name:
    li.n "L*" — this selects all lights whose name begins with ‘L’
  • Hide all selected light nodes:
    li.selected followed by setting hidden attribute to true

Understanding the Attributes

Light nodes inherit several attributes from the more general node attribute space. Here’s a quick guide:

Attribute Short Name Meaning
hidden h Whether the light node is hidden (not displayed)
name n The string name of the light node
visible v If true, the light contributes to the rendering
selectionFlag sf Indicates selection status, can be used for toggles
visibilityFlag vf Controls conditional visibility based on scene state
selected (no short name) If the node is currently selected

Helpful Tips

  • Use quotes for names, e.g. li.n "MainLight"
  • Combine filters to narrow down queries, e.g. li.vf true and not li.h
  • If you’re experimenting with light setups, toggle li.v to quickly test shadow combinations

Use Case: Cleaning Up Lighting Before Export

Before exporting a figure or animation, it’s useful to make sure only relevant light sources are active. A quick query like not li.v allows you to review disabled lights and decide what to remove or reactivate. Similarly, li.selected can help you apply batch settings such as hiding or renaming.

Mastering these simple NSL expressions can help streamline your scene organization and let you focus on designing compelling molecular models.

To explore the full documentation, visit Light attribute space in NSL.

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

Comments are closed.