Displacement with Geometry Nodes

Let’s look at how we can use displacement with the “Geometry Nodes” in Blender.

First, add a cylinder (with the 0.1 diameters, without upper and lower closing polygons) to the scene: shift+a – Mesh – Cylinder.

Switch to edit mode (tab) and add edges to make the uniform grid: ctrl+r – 100 – Enter.

Continue reading “Displacement with Geometry Nodes”

Ortho lighting

When the scene is lighted with “Spot” or “Point” light sources, the rays from such lamps do not propagate in parallel. This makes noticeable distortion, for example when lighting with textures.

 

The parallel ray’s propagation (orthogonally to its plane) we can get from the “Sun” lamp, but such light source does not support lightning with textures.

Continue reading “Ortho lighting”

How to calculate the Bounding Sphere for selected objects

Most often, for quick simplified calculations with the object’s geometry, their Bounding Boxes are used – the minimum parallelepiped into which this object is inscribed. But sometimes the Bounding Sphere – the minimum sphere into which an object can be inscribed – can provide greater accuracy and simplify the calculations. While the location and size of the object’s Bounding Box is available in Blender at once, the Bounding Sphere we need to calculate manually

Let’s write a function that, based on the object list, returns the coordinates of the center of their Bounding Sphere and its radius.

Continue reading “How to calculate the Bounding Sphere for selected objects”

Localization of Blender add-ons – with API

The classic way of localizing a Blender add-on (translating it into different languages) is convenient because requires just a single Blender Python API call – to get the currently used locale. This way is maximum universal, but Blender would not be Blender if it did not provide users an ability to localize add-ons through its own API.

The principle of creating multilingual add-ons using the Blender Python API is not much different from the classical one – we need to create a dictionary with all the variants of translations for all text strings from our add-on and use this dictionary in the localization.

Continue reading “Localization of Blender add-ons – with API”

Localization of Blender add-ons – classical way

If you want your add-on to be available for all Blender users around the world, you need to make the localization – translation of its interface into different languages.

The simplest way to make your add-on multilingual is the classic way, it is used in many other programs and requires the minimal usage of the Blender Python API.

Continue reading “Localization of Blender add-ons – classical way”

Another way to add code autocomplete when developing Blender add-ons in Visual Studio Code

To improve the speed and convenience of developing Blender add-ons with Microsoft Visual Studio Code, this IDE can show the code auto-completion for common Blender API types.

This way of adding autocomplete is by Zen3515.

Continue reading “Another way to add code autocomplete when developing Blender add-ons in Visual Studio Code”

How to get the render pixels coordinates in compositing

When fine-tuning the finished render in “Compositing”, sometimes it is necessary to refer to the pixels coordinates of the processed image, for example, to apply effects distributed over the entire width or height of the image.

We can get the distribution factor of coordinates along with the height or width of the rendered image using texture nodes.

Continue reading “How to get the render pixels coordinates in compositing”

User interface elements alignment by columns

Interface elements in custom user panels often do not correspond to each other in size. As a result – the overall panel layout does not look beautiful. As an example, let’s create a custom panel and place an operator button and an input text field on it.

Can we make it more accurate?

Continue reading “User interface elements alignment by columns”

Render from console only on the specified GPU devices

Sometimes, to effectively distribute the hardware load it is necessary to make a render from Blender only on certain video cards of several of them.

To do this we can use a simple script in which specify the numbers of devices to be used for rendering.

Continue reading “Render from console only on the specified GPU devices”

Assigning custom properties to vertexes

Working with mesh geometry, it may be necessary to assign each vertex some custom properties or data that must be written to the blend-file when saved, and which must be accessed later.

However, an attempt to assign the necessary data to the vertexes through the creation of custom properties fails. Instead of the custom vertex property, only a tuple with reference to the type of the property is created.

Continue reading “Assigning custom properties to vertexes”

How to save mesh data to text

Sometimes it is necessary to save data for creating a mesh (its vertices and polygon indices arrays) to text, for example, for further use in a script or addon.

We can export the mesh to one of the open formats, for example, to *.obj, but if we need only its vertexes and polygons data, we can use the following simple script:

Continue reading “How to save mesh data to text”

Custom property

The Blender API provides a set of simple property types described in bpy.props (IntProperty, BoolProperty, etc.). But the basic types are not always enough, sometimes we need more complex ones. The Blender API allows to group simple properties to make complex properties.

Let’s consider such complex property creation and make the 3×3 matrix property as an example.

Continue reading “Custom property”