Visual clutter is a common challenge for molecular modelers, especially when working with large and complex systems. Whether you’re assembling multiscale models, debugging simulations, or preparing clean visuals for publication, knowing exactly which parts of your model are visible or hidden at any given time is essential.
Fortunately, SAMSON, the integrative molecular design platform, offers a precise way to manage this through its Node Specification Language (NSL), specifically using attributes in the visualModel space (short name: vm).
Why model visibility matters
Let’s say you’ve loaded a biomolecular system and applied several styles—ribbons, surfaces, and volumetric potentials. Now, you want to focus only on surfaces that are currently visible. Filtering for such visuals manually is time-consuming and can involve scanning through dozens or hundreds of visual model nodes. That’s where using NSL with vm.v and related attributes can save you lots of time.
Working with Visibility in NSL
In NSL, the visible attribute (vm.v) and the visibilityFlag attribute (vm.vf) let you query model elements based on their visibility state.
Here’s how to find visual model nodes that are currently visible:
|
1 |
vm.v |
Likewise, to query everything that is currently hidden:
|
1 |
not vm.v |
If you need more control, you can use the visibilityFlag (vm.vf) attribute, which represents whether a visual model is set to be visible, even if other effects (like parent visibility) hide it:
|
1 |
vm.vf |
Or to find those set to be invisible:
|
1 |
vm.vf false |
Understanding the Difference: vm.v vs. vm.vf
One common point of confusion is that vm.v and vm.vf don’t always produce the same result. The vm.v attribute checks effective visibility—it considers whether the node is actually visible in the SAMSON viewport. Meanwhile, vm.vf reflects the node’s intent to be visible but doesn’t take into account parent visibility or other hierarchical constraints.
So, if you’re not seeing a particular surface, but vm.vf returns true for it, there’s a good chance that it’s hidden only because one of its parents is not visible.
Practical Use Cases
- Cleanup before rendering: Use
vm.vto check what’s showing in your scene and hide or remove unused elements. - Troubleshooting: If your surface isn’t appearing, check both
vm.vandvm.vfto understand why. - Batch modifications: Apply visibility flags selectively to regain control over complex scenes.
These small but effective tricks can significantly speed up your workflow and help you stay focused on the scientific story you’re trying to communicate.
To learn more about all visual model attributes in NSL, including name filters, selection flags, and material ownership, check the full documentation at SAMSON Visual Model NSL Documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
