Start typing to search...

Pin Data Types - 03 - Color, Text



Our next data type is Color. It’s designated by the light blue color. Color value in Aximmetry is an RGBA value, so it embeds an alpha channel, and each channel is a 32-bit floating point value.


Color parameters are used in lots of places throughout the system. One of the simplest module types that has a Color input is Solid Color. It generates a unicolored image with a specified color and size. I expose it to the right so that we can watch the color coming out of it.


The fact that a Color value is stored as a 32-bit floating value means that it can be applied to tasks involving High Dynamics Range or HDR. But if we look at a Color value in the Pin Values editor, we cannot see floating-point values to be set; it would be impractical. Instead, we can see a two-part editor. One of the parts is a regular RGB editor where we can specify channel values ranges from 0 to 255. Values can be adjusted individually in the same way as any other integer value. The other part is an intensity multiplier. It can be decreased thus providing a simple way for darkening the color, but, what is more important, is it can be increased way over 1, thus putting the color into the HDR intensity domain.


But, of course, setting the numeric values is not the only way to edit the color. There is a convenient Color Picker window. We can open it by clicking either on the three dots button or on the color rectangle here. In the Color Picker, we can choose between several color spaces and components, similarly to other graphical softwares. We also can set the alpha channel and the HDR intensity multiplier here.


When the alpha is less than 255, meaning that the color is transparent, a fourth component appears in the numeric editor which can also be set between 0 and 255. It is the first number and represents the alpha value. If we lower it we can see the transparency is also indicated here in the color rectangle.


Let’s see the Color Picker window in detail. We can choose between three color spaces: HSB, HSL, or RGB. HSB and HSL are represented by the same three parameters here, we can choose between the two spaces with these two buttons. Each component can be adjusted numerically in these editor boxes. By selecting the button of a channel we can adjust that channel with the side bar here. In this case, we chose R, so we can adjust the Red channel intensity with the slider. The corresponding other two channels can be set in 2D in this rectangle. Similarly, if I choose S, I can set the Saturation with the slider, and the Hue and Brightness can be set in 2D - this time within a circle since the Hue is a circular component.


The color value is also available in a hexadecimal form which can be handy if we want to transfer colors between Aximmetry and another application, e.g. Photoshop.

There is a pipette tool that enables picking a color from anywhere on the screen. To do this we have to click the pipette button, and while holding down the mouse button, we move the mouse over the desired area of the screen. By this, we pick the color of an individual pixel. But by holding down the Shift key we can select a 16x16 pixel area, and the resulted color will be the average color within the rectangle. By holding down Control we can select an even bigger, 32x32 pixel area, and get the average of it. When we are satisfied with the selected region we simply release the mouse button and the color is stored.


We can also copy and paste the color. For this, there are two buttons here at the bottom, but we can also use the usual Ctrl+C, Ctrl+V combinations. Let’s click Copy. Suppose we want to transfer the color into this Copy Color module. We can either paste the color using the right-click menu of the color property, as we’ve already seen with other data types, or we can open the Color Picker and click the Paste button or press Ctrl+V.


Of course, color can be copied not only between properties but between any places that enable setting a color. For e.g. let’s add a shader to the compound. It can be colored, as it can be any simple or imported compounds in the system. Right-click it and choose Set Color. By clicking Paste we have set the color of the module to the color we brought from the property.


The next data type is Text. It is designated by the pale blue color. It is an arbitrary sequence of Unicode characters.


The simplest application of a text is to draw it onto an image that can be displayed on the screen or can be applied as a texture on a 3D object. For this, we have to add a Text Image module that has a Text property. Text values are edited in a very simple text box that doesn’t have any special features. Let’s type the text “Example” and expose the module to the output. Now we have an image with the text we typed. The size of the image can be automatic based on the size of the text. But we can also specify a custom fixed size and can justify the text to any side within the image. We can specify colors both for the text and its background.


By adding a Text Format module we can specify the font used to display the text. It has to be connected to the Text Image module. We can choose the Font Family, Size, Weight and Style of text, etc.


There are more complex usages of texts. For e.g. we can generate an extruded 3D object from the text. It’s not demonstrated here.


There are several operations that can be applied to a text. For e.g. we have a Text Slice module here that extracts a part of the text based on several parameters. Its input is currently a three-sentence text. The simplest application of Text Slice is when we select a range of characters. For e.g. extracting 10 characters starting from the 5th one. We can see the middle part of the text. But we can use separators as well. For e.g. make the separator the period character which means that we slice the text into sentences. Then select one separated part (in this case a sentence) starting from the second one. So we get the second sentence. Or if we specify 2 for the Count, we get the second and third sentences.

This is not perfect though. Between the sentences, there are not only periods but spaces as well. Therefore an extra space precedes the text. We can fix this subsequently. Let’s add a Text Trim module that trims the spaces at the beginning and at the end of the text. The other solution is to use a multi-character separator in Text Slice. So let’s make the separator a period and space. We can see that the spaces have vanished from the text. As you could spot I had to turn off the Multi Separ switch previously. When it is ON, the characters specified in Separators are not interpreted as one multi-character separator, but as alternatives, meaning that you can split a text at different characters, for e.g. at all periods, commas, or semicolons.


There are module types that perform conversions between text and numeric data. They won’t be discussed in detail here, but I’ll show some examples. Let’s add a Vector To Text module. Specify a few numbers as an input vector. This is our three-element vector. The module converts it to a text containing the list of elements, in this case, separated by commas. But the Separator can be anything, for e.g. let’s make it a number of spaces and a plus sign. Here is the result. The format of the numbers themselves can be specified as well. For e.g. we can specify a fixed four decimals. The applicable format string can be found in a separate document.


The inverse operation is performed by the Text To Vector module. Let’s wire our previous result text into it. We can see that the module gives an Error and the output is wrong. Obviously, we should specify the same separator we used previously. Let’s copy it from there. We also have to turn off the Multi Separ since we want a single multi-character separator. We can see that the module has managed to read the text, we’ve got back our vector, and Error is OFF.


The text modules presented so far had a Text property that was able to be edited in a simple single-line text box, meaning that multi-line texts couldn’t be provided. For that purpose, we have to use the Text Block module. It has a special kind of Text pin. In regard to functionality, it is a regular Text pin, but it has a special editor. This kind of text pin is called the “Large Text” in the system. As we can see there’s no editor box in the Pin Values panel just a large button. We can either click that button or double-click on the Text Block module itself. Upon this, the Text Editor panel opens where we can edit an arbitrary multi-line text.


Loading a text property into this panel can be done either in the previously presented way (button or double-click) or we can select between all the available Large Text properties within the compound using the Text Editor’s own dropdown list.


Now wire the Text Block into the Text Image module to see the edited text. When we make modifications in the text it isn’t stored in the property instantaneously. We can see that the text hasn’t changed yet on the output. To store the text we have to click on the Apply button. Or we can click Discard to undo all our modifications. An alternative to the Apply button is the Ctrl + Enter keyboard combination; this is the more practical way. If I press it we can see that the text has changed on the output as well.


The Text Block module also enables selecting only a range of lines from the specified text. For e.g. we can select 3 lines starting from the 4th one. We can see the resulting 3 lines.


An alternative way to use large multiline text is using an external text file. Here is an example text file in the File Browser. It can be simply drag-n-dropped into the Flow Editor. Upon this, a Text File module is created which is preloaded with the text file we dropped in. Let’s wire it to the output. The module also enables selecting a range of lines. Let’s see 30 lines starting from the 5th one.


The clear advantage of this method is that the text content can be edited from outside of Aximmetry. For e.g. I’ve loaded the file into an external text editor. When I edit the text and save it, the system senses the change of the file and reloads it automatically. So I can change the input text without entering the Composer’s own editor. This can also be done during a live show, thus changing a displayed text if necessary.

Article content