Paint Group

MANU offers Paint Group as a unique and very convenient tool that allows you to quickly create game objects of large structure. This tool is based on the mechanism of Geometry Instancing, which is used to create objects of the same type (equal mesh data). Its technological meaning is that we create one object that has its own sub objects with their own transformation matrix. This matrix is implemented on one large object. Geometry Instancing helps to visualize multiple copies of a single mesh object in the Scene at once. This mechanism is used most often to create objects of repeated geometry, such as grass, trees, buildings, etc.

Using the Paint Group tool, you may draw many objects at once with a single render call, saving CPU resources.

Paint Group allows you to place objects in the Scene as you like, as well as build dependencies for these objects. Paint Group will help you to do it more interactively and quickly. With this tool, it is like being a painter: you are drawing, applying brushstrokes like an artist. Only instead of a canvas, you have a game scene, and instead of a brush, you use the object you need.

Application examples: Paint Group comes in handy when you need to create objects that should appear repeatedly in a Scene, for example, trees in the forest, clouds in the sky. This can be done quickly by simply right-clicking on the Scene.

How to create a Paint Group?

You can create a Paint Group by clicking on the “brush” button in the Toolbar. After that, the new object - Paint Group - will appear in the Scene Tree.

Paint Group is like a container in which we can add objects, which should be rendered within the Paint Group. Next, we will clone these objects within this Paint Group.

The objects placed in the Paint Group and which we are going to multiply in the Scene will be called Samples. You can add the same objects to the Brush Samples. For example, if you want them to be the same shape, but different colors.

New objects that appear in the Scene as a result of using the Paint Group tool will be called Instances. And the process of creating instances is called Instantiation. Only objects with geometry can be instantiated.

When we create an instance, we sort of re-produce this object within our Paint Group. Technologically, this is different from creating a copy, visually not. An important difference between instances and ordinary objects in MANU is that the created instances do not appear in the Scene Tree. We do not have access to them as to ordinary objects in the Scene.

How do I put an object in the Paint Group?/How to add samples to the Paint Group?

There are 2 ways to put objects in the Paint Group, by using the Scene Tree or the Paint Group Panel.

In the Scene Tree:

  • Go to the Scene Tree and create the Paint Group and objects you need;

  • Then, simply drag the objects in the Scene Tree to the already created Paint Group;

  • To drag objects, hold down the right mouse button and drag the object to the Paint Group;

  • The objects will acquire the brush icon, which means that they have become a sample of this Paint Group and can be instantiated.

In the Paint Group Inspector:

  • Click on the Paint Group in the Scene Tree, and the Paint Group Inspector will appear in the upper right corner of the screen;

  • You will see (+) next to the Brush Samples section. This is the option to add the objects you need to the Paint Group;

  • After clicking on (+), a drop-down list will appear with objects that can be placed in our Paint Group (a list of objects that can be instantiated);

  • Next, we select the objects we need to instantiate, for example, the Tree 1;

  • Now, it has become a brush sampler of the Paint Group;

  • Next, we just click on the Scene and place the instances where we need them.

All created instances will be saved in this Paint Group. When you delete the Paint Group, all created instances will be deleted along with it, since it is considered as one object.

As we can see in the screenshot: we created several instances of the trees, but their representation did not appear in the Scene Tree:

How to manage brush samples in a Paint Group?

Changing the sequence

In the Brush Sample section, objects (samples) are arranged in a certain sequence with which they will be instantiated in the Scene. This sequence can be changed. You can simply adjust it in the Brush Samples section. Select the object you need, right-click it and drag it up or down.

Duplicate & Delete

To increase the frequency of occurrence of a certain object in the Scene, you may need an object duplication function. Or vice versa, you will need to delete some objects in the Paint Group. If you need to delete or duplicate the brush sample, just:

  • Hover over the sample you need;

  • You will see 2 icons “duplicate” and “delete” to the right of the sample;

  • Click on the icon you need. And the sample will be deleted or duplicated according to the choice you made.

It is important to remember that when you delete an object from the Brush Samples section, it will be removed from the Paint Group . If this object is not in the Paint Group, it also cannot be in the Scene.

Applying materials to samples

If you change the material for a sample, it will be applied to all already created instances and will be applied to newly created instances in the future.

To do it, choose the object/sample you need in the Scene Tree, go to the Material Panel and choose the material. The selected material will be immediately applied to all relevant instances in the Scene.

Paint options in the Paint Group Inspector

Let's now look at the paint options presented in the Paint Group Inspector. The Paint Group tool offers 3 modes for rendering instances: Looped order, Random order and Manual.

Looped order mode

Looped order is used when you need objects in the Scene to be placed according to a certain cyclic order. Instances will be put according to the sequence that formed in the Brush Samples section. The sequence will be looped. You can change this sequence by dragging samples in the Brush Samples section.

Random order mode

If you choose the Random order mode, the objects will be drawn in random order in the Scene. Objects from the Brush Samples section will be selected randomly. This mode is convenient when you, for example, create a forest and you need the trees to grow in a random sequence. In this case, it is better to entrust the formation of randomness to the computer.

Manual mode

Sometimes you will need a Manual Instance Setting Mode. In this mode, the selected sample will be instantiated all the time. If you want to change the sample, you need to choose the new one in the Brush Samples section.

Brush modes

Next, let's move on to the brush modes (or modes of your right mouse button). There are 3 brush modes: Single sample, Matrix sample, Erase samples.

Erase samples mode

First, let's look at the Erase samples mode. There are 2 of them in the Paint Group Inspector: Circle erase and Spherical erase. Using them, you may delete instances in the Scene, but other objects (not instances) will not be affected.

Circle erase

When the Circle erase mode is selected, a Circle will appear on the screen. Holding down the right mouse button, you can drive across the screen with the mouse. All objects that fall within the circle radius will be marked in red and will be removed when you release the right mouse button.

Spherical erase

Spherical erase is a mode for deleting objects in the Scene by volume. In this mode, a Sphere appears in the Scene. Click the right mouse button and drag the Sphere over the surface of the Scene. By doing this, you will mark in red the objects that need to be deleted. When you release the left mouse button, all marked objects will be deleted/erased.

Erase radius

The radius size of the Sphere and Circle can be adjusted using the "Erase radius" option. For Circle erase, the radius is set in screen pixels, and for Spherical erase - in scene units.

The large radius will help to remove objects faster and from a larger area. A small radius will help to remove objects pointwise.

Single sample brush mode

In the single sample brush mode, after each mouse click, one instance will appear in the Scene. This mode has its own settings for the object instantiation: Randomize sequence, Randomize rotation, Randomize scale, Surface offset.

You can configure these settings manually, or generate them automatically within the parameters set by you. There is a Randomize sequence option for this.

Randomize sequence

It is important to remember that the New sequence takes into account all the parameters that are presented for randomization.

If we need to generate a new sequence of instances, we can enable the Generate setting. After you click the “Generate” button, a new instance will be generated within the settings we have selected. It is randomly generated.

You can select the “Auto Generate next” setting in order not to constantly regenerate new instances. In this case, a new angle/position/size will be auto-generated each time for each subsequent instance. So, all instances will have a different slope or size within the parameters we have already set.

To enable the “Auto Generate next” setting, simply drag the slider to the right (from gray to green).

Randomize rotation

If you twist Randomize rotation settings, you can change the position of the object relative to the X, Y, Z axes. And then the instances will be drawn according to the selected settings.

If the “Auto-generate next” option is enabled, each next instance will have a different angle of rotation.

Randomize scale

Randomize Scale allows you to set the scaling parameters for the instances that you will draw. Randomize Scale is combined across all 3 axes. Using this parameter, you can adjust the size of the object as a percentage of the sample size. For example, we will determine that the size of our instances should be at least 72% of the sample size, and no more than 150% of the sample size.

If you need to change the size of the instances only along one axis (X, Y or Z) or to do it differently along different axes, you may use the Unlock Axis option.

To enable this option, click on the icon, which is next to the Randomize scale section. After that the new parameters will appear. They allow you to set different values for different axes.

Surface offset

With the Surface offset setting, you can adjust the offset of the instance from the surface on which it is placed. This setting is necessary if you need to raise or lower the instance relative to its original location.

Align to normal

All objects that can be instantiated in MANU are in the mode of sticking to the surface on which they are placed. The angle of inclination of the object will always depend on the surface that will be under this instance and where its normal will be directed.

The normal vector is a vector that shows the direction of the perpendicular of the planes of triangles and quadrilaterals (that is, the polygons that make up 3D objects in game development).

Instances take into account those meshes that are under them: those meshes that are not included in the Paint Group.

In MANU, the Align to normal option is enabled by default.This means that objects are instantiated considering the direction of their normal. They will be placed perpendicular to the surface on which they will be put.

If we disable this option, then all instances will be instantiated in the direction of the Y-axis. So, they will ignore the shape of the object (mesh) on which they will be put and will also ignore the sticking mode.

Matrix sample brush mode

In the Matrix sample brush mode, you can create a matrix of objects and then instantiate it in the Scene in large arrays. Here, the Matrix is a certain array of objects of a certain dimension. After placing the matrix of objects in the Scene, you may edit it pointwise.

You can customize the matrix yourself by selecting a specific sequence of objects. To do it, use the Matrix section and its settings. If you need to create a random matrix where objects are placed randomly switch to the Randomize section after configuring the matrix.

Matrix

Let's first look at the settings in the Matrix section. Here, you select the number of objects in your matrix, and also adjust their location in the matrix relative to the original location of objects in the Scene.

In MANU, by default, the instantiation matrix is an array of size 3x1x3. This means that 3 objects are located on the X-axis, 1 object is on Y, and 3 objects are on Z. This is a standard matrix. It can be changed and customized, here, in the Matrix section.

You can set the number of objects you need along the X, Y, Z axes. To do it, use Count by X, Count by Y, Count by Z options in the Matrix distribution section. Simply, move the sliders to increase or decrease the number of objects along the axes.

In addition, you can move objects in the matrix relative to their original location in the Scene. For this purpose, use the settings "X Offset", "Y Offset" and "Z Offset".

This is how the matrix of 100 trees looks, where 10 trees are located on the X-axis, 1 is on the Y-axis, and 10 are on the Z-axis.

Randomize

Let's now switch to the Randomize section and add randomness to our matrix. Let's make our matrix uneven. This way we will achieve a natural effect, for example, if we want to draw a forest.

Randomize position

With these settings, you can change the distance between objects in the matrix along the X, Y, Z axes. Using these settings, you can place objects in the matrix closer or further from each other.

Random sequence

In the Randomize section, you can also set the sequence of drawing the matrix (instances of the matrix): Generate or Auto generate next. When the “Generate” button is pressed, a new matrix will be generated taking into account the set values of the randomization parameters. When the “Auto generate next” option is enabled, a new matrix will be automatically generated after each instantiation.

Randomize rotation

You can also set the Randomize rotation settings for objects in the matrix. All objects will have a different angle of rotation relative to the selected coordinate axes.

You can set the values by turning the sliders. Or you can write the values manually. To do it, just click on the field inside of the slider and type the value you need.

These values will be used for both directions of rotation. For example, if we specify 15 degrees, then the object can rotate both by +15 degrees and by -15 degrees (i.e. the range will double for each specified degree).

Randomize scale

We can also randomize the scale of objects in the matrix. The objects will change size equally in all three axes relative to the samples’ sizes.

This parameter can be unlocked. Click on the Unlock Axes icon, which is located to the right of the Randomize Scale section, and new options will appear. Using them, you can randomize the size of objects along the X, Y, Z axes in different ways.

Now, just by clicking, fill the space in the Scene with the matrix you created.

In a few seconds you managed to place a huge number of objects in the Scene. All this was rendered as one big object. This is the main advantage of the Paint Group tool. With this tool, you can create many objects of the same type without reducing the performance of the game.

Instantiation of Animation

You can animate instances of the Paint group. To do it:

  • Create an animation of a 3D object and make the object a child of this animation.

  • Next, make this animation a sample of the Paint Group and instantiate it.

In the Game mode, you will see that all these instances are animated as you specified in the animation.

You can also animate objects using a State Machine. To do it:

  • Make a 3D object a child of a State Machine.

  • Describe the animations of this object using the states of this State Machine. Note: animations can be outside the State Machine hierarchy.

  • Next, make a sample from this State Machine and instantiate it in the Paint Group.

In the Game mode, you will see that all instances are animated according to the current state of the State Machine.

Thus, by combining different modes of instantiating and deleting instances, you will be able to create large and object-rich scenes with great speed. You will be able to detail them much faster than if you just use copying objects. At the same time, you will not consume computer resources significantly.

Last updated