Color Control

Creating 3D rendered images often requires the use of textures, like texture maps and bump maps. Consequently, sooner or later you may want to change the color or the brightness of the rendered texture a little. One way of doing this is adjusting your textures in your preferred 2D program and reload the modified textures. There is also another option: you can adjust colors and brightness with the use of the VSL Curve object in Realsoft 3D directly, which is much more intuitive and also a lot faster.

This tutorial chapter shows how to control the color and brightness of your texture by using the VSL Curve object.

Level: Beginner/Medium

First we start by creating a new material. In the Materials tab of the select window, click the right mouse button (RMB) and select New/VSL material.

This adds a new and empty material, called Materialxx, to your library. If you have material previews activated - at the Materials tab right click and select Show Previews, a black square is added at the bottom of the materials list. Double click the new material to open its property window. You can also press the 'p' key to open the property window.

At the top of the property window, the name of your material is displayed. Rename it to "ColorWood".

In the property window, turn on the Preview checkbox, so you can immediately see the result of your actions. A white sphere appears. Now use the wizard to add a "texture map". Select wood1.iff from the textures directory and as soon as you load it, the white sphere in the small preview window changes into a wooden sphere.

The white sphere in the preview window has changed into a wooden sphere
Adding the Curve object changes the sphere into a colorful object!

Next, check the Advanced checkbox to get access to the VSL components of the property window. From the VSL Objects, select the "Curve" object and drag-and-drop that in the Surface properties shader. Make sure the Curve object is the last object in the VSL hierarchy as shown below:

The effect of adding the Curve object is that the color of the sphere in the small preview window changes immediately from a wooden sphere into a colored sphere. Let's fix that. The Input0 variable of the Curve is by default set to Surface:Map coords. Select the Curve object in the VSL hierarchy and open the RMB pop-up menu. Select Input0 from the pop-up list and notice the black dot at Surface: Map coords. Now change that to Surface:Color (simply select that from the list). Immediately the appearance of the preview sphere is restored to a wooden sphere.

The material is now ready, so you can close the material property window.

By default Input0 is set to Surface:Map Coords; change that to Surface:Color

Setting up the scene

For this tutorial we need a very simple scene. In front view, create an analytic sphere and add a point light source somewhere above the sphere, so the scene is lit. This will do just fine. Make sure the sphere is selected in the select window and go to the materials tab. Select the ColorWood material, press the RMB and select Map -> Parallel from the pop-up menu. In the view window create a parallel mapping that encloses the sphere. Render the view to check your results.

Using a curve to change color

Controlling the color and brightness of the woodtexture is now a matter of modifying a curve. So, let's have a closer look at this curve and how the curve controls color and brightness.

Make sure the property window for the ColorWood material is open and the Advanced option is set, so we have access to the VSL components of the material. Click on the Curve object and have a look at the lower part of the property window. The first thing you see is a red curve with two knotpoints; one knotpoint at (X=0, Y=0 - lower left) and one knotpoint at (X=1, Y=1 - top right).

One knotpoint has coordinates X=0, Y=0, the other has coordinates X=1, Y=1
Enable and Disable the Curve object via the RMB pop-up menu

In its current state the curve has no effect on the material. To check this just render the view. Then right click on the Curve object in the VSL hierarchy, select Disabled and render again. Nothing changes. Now in the same way, enable the Curve object again.

The Curve object makes use of 3 curves, a red, a green and a blue curve, which in this case control the RGB color values of your texture. So, the red curve contols the R(ed) value, the green curve the G(reen) value and the blue curve the B(lue) value. We now only see a red curve because all three curves are exactly on top of each other, the red curve being the one on top.

To modify a curve, one clicks in the graph on the line to add a knotpoint, then move the knotpoint to the desired position. Let's try this and see what happens:

Add a knot point in the middle of the curve (X=0,5 and Y = 0,5) and drag that knotpoint to X=0,2 Y=0.8. Note that you can enter the exact coordinates for a selected knotpoint via the numeric input fields just below the graph.

Numeric input fields for exact positioning of selected knotpoints

The first thing we notice is that only the red curve has moved. At it's previous position a green curve appears, which also has a knotpoint. If you move the knotpoint of the green curve as well, a blue curve appears, also having a knotpoint at the same position. When you create a knotpoint while all three curves are on top of each other, all three curves get one at the same position. Because the material preview in the property window is active, you can immediately see the result of your changes. Render the view and you will see that the material has now a more orange color.

The conclusion is that by modifying a curve, we can influence the color of the texture. High values in the Y-axis result in a higher RGB color value. Because we moved a knotpoint in the red curve to a higher Y-value, we increased the value of the red color component of the texture. Therefore the texture appeared more reddish. Similarly, if we move this knotpoint to a low Y-value, for example to X=0,8 Y=0,2, the amount of red is decreased and the texture will become greenish.

Of course you can also decide to move for example only the green curve, or both red and blue. Just try some of these variations and see what happens. Remember that undo (ctrl+z) restores the curve to its previous shape. If you get completely lost, drag select all knotpoints you have added and select Delete Points from the RMB pop-up menu. This will restore the curve to its original shape.

By default all three curves are visible and editable in the graph. Sometimes it is much easier if you have only one curve or two curves visible in the graph. If you want to exclude a curve from being displayed in the graph, open the RMB pop-up menu and deselect the curve. Only the visible curves in the graph can be edited.

The green curve is excluded from being displayed in the graph

When you move a knotpoint of a single curve, you control the respective R,G or B value. What would happen if you move a knotpoint in all three curves at the same time? In that case all RGB values are changed in the same amount and thus will the color get lighter (if the Y-value increases) or darker (if the Y-value decreases). Let's see how this works.

Make sure all curves are enabled. Delete all knotpoints you have added, so the curves are restored to their original shape. Again add a knotpoint at X=0.5, Y=0.5. To move a knotpoint for all three curves at the same time drag-select the knotpoint (this selects the knotpoints for the red, green and blue curve simultaneously) and move it. Now move all three knotpoints to X=0,2 Y=0,8 and render the view.

As expected, the sphere now has a color which appears whiter. Now you can also predict what happens if you move the knotpoint to X=0,8 Y=0,2.

Knotpoint for all three curves moved to X=0,2 Y=0,8

Until now we have created and moved new knotpoints. You could also decide to change the position of the starting point and end point of curves. Move the starting point of the curve to X=0 Y=0,5 and move the end point to X=1 Y=0,5. What happens? The curve is now a straight horizontal line. All RGB values are made the same, which results in a shade of grey. Subsequently, if we move the horizontal curve upwards, the color will change more to white; move it down to change more to black. This shows how you can control the color of your objects and even overrule textures.