Enabling ghost environment mode in Blender

When working with a mesh surrounded by other objects in a Blender scene, we often need to ensure that all other objects don’t obscure it and interfere with precise modeling. In this case, the easiest way is to enable object isolation mode (pressing the “/” key), which hides everything surrounding the object from the screen. However, sometimes we need to simultaneously work with the mesh and control and relate it to its surroundings. In these cases, the “ghost” mode is best suited—when all surrounding objects appear translucent and don’t interfere with our work, but still allow us to perceive and control the scale and position of the object in the scene.

This mode is available by default in Sculpt mode. It can be enabled in the 3D viewport options by checking the “Fade Inactive Geometry” checkbox, and the environment transparency value is adjusted by the value in the same field, ranging from 0 to 1.

Although this option isn’t available in the 3D viewport’s object/edit mode, we can set up a ghost environment mode ourselves using a simple script.

First, we need to get a pointer to the 3D viewport area.

By default, all objects visible in the 3D viewport are rendered in a color based on the object’s material. However, while modeling, materials are usually not assigned to objects yet. Therefore, we need to switch to the 3D viewport mode, which renders objects using the local object color.

So, we need to switch the viewport shading mode to “OBJECT.”

To access the 3D viewport, we need to use the override context mode.

Now we can loop through all objects in the scene and, if the current object is a mesh and not active, set the transparency of its local material to the minimum value (0.1).

The “else” branch in our code, which we enter only for the active object and remove its transparency, is generally optional. However, it gives us a one-button option to quickly switch to another mesh in the scene, making it opaque, and the entire environment ghosted, simply by clicking on it with the mouse and executing our script again.

To disable ghosted environment mode, we need to do the opposite – loop through all the objects in the scene again and make them opaque.

and also switch the viewport mode back to “MATERIAL.”

Now, by running the script to enable and disable ghost environment mode, we can conveniently work with mesh modeling without losing overall connection to the entire scene.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments