VSL Material

This is the most powerful and commonly used material type of the program. All materials, which you can find in the default material library, are of this type. The reason why VSL materials are so powerful is that the 'low level' interface of the VSL materials is a programming language. Advanced users can therefore implement unusual and customized material effects. Don't be alarmed by the term 'programming language', you do not have to write complex formulas and algorithms, because VSL materials can be built using wizards and an easy drag and drop interface. Consequently, it is easy to get started. Nevertheless, in order to fully utilize the possibilities of VSL, some programming experience is required.

Using VSL materials is very easy. VSL makes it possible to build an optimal interface for each material type. You can see this by examining the materials of the default library in the property window.

The following control groups are available for VSL material building and editing:

  • Top Level Controls
  • Advanced Controls
  • Object Specific Tab
  • General Tab
  • In/Out Tab
A VSL material in showing its 'easy to use' interface

Top Level Controls

The topmost area of the VSL material editor shows a set of gadgets that are displayed both in the easy to use interface and in the advanced editing state. These controls are:

Name: The name of the currently edited material. The editing target can be changed by choosing another material from the list.

Preview: This checkbox enables/disables the material preview feature. When enabled, the program automatically renders a test image of the edited material after each change. The preview is rendered using a test scene defined by the current material preview project. It is also possible to assign a special preview project to the material by selecting a disk project file using the 'File' gadget at the right side of the 'Preview' check box. The rendered preview image automatically updates the material icon in the select window (if preview icon feature is enabled).

File: A custom preview project. If a project file name has been defined to this field, the program automatically loads the project and uses it for material previewing whenever the material is edited in the preview state. The idea is that some materials may require a certain kind of preview project which shows the characteristics of the material well. For example, a transparent material requires some objects behind it so that refraction can be tested. The 'previews' folder in the Realsoft 3D home directory contains some predefined preview projects. You can create more of them by editing the default material preview project and saving the result to the 'previews' folder with a suitable name.

A VSL material in the advanced editing state

Preview Window: The squared little window at the top right edge of the material editor is actually a View Window. Therefore, you can rotate, zoom and pan it with the right mouse button and Alt, Shift and Ctrl modifier keys. The window also has a small popup menu:

Disabled: Turns off all properties of the material. If the material is mapped to a geometry, the geometry renders as if the material was not mapped at all, or deleted from the material library.

Advanced: This checkbox brings up the advanced VSL editing controls.

Wizard: A list of VSL wizards, which automatically add some commonly needed material appearances and features to the edited material. For more information, check the wizard list.

Add: Adds the currently selected wizard elements to the edited material. As a result, a set of new VSL objects and top level controls appear to the material. Note that the same wizard may be applied several times to the material; the program does not check or prevent this. For example, a material may include several texture maps which are blended together.

Advanced Controls

The advanced VSL controls are divided into the following three tabs:

Shaders Tab

Shader Tree - The tree diagram shows the complete structure of the 'shading program'. The top level objects, 'Shaders', are executed in a predefined fixed order, regardless of their order in the constructed VSL tree. Inside the shader levels, the execution proceeds in top-down order. Variables can be placed freely into levels - position does not matter - but is is a good programming practice to introduce them as the first objects in a level. VSL objects can be inserted and moved around using drag and drop. Ctrl-dragging creates a duplicate and moves it. The shader tree gadget has the following popup menu (it is context sensitive and changes depending on the VSL object selection):

[Note] Note
Renamed objects no longer update their names automatically when the input and output parameters change.

VSL Objects - An array of currently installed VSL objects. You can drag and drop items from this array to the VSL shader hierarchy. Clicking a VSL object icon adds it to the end of the level where the currently selected VSL object is located. Note that VSL object hierarchy follows some syntax rules, and a certain object may not fit into some parts of the hierarchy. For example, the root level of the hierarchy can contain only variables and shaders, and a shader cannot be placed into another shader. When using drag and drop, the mouse pointer symbol tells you where you can drop an object. If you click a VSL icon in the array and nothing happens, the reason is most likely that the current destination is not allowed.

Attributes Tab

The Attributes tab contains the tools for creating an easy to use interface for VSL materials. The controls are:

Attributes - A list of all attributes of all VSL objects in the current material. You can pick an item from this list and make it visible in the easy interface with a suitable name. The list includes a simple popup menu, whose items 'Show' and 'Hide' serve the same purpose as the two buttons described below.

Name - Displays the name of the selected attribute. By default, attribute names describe their general nature. For example, 'Amplitude' defines the magnitude of the 'Noise' object's value variation. You can change the name to describe the particular purpose of the attribute in the edited material. For example, 'Wave Height' might be a better name than 'Amplitude' for a sea water material.

Show - Adds the currently selected attribute to the easy interface.

Hide - Removes the currently selected attribute from the easy interface.

[Note] Note
Attributes of deleted VSL objects automatically disappear from the constructed interface.

At the bottom of of the Attributes tab, you can see the defined GUI for the material. The same interface will become visible when you turn off the advanced editing state.

Mapping Tab

The rightmost tab of advanced controls defines how the created material should be mapped to target objects. The specifications made here are used by the drag & drop system. The user can overrule them by selecting another mapping type from the mapping creation tools.

The following controls are included:

[Note] Note
This means that the material will have a weaker effect! Later evaluated materials can overwite the result. Some special materials, such as a global illumination shader, may work best if it is evaluated last. Because most materials have the default priority 0 and only some built in shaders use evaluation priority -2 .. +2, a value -5 is usually sufficient to guarantee that the material is evaluated last.

If the recommended mapping is set to 'Any Mapping', drag & drop system creates a mapping that best matches the geometry of the target object. Spheres will get a spherical mapping, cylinders gets cylindrical mapping, etc.

Object Specific Tab

The leftmost tab on the bottom of the VSL editor window shows the object specific attributes of the selected VSL object. Therefore, the tab contents changes from object to another. Object specific VSL attributes are described in VSL objects.

General Tab Options

The majority of objects have several common controls, shown in the 'general' tab of the VSL editor.

Operation:

This option defines how the value computed by the object is assigned to the output channel/variable. If the output channel has 3 subchannels, the same assignment is considered for each sub channel. Operation can also be changed using the popup menu of the VSL editor.

=

Default assignment, overwrites the old value with the new one

+

Adds the new value to the old value

-

Subtracts the new value from the old value

*

Multiplies the old and the new value

/

Divides the old value by the new one

Min

Assigns the minimum of the new and the old value to the output channel

Max

Assigns the maximum of the new and the old value to the output channel

Abs

Assigns the absolute value of the computed expression to the output channel

Normalize channel:

This option is provided for convenience. Many of the available channels are such that they must be normalized whenever their value is changed. The term 'normalize' means that the value of the channel is divided by its length, the result being always a unit vector. For example: normalization of vector (3, 4, 0) equals (3/5, 4/5, 0). The channels, which are (and should be kept) in normalized form are:

Transform to material space:

This option performs a 3D transformation to the orientation defined by map x, map y and map z channels

(x,y,z) -> x*map x + y*map y + z*map z

The orientation defined by these vectors is often suitable for surface normal modifications, such as bump mapping.

Antialiasing, Threshold, U-samples, V-samples: These settings control material anti-aliasing. Generally speaking, anti-aliasing is a method of increasing computation accuracy because of high 'information density' or 'level of detail'. In other words, if an examined pixel contains plenty of details, the rendering system needs to analyze that point carefully to achieve proper image quality.

Antialiasing defines the relation of how quickly computation accuracy is increased when level of detail grows. If the value is zero, anti-aliasing computations are switched off. A good default value is 1.

The Threshold setting controls the level of detail when the anti-aliasing starts. The lower the value, the easier antialiasing starts. The minimum value is 0.

The effect of VSL anti-aliasing in a texture map. The quality of the first picture (no anti-aliasing) is not sufficient for animations because of intolerable amount of flickering. The second picture shows the improved quality after activating the anti-aliasing feature.

U-samples and V-samples define how many times the object is maximally evaluated for anti-aliasing purposes. The system is designed so that by setting the u & v samples to the level that corresponds the 'native' level of detail of the object (for example: pixel resolution of texture map object), anti-aliasing factor 1 and threshold value of 1 are optimal. However, because of speed reasons, it is not always possible to use high enough sample values (1000000 samples for a 1000*1000 pixel texture map is too slow), so sometimes lowering the trigger value and increasing the antialiasing value may be necessary.

Note also that sometimes it may be necessary to use higher u-v-sample values than the texture resolution: for example, a simple 2*2 pixel checker pattern may require 4*4 samples because of the random nature of the anti-aliasing process.

Disabled

This option disables the object in ray trace rendering. The result is the same as if the object were deleted. The option is useful when experimenting with the materials.

Tip

The Tip string can contain some optional information about the purpose of the VSL object, instructions how to adjust the shader or other user-defined information. The Tip string control is the preferred way to add such comments, because renaming a VSL object stops the automatic name updating when input or output parameters or other attributes affecting the name of the VSL object change.

In/Out Tab

VSL object parametrization can be controlled using the 'In/Out' tab of the property window.

The list on the left side shows all input and output parameters of the selected VSL object. The list on the top right side shows how the parameter is assigned. The list includes all channels and variables available in the current shader.

The third list is for sub channel selection. The following examples illuminate this feature: