Tutorial 2

This is the second tutorial in a series that will show a user how to use ProTex to create textures that incorporate libnoise. The readers should first acquaint themselves with the first tutorial.

This tutorial will take the user through the new features within ProTex not previously available in FxGen.

Part 1 – The Basic Types

Libnoise modules come in 6 basic types. The types are listed below:-

In addition to these basic types, Protex has incorporated the Noisemap builders introduced in the last tutorial, and the L_ImageRenderer which was also introduced in the last tutorial. All libnoise modules are prefixed by the letter 'L' followed by an underscore. They are all colored green except for the L_ImageRenderer that is colored red.

The version of libnoise included with Protex has several new modules, including fBM, Hetero Terrain, Multi-fractal, Hybrid Multi-fractal and a turbulence generator. These can be found under the Generators menu in the Operators viewport. These modules are documented in the book 'Texturing and Modelling: A procedural approach” and are available for download from the website.

For a quick comparison of the new modules, load up the project called 'fbm_compare.prj'. This project contains the 2 pages containing arrays of the basic noise modules. On the first page they are organised in terms of increasing octaves, from left to right. On the second page the changing variable is frequency. The modules require that the user creates an L_ImageRenderer object and places it below the L_Plane objects, as shown:-

For more information on the libnoise operators and their usage please refer to the libnoise documentation.

Part 2 – Combining modules and Saving the Output

Modules are combined in stacks in the same way that FxGen modules are placed in stacks. FxGen operators can be applied to the output of a libnoise module, however it is not possible to apply libnoise modules to FxGen operators.

The projects are loaded and saved through use of the file menu. The user should navigate to the 'Datas' directory before loading a project. Projects should be postfixed with the file extension *.PRJ, however this is not compulsory.

The Images menu allows the user to save an image in the *.BMP format, and right-clicking in the Viewport pane will give the user the option to save in *.TGA format.

The L_Cache object allows the user to save the output of a set of libnoise modules. This allows the user to load the same output multiple times. The load is achieved through the use of the L_LoadCache object. Both the L_Cache object and the L_LoadCache can both be found under the 'libnoise misc' menu. An example of a save and load setup is shown below:-

The cache object is selected and the name is changed to CACHE_1 as shown below:-

Next, the L_LoadCache objects are selected and the pop-up menu in the Properties viewport is activated by clicking the right mouse button. The pop-up menu has been populated with the named variables of type L_Cache. Selecting one of the variables (in this case the only variable is CACHE_1), will make the name of the L_LoadCache object change its name.

And finally the L_ImageRenderer object is double clicked to reveal the output:-

The cache objects are clearly very powerful, and can also save a lot of processing time if used correctly.

Part 3 – VAR Objects

One of the features new to ProTex_0.5-alpha is the Var concept. The Vars can be found under the Variables menu. The principle behind the vars is to store constant numbers that will be reused in later modules. For example, if I create a new perlin noise module and set the frequency to 2.73 and the create another object that requires the same frequency, I find that I am constantly rewriting the frequency. It is much easier to store the value for freqency in a var, as shown below:-

The value in the 'Float Var' object has been set to 2.73. The name is now set to 'frequency' as shown:-

This variable named 'frequency' can now be loaded up in ANY of the float properties, and a truncated version can be loaded into the integer properties (I.e. 2.73 ~=2 and 3.333 ~= 3). This process is similar to referencing an L_Cache object, however the menu will be populated with ALL the Var objects in ALL pages and groups of the project.

After the frequency variable has been added, the Frequency property item will display the value stored in the 'frequency' Var, as shown:-

The way to change the frequency variable is by editing the value in the 'frequency' variable and then double clicking the 'frequency' block. All current numbers that referenced the 'frequency' variable will be updated, however it is not yet possible to save Var references. In the current version, up to 256 numbers can be updated from a single Var object.

Vars have some associated operators. These include:-

There is also an operator called 'Load Var' which can be used to reference another Var. This is technically possible anyway, since the Vars themselves use a float for a parameter, however it is not recommended to try to reference a Var within a Var (in the current version – the abililty to do that will be disabled in future releases). The project window below shows some combinations of Var objects:-

This basically states:

( (frequency + Octaves) – (some value)) / ( some value 2 )

The names of the 'VARS SUM', the 'VARS SUB' and the 'VARS DIVIDE' objects have been deliberately left unchanged for purposes of illustration. In practical usage it is necessary to name the objects, eg. VARS DIVIDE would be called 'Output_1' or something similar.

A major flaw in the way that Vars work is that they ALL have to be double clicked before the operators will process properly. The the output variable may have to be selected twice after this process, but I assure you – It DOES work!

Part 4 – Dialogs

There are currently 3 types of dialogs exclusive only to ProTex. These are The Gradient Dialog (introduced in tutorial 1), the Curve dialog and the Terrace dialog. In this section I will cover some of the controls of the dialogs.

The Gradient Dialog.

This dialog allows the user to add and delete points, to set the color or position of an existing point and to open and save an entire gradient. The end points cannot be moved or deleted, since a gradient must have the minimum of 2 points. The 'Add Point' and 'Set Position' buttons make a dialog appear that allows the position of the gradient point to be set manually. It must be a number between -1.0 and 1.0. The Set Color button makes a typical Color picker appear, for the user to choose the color by sight or to enter the color as text. The black rectangles below the gradient rectangle are the representation of the gradient point. These black rectangles can be selected with the left mouse button. The selected rectangle will appear as a red box and is the subject of the Delete Point, Set Color and Set Position buttons.

The Curve Dialog.

This dialog allows the user to add and delete points, to set graph extents and to Set the position of a selected point. It is also possible to load and save a curve. All curves are saved in the 'Curves' directory. Clicking the 'Add Point' button will make a dialog appear with two text fields, one for the X dimension and one for the Y dimension. The point will appear at the position of the blue cross – the position where the user has left clicked the graph – if the 'Ok' button on the 'Point Confirm' dialog is pressed without any modifications to the variables in the text boxes. The 'Point Confirm' dialog also appears if the 'Set Position' button is pressed. The application can handle as many graph points as the user chooses, however the curve itself can only manage up to 32 points. The 'Set extents' button allows the user to view the graph from further out. The 'Set Extents' dialog is shown below:-

Setting the X max value to 10 makes the graph shown above look as follows.

The graph tool is very powerful. The red lines represent the Zero axes. Curves require a minimum of 4 points. The curve points can be inserted anywhere on the graph.

The Terrace Dialog.

This dialog is basically the same as the Curve dialog, apart from the 'Create Points' button and the fact that the plot is a terrace plot with points having a Y value the same as their X value. The Create Points button creates a smooth distribution of points from the -1.0 point to the 1.0 point. When the 'Create Points' button is pressed a dialog appears requiring a value for the number of points. The minimum number of points required for a terrace control is 2 points. Unlike the curve tool, the terrace tool does not allow the user to insert points behind the most recent point. This means that points must be added to the end of the curve, not at the beginning or inserted in the middle. If you want to add points to the middle, please move the current points to the new position and then add a point to the end.

For more information on gradients, curves and terraces, please refer to the libnoise documentation on curves, and terraces.

The next tutorial will demonstrate a method for creating a simple solar system.