Miscellaneous Examples

Clip mapping

Clip mapping is the effect where a material removes the underlying surface. The following example demonstrates this:

The If object test can be, for example, a test if the red signal is dark enough:

  X inside (0, 0.5)
  Y always
  Z always

Setting the Distance channel to a negative value removes the surface. There is a VSL wizard available for clip mapping, as well as a template in the Image Maps folder.

Example file: tutorprojects/material/vsl/clipmap

Simple glass

This is the structure of a very simple glass-like material:

  • Transparency is set to white (1,1,1). All light gets through the surface.

  • Refraction is defined by optical thickness channel, 0.1 is suitable for glass.

Example file: tutorprojects/material/vsl/simpleglass

Realistic glass

The glass material of the image is created by the Glass VSL wizard. It produces realistic looking glass.

  • Glass color is defined as a constant, which is initialized in the Material initialization shader. Other needed colors are consistently computed from this variable.

  • In the Surface properties shader, transparency is defined as a function of the angle in which the ray hits the surface. Perpendicular rays penetrate the surface well, whereas rays that have the direction of the surface are reflected. The channel ray*normal measures surface-ray angle: the channel value is +1 or -1 for orthogonal rays and approaches zero as the angle gets smaller.

Possible improvements:

If accurate reflectivity control is required, a curve object can be added to surface properties. By adjusting the curve, surface reflectivity can be easily modified as a function of angle.

The Surface filtering shader can be used to control the glass shadow creation. The adjacent image shows an example. Here the difference

    Op[subtract](light:distance, filter:distance)

measures the distance behind the glass. The curve object then adds some brightness according to this distance, so that there is actually a focal distance where the effect appears brightest. Finally, if the 3 curves that modify transparency are not identical, a colorful spectrum shadow is created!

Example file: tutorprojects/material/vsl/spectralglass


In this example, the VSL structure of a metal created by the steel wizard is examined;

  • The Random object that modifies the bump normal channel makes the surface appear rough. General/Normalize option should be set. The Random object's distribution should be zero-centered: base = -0.5*amplitude.

  • Reflections on the metal surface are faded by distance using a Secondary ray shader. First, the distance of the reflection is modified by a simple linear transformation, then this value is squared to obtain faster, non-linear falloff rate for fading, and finally the color of reflection (found in traced ray:illumination) is divided by the value.

Example file: tutorprojects/material/vsl/steel

By replacing the Random object with a Noise object, the rough appearance of the previous material can be changed to a brushed metal appearance. The brush effect requires that the mapping used defines one dimension that is strongly compressed. The cylinder mapping axis is made very short for this purpose in the example project.

Example file: tutorprojects/material/vsl/brushedsteel

Texture mapped post processing particles

The color of particles can be defined using a VSL material:

  1. Create a set of 1D particles.
  2. Map the particle disks post effect to the particles with a default map.
  3. Map the material shown on the right to them with a parallel map

A Post particles shader defines properties for particles that are rendered using a post effect such as Lens flare or Particle disks. Properties for Scan line type particles are defined using a Surface properties shader.

Example file: tutorprojects/material/vsl/texturedparticles

User defined VSL procedures

The program includes tools for creating new user defined VSL objects. Frequently needed algorithms can be collected into a VSL procedure library. The procedures can be called from VSL materials. For example:

  1. Create a new procedure library by using the menu New/VSL Procedure Library of the material tab of the select window. Open the Properties window. The created procedure library contents are displayed.

  2. Drop a Procedure object to the Root node of the VSL tree.

  3. Select the created Procedure() item. Rename it as Curvenoise using the Name field on the bottom of the VSL window.

  4. Change to the Parameters tab and press Add. A new parameter appears to the previously empty parameter list. Rename the parameter, for example, as cn_input using the Parameter name field.

  5. Drop a Noise object to the Curvenoise procedure. Change the input parameter of Noise to cn_input. Output should be 'Return value'.

  6. Drop a Curve object to the Curvenoise object. Both output and input parameter should be 'Return value'. Modify the curve a bit. The procedure is now ready. Its structure is shown in the image.

  7. Activate the select window and create a new VSL material. Set Advanced option to see its contents on the property window.

  8. Drop a shader to the VSL tree of the new material. The default, Surface properties, is suitable.

    Drop a Call object to the surface properties shader and select it. Pick Curvenoise from the displayed list of available procedures. The default input and output parameters are suitable. They can be changed using the VSL editor's popup menu.

  9. Map the material to a test object using a parallel mapping and render.

Example file: tutorprojects/material/vsl/vslprocedure

Aluminium with blurred reflections

Customized ray tracing effects can be generated using the Raytrace VSL object. The aluminum like material, whose tructure is shown in the image, generates strongly blurred reflections.

Blurring is created by a Raytrace object in a Surface finishing shader. The Raytrace object traces 5 random rays around the reflection direction. Each sample direction is strongly randomized. The rendered image shows how reflections remain recognizeable only at a very close range from the aluminium surface.

The image quality depends heavily on the amount of traced samples. It is easy to adjust the amount of traced rays, but high values should be used with care. If the scene contains aluminium surfaces that reflect each other, computation task (and hence rendering time) increases very rapidly when sampling rate grows. Already at a recursion depth 3 and sampling rate 10 one single aluminium surface evaluation can generate 10*10*10 = 1000 ray trace operations!

Both recursion depth and recursion threshold should then be adjusted to keep the rendering time tolerable. The material itself can also define a local recursion limit: the Raytracer object can be placed inside a If level which tests that recursion depth is less than 1.01.

It is also possible to define a post processing configuration which filters away the noise of a shading component before adding it to the image. For details, see the example about post processed illumination in the Rendering / Advanced Illumination Examples chapter of the manual.

Example file: tutorprojects/material/vsl/blurredaluminium