Blending Materials

This tutorial chapter introduces new ways of combining materials. You will learn how to mix materials:

The tutorial also explains how to limit the effect of a material to an arbitrary area.

Level: Beginner/Medium

The chapter "Materials" explains how to assign multiple materials to a single object. Putting several materials into the same hierarchy level automatically combines those materials. This Tutorial will explain how the materials are combined and how you can control that blending.

The first three materials wood, plastic and brushing do not share a common property. Wood defines the color pattern, plastic the shininess and brushing the bumpiness of the surface. Only the fourth material logo includes another color pattern, which replaces the wood beneath it. This happens because logo was mapped to the object after wood and therefore is further down in the hierarchy.

[Note] Note
Materials are evaluated in the same order in which their mapping appears in the hierarchy (from top down). A mapping applied later will be evaluated later and therefore it might overwrite all previously applied properties.

Now let us begin: Load the object, which you created in the previous chapter or the file "tutorprojects/material/mapping/multimap.r3d".Then do the following:

1. Render the view window to make sure that the logo is visible on the top of the sphere.

2. Place the mouse pointer above of the topmost mapping object Parallel Mapping7(wood); drag it over the icon of the lowest mapping object Parallel Mapping10(logo) and drop it when the cursor changes to an down arrow. This moves the wood mapping to the bottom of the list.

Logo is mapped after wood in the original hierarchy and replaces the wood in the area where it is defined. The hierarchy on the right side shows a situation where wood overwrites logo.

3. Render the view. Now wood grains are clearly visible also at the logo area.

Now continue as follows:

4. Double click the wood mapping object to open the property window. Click the Spec tab to see the mapping specific options.

5. Set Scope to 0.5, close the property window and render the view. The wood material is only partly visible now and the other materials (white default material and logo on the top part) are visible through it.

50 % scope makes wood transparent and it is blended with previous materials
Combined brushing patterns

What happens if we add another bumpy material to the sphere?

6. Activate the object Parallel Mapping9(brushing) from the select window. In the front view, press the 'Ctrl' key, and simultaneously rotate the object - using the blue rotation handle - about 90 degrees. Now release the 'Ctrl' key. This is a quick way to create a rotated copy of the mapping. You should now see two copies of Parallel Mapping(brushing) in the select window.

Based on the previous experiments, you might now think that the new copy of brushing overrules the original one, because it comes later in the object hierarchy. Test this by rendering the view window. You will see two orthogonal brushing patterns, which is not what you might have expected.

This highlights that this bump map behaves differently from the color patterns. These bump maps are combined (added) whereas color maps overrule each other unless scope values are used to blend the materials in a desired fashion. The materials in the default library are deliberately constructed to follow this (useful and intuitive) convention. But please note! Realsoft 3D has an open architecture and you can easily implement any other kind of behavior using the material system. Bump maps can replace each other if required.

Local materials

Most materials in the previous example affect the target object all over. You may enlarge the sphere as much as you like, but you will not "run out" of wood. Only the logo material has a local influence at the top of the sphere. The influence area is defined by the cube-like geometry of the mapping object and is locally limited because we activated the Finite setting for the parallel logo mapping.

It is often necessary to limit the influence of a material to a more arbitrary area than a simple cube. We will practice this by making a marble plate with some golden letters on it.

You might want to load the sample project: tutorprojects/material/mapping/goldtext.r3d

Tutorial level: Medium

1. Select Environments/Default Startup from the main menu or reload startup.r3d from the main Realsoft 3D folder to initialize your working environment and get the full material library back after the previous tutorial.

2. While in front view, create the plate. For example, use an analytic cube and rename it to 'plate'.

3. Start a paint program such as Paintbrush, which comes with the MS Windows Operating System. Make a black image with some white text on it and save it with a suitable name (e.g. 'textures/mytextimage').

White areas will be made of gold

4. Make sure that the plate object is selected in Realsoft 3D. Go to the Materials tab of the Select window and drag&drop the marble material to the view window. This assigns the marble to the selected object.

5. Select New/From template from the material's select window's pop-up menu. Select the template Image Maps/Scope Map using the file browser and click Open.

6. Double click the icon of the new Scope Map material to open the property window. Set File Name to the text image which you created. Activate Grade X and Grade Y options. Grade options will blend the gold text smoothly to the background, thus reducing the jaggedness of pixel edges of letters.

Properties of the scope map material
The level material includes two sub materials

7. Go back to the select window and select New/Level Material from the popup menu. A new material appears in the select window. Using the property window, rename it to 'gold+scope'. The upper area of the property window shows the contents of the material library and the lower area the contents of the created level material. Drag and drop both Gold and Scope map to the node on the lower part. Close the property window.

8. Make sure that the level containing the plate and the marble mapping is selected. Switch to the Materials tab of the select window. Move the mouse pointer over the icon of gold+scope material and choose Map/Parallel from the popup menu. Then create a mapping rectangle in the view window. The mapping rectangle should fit inside the plate; its size defines the size of the text.

Gold text mapped to the plate
Golden text in a frame

Render the view window. The result is indeed golden text on marble background, but there is a golden frame around the text as well.

The explanation for this is that the scope map cuts the influence of the gold only inside the black and white texture. Nothing limits the influence of gold outside the scope map. This is easy to fix:

9. Go to the Geometric Objects tab in the Select window and select Parallel mapping(gold+scope). Open the property window, switch to the Spec tab and set Finite X, Finite Y and Finite Z. You may recall that this limits the material to have influence only inside the mapping geometry. Close the property window.

10. Activate the side view and make sure that the selected gold+scope mapping object actually intersects the front side of the plate. Otherwise, because of the Finite options, the golden text would not appear on the plate.

11. Switch back to the front view and render. There is no gold at the edges of the plate, but if you look very carefully, you may still see a thin golden line following the edge of the parallel map. Why? Activate the Materials library on the select window. Double click the Scope Map material to open the property window. The Grade X&Y check boxes are set in order to smooth the scope image. These gradient options work also at the edges of the texture map, and the 0 level (no effect) scope of the background is blended to the surrounding level 1 (full) scope. Set Edge X and Edge Y options to disable the edge blending. Render the view to check the final result of the tutorial.

Set Edge options to remove thin gradient at the edges of the scope map

Instead of using Paintbrush for drawing the texture image, you can also use the 3D painting tools of Realsoft 3D to paint the scope mask image. For more information, read the tutorials about 3D painting.