Displaying scene grid for reference images

When modeling “by reference”, it is sometimes necessary for the 3D scene grid to be displayed on top of the reference image. This makes it easier to snapping and relate the model being built to the scene as a whole.

First, let’s add a reference image to the scene.

The reference image is added to the scene using the empty_image_add() operator. Since this operator is context-sensitive, to call it from the console or the Text Editor area, we need to use the context override with temp_override().

In the operator parameters, we pass the full path to the embedded image, set the alignment to the 3D viewport and immediately rotate it vertically relative to the Z axis.

Now we can get a pointer to our embedded image from the list of scene objects.

To show the scene grid on the image, we can use two ways:

The first is to make the image transparent.

To do this, we must enable transparency by setting the use_empty_image_alpha parameter of the image to True.

As we can see, the grid appears on the image immediately, even though the default transparency level is 1 (the object is considered opaque).

The color property, which all objects have, is responsible for displaying objects in the 3D scene. The fourth channel of the color property is responsible for transparency. Therefore, to increase the transparency of an object in the scene, we need to decrease the value of its color[3] property.

Note that when increasing the transparency, objects located behind our reference image also become visible. Their visibility depends on the transparency value of our image – the higher the transparency, the more the objects located behind appear.

The second way for enabling the display of the scene grid on the reference image is to change its relative location.

The empty_image_depth parameter is responsible for this, which can take three values: “DEFAULT”, “FRONT” and “BACK”.

Set this parameter to “BACK”.

The scene grid again becomes completely visible on our reference image.

In this case, objects located behind the image also immediately and completely become visible and will overlap our reference.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments