Click to go Home  
Render times
User Profiles
Macros / Scripts
Materials / VSL
User images
Image Contest
Realsoft images
VRgrafix images
By Realsoft Oy

VSL for real beginners

Part I: Color, Diffusion and Specular Maps

Visual Shading Language (VSL) is a real highlight of Realsoft3D. With its capabilities it is possible to create almost every material you want, from hyper realistic to cartoons.

On the other hand it is a most complex and extensive tool you will find in Realsoft3D. You have to invest some time to understand and finally master it.

Many users switched to Realsoft3D from other applications find missing different map types, they used there. We will try to reproduce color, diffusion and specular maps using image textures in this tutorial and learn basic VSL principles in the process:

New material

Please load maps.r3d first. Click HERE to download ZIP (147k)

This scene has a simple object with applied planar map on it. Go to materials tab of selection window, press right mouse button and select New > VSL Material. You see new material is created. Rename it (Right mousebutton > rename) to ”Test" for example.

Doubleclick on it to open the Material Properties Window.

Tip: You may increase the size of the material preview image. Select Options > Window > Classes from main menu. Select in classes hierarchy Root > Graphical User Interface > List Property Gadget > Material Gadget and change PreviewWidth / PreviewHeight properties. 100 seems to be a good value. Be sure you activated ”Preview" and ”Advanced Checkboxes" there. Advanced option opens advanced view, there you can create new shaders - exactly what we need.

Color Map

OK. Time to create our first color map.

We have to create a shader on our naked material first. So drag the shader object and drop it on the Material.

In the same manner move the Texture object on the shader we just dropped, named now ”Surface properties" in the VSL tree. Texture object apples a color map using texture image by default, so we don't have to do here at all. Just press [...] button and select color.jpg to apply this color map (click HERE to get). You may see the sphere has changed color in the preview window. Let us see how the texture map we just selected was applied to our object. Just press the In/Out tab.

We see the VSL took map coordinates as input and projected our color texture on it. Our color texture was applied as a color to the object surface. Also what we need.

Ahhh! That was simple!

Yes, but we will start with some more interesting things now.

Diffusion Map

Many of 3D packages using diffusion maps. Color map and diffusion map do actually the same - they scale diffusion lighting reflected from the object surface. So why use another map if we have already one?

You may think of diffusion map like an additional layer light have to pass through after reflection. So diffusion map is just a way to separate ”color strength" information from the pure color information - a way to apply irregularity to diffusion lighting.

For example some places of the gray table desk look more brighter other more darker (because of the dust for example), but the table desk has still consistent gray color. Diffusion maps is a great way to add more photorealism to our images.

Our last rendered image looks just too perfect - let us add a diffusion map to it! So here is the plan:

We subtract the color information, we have in diffusion map, from our existing surface color information. Just think about this additional layer.

Diffusion maps are normally grayscaled images there white means full and black no reflection. So we have to invert this information before we subtract it from surface color.

In addition we want to be able to scale the strength of the diffusion map. Let's start with the implementation:

Add another Shader object to the material. Drop new Texture object on it - this will be our diffusion map. We will use Operation object to invert diffusion map. We will also need two Variable objects, first to save diffusion map as input for Operation object and second to save the result of this inversion. Add Operation object and two Variable objects. to shader. You can rename the variables to get more meaningful names. - I took ”diff-map" and ”diff-mapsubstructed".

Select Texture object we added, add-diff.jpg as texture (HERE to get) and switch to In/Out tab. We want to save Diffusion texture in diff-map Variable, Select Output scroll down right list and select diff-map.

Select Operation object, be sure Operation tab is selected - choose [1-p1] - in this way we convert color strength information.

Switch to In/Out tab. Our Operation use diff-map Variable (where we saved diffusion map) as Input - so select in the left list Input scroll down right list and select diff-map. As Output select diff-mapsubstructed.

Ok. We inverted diffusion map, now we will scale it and subtruct from color information. We do both using only one operation:

Add new Variable object, rename it to "diff-amount", change Type to Float, select Initialize checkbox and set Value to lets say 0,5. Add new Operation object, in the Operation tab select multiply, then go to In/Out tab. Select "diff-mapsubstructed" and "diff-mapamount" as input and Surface:Color as Output.

To substract result from sufrace color go to Operation tab and choose - as operation.

Here is what you should have. Result looks more realistic now.

Note: you can simple change strength of diffusion map using diff-amount variable - ideal for experiments.

Specular Map

Next step to photorealism would be an addition of specular highlight - light directly reflected from the surface of our object. VSL provides ready object called ”Specular" for this purpose. However it is (again) to perfect for the real world objects. As with diffusion light real objects also reflect specular light with some irregularity for example metal surface will give you very strong highligh, while rust none. We use again image maps to simulate that behavior.

Drop new shader on the material. Select ”Surface illumination" as shader type.

Why surface illumination? Different shaders provides you with different properties, so you have to select the shader type mostly suitable for you. Since we want to work with specular light it is a good idea to use ”Surface illumination" to get access to light properties.

We will use the same approach we used for diffusion map:

Add three variables: spec-map of type color, spec-amount of type float and spec-result of type color.

Add Texture object and apply spec.jpg to it (click HERE to get), as output select spec-map variable. Now add Operation object, set multiply as operation, for input0 and input1 use spec-map and spec-amount variables and spec-result for output.

Ok, the texture is now prepared. Add Specular object to material. In General tab set + as operation since specular highlight is an additional lighting on the surface (you may experiment with other values too). Use spec-result variable as input and Surface:Illumination as output. Make test rendering and experiment with Sharpness and Brightness sliders of the Specular object to get nice results.

Please note that specular maps are most effective while animation.

Alex Penner Draft, Version 0.8
c. 2001 Alex Penner, Camouflage Studios,

Page updated on Tuesday, 25 February, 2003 . For feedback / model submissions or articles - please email us.
Site proudly sponsored by VR.grafix
Goto Sponsors Site (VRgrafix)