Advanced Texture Editing

Combining Materials

As I said in the last part of this series of tutorials, one of the most powerful things about a procedural texture editor, such as the one found in WCS, is the ability to "embed" textures within other textures.

In the last part of the tutorial, we investigated the potential of using a texture to drive where other textures appeared on the terrain. In our case we made a brick wall texture with vegetation cover which could have just as easily (and probably more suitably!) been applied to a 3D object of a wall.

So far we have been creating single materials with complex procedural textures. In this part, I intend to take you through using the texture gradient to drive different materials. Specifically, we are going to create a ground cover component that we can save and later use in Parts 7 and 8 of the tutorial. The initial effect we are trying to achieve should look something like this:

The last step of this part allows you some freedom in texture selection and material creation, so your result may not look exactly as mine does.

1. Create a new project and call it GroundCover

2. Select File...Import Wizard and navigate to your TexturesEverywhere folder

3. Locate and select the TexturesEverywhere.1.elev file. WCS will recognize it as a WCS DEM and offer to load it. Click Next three times, and then Import.

4. WCS will import the terrain file and create a new .elev file in the default folder for this project.

5. Right click in a matrix cell and select GroundCover Camera as the active view

6. Select the Camera Task Mode in the S@G, expand the Camera group and double click on the GroundCover Camera.

7. Enter the following values into the respective fields on the Position & Orientation tab:

This should give us a clear view of most of the terrain. Do a quick test render (F9) to see:

As I said earlier, we'll be replacing the dull gray color in the next few steps.

8. Select the Ground Cover Task Mode in the Scene-at-a-Glance.

9. Expand the Ground Effect group and you should see an item labeled GroundCover Ground. Double Click on it.

10. Click on the Material Gradient Driver tab. You should see something like this:

11. Click twice in different parts of the Gradient bar to add another two color pins. WCS will assign these random colors. Move the rightmost pin to the far right of the gradient by clicking on it's "pinhead" (the little color well beneath the black line of the pin) and dragging it to the right as far as it will go. Once selected, if you remember, a more accurate result can be achieved by entering the value directly into the box below the gradient marked Position in Gradient (%). Move the middle pin in a similar way to 50% of the gradient or thereabouts.

12. After this little effort, you should see 2 more materials in the materials list and a gradient of garish colors across the dialog box! Mine looked like this:

13. Click on the Material tab and select each of the materials in the materials list in turn. This list corresponds to the material pins on your gradient in a direct fashion: the uppermost material in the list corresponds to the left most pin, and the bottom most material to the rightmost pin. You should notice that the diffuse color of each material is the only thing set, and that they have been set to match the random color assigned to the color pin on the gradient.

14. Select the topmost material. Click in the Selected Material textbox and rename the material from Material to Grass.

15. Select the next material down and in the same way as before, rename it to Mud.

16. Rename the third and final material to Rock.

17. Your Ground Editor should now look like the following diagram:

18. The colors in your interface will probably be different to mine, but no more or less irrelevant to the diffuse colors of the ground types we are trying to represent! Let's change that now, which will help us locate our materials when we look at them on the gradient.

19. Select the Grass material and set its diffuse color to a deepish browny green - I used RGB 50,75,0

20. Select the Mud material and set its color to a deep reddish brown - I used RGB 70,45,0

21. Select the Rock material and set its color to a pale gray color - I used RGB 200,190,180

22. At the end of this tweaking, your materials gradient should look like this:

23. Do a quick test render of your view to see the effect. The result should be a completely green landscape:

But why? We added the extra color pins, so why no effect? The answer lies in the Material Gradient Driver itself. See that entry box above the gradient bar that is labeled Material Gradient Driver? It should be set at 0%. Change that figure to 50%, and rerender. What do we see? Well, WCS is now looking at the Material Gradient Driver value and using that to pick a color from the gradient. In fact, it is actually using the value to decide which Material to place on the terrain, and as we have seen, a material can contain some very complex texturing indeed! Hence in our second rerender, the landscape should render brown, as our mud material is located at 50% on the gradient:

Now set the value to 100% and rerender. It should be no surprise that the landscape renders the pinky gray color of our rock material:

24. What about intermediate values, then? Try settings of 25% and 75% and render tests to see what is happening. Your Renders should be a greeny brown and a browny pinky gray, respectively:

WCS is again selecting the material based on the Material Gradient Driver value, but this time it is having to blend the materials.

25. OK, let's recap: We now know that this thing called a Material Gradient Driver can be used to Drive the placement of Materials on a Gradient. Our gradient is simple - only 3 materials, but theoretically there is no limit to the number of materials you can string out along your gradient. I've created gradients with 9 or more color pins, and you can set there position in the gradient to 3 decimal places, so 100,000 is possible if not feasible! But without some variance in the Material Gradient Driver value over time or space, we are only ever going to see 1 material rendered. WCS allows you to keyframe the driver value as you would any other animatable parameter - so you could create 4 materials to represent seasonal ground cover and animate them to do a time lapse season change, for example. However, it is generally more powerful to drive the value itself with another texture (or textures!). So let's have a look at that:

26. Notice the little button to the right of the Material Gradient Driver's textbox? Click on it and select Create Texture from the popup menu. Our all-too-familiar texture editor interface will appear:

27. The first thing you should notice is that the texture element that appears is, as always, Fractal Noise at default settings. But this interface has more similarities with the Remap Function interface than the normal texture editor. In fact, it could be argued that we are "remapping" the Material Gradient Driver's value, but by using a texture.

28. Right, before we proceed, quickly enter Conceptual Grasp mode! Imagine that you were applying this Fractal Noise to the landscape. When rendered, we would expect the texture to create patches of black and white over the terrain. OK, not at a scale we could see in this example, as our camera is 350m in the air, and our texture has a default scale of 1m! Now try and imagine that the texture is not creating areas of different color over the terrain, but areas of different value. Note that there are no colors assigned to this texture. The texture values run (as with the remap functions) from 0 (black) to 1 (white), and can be correlated to a range of values in the gradient (from 0% to 100%). In this way, WCS can use the varying values over the terrain to render varying materials, according to their position on the Materials Gradient. Hope that wasn't too unclear! Now we can apply a bit of that knowledge:

29. The only thing we need to change at this point is the scale of our Fractal Noise - set the size values to 100m in all 3 axes.

30. Render a preview and you should see the effect:

The Terrain is now covered with a blotchy pattern of materials. It looks OK (well, better than before!) but I'd personally like to do 2 things to it. Firstly, decrease the amount of feathering between the rock and mud materials, and secondly, increase the amount of grass material.

31. Return to your Ground Editor, and click on the Material Gradient Driver tab.

32. Select the pin corresponding to the mud material by clicking on the color well below the pin. Change the Blending Mode for the material to Half Blend. Do the same for the rock material, but also change its position on the gradient to 60%. By the time you've finished, your gradient should look like this:

33. Do a quick rerender and check the changes over the last render. There should now be more green, and less mud, and the edge between mud and rock should have sharpened considerably.

Note: we could have achieved the exact same effect by remapping the fractal noise pattern to compress those areas of the value scale where we wanted less or more of a particular material to appear. In this case it was easier to manipulate the pins on the gradient.

34. All that remains is to add some complexity to each of our materials, this time using planar image maps.

35. Select the Ground Editors Material tab. Select the Grass material, and click on the button to the right of the diffuse color well. Select Create Texture from the popup menu to enter the texture editor interface again.

36. Select the leftmost pin in the color gradient and click the button to the right of it's color well to add a child texture. Reselect the Root Fractal Noise texture and do the same for the other pin. Your texture editor interface will now look something like this, although again, your colors may be different:

37. Select the uppermost child texture and change its type to Planar Image by selecting it from the drop down list below Selected Element.

38. Do the same for the other child texture.

39. Reselect the first child texture and your interface should look like this:

40. From the drop down list below the Elements list, select New Image Object...

41. In the requester that follows, locate your WCSContent:\images\textures\grass folder and select LawnGrass1_4.iff. Do the same for the second child texture, but select LawnGrass1_5.iff.

42. In order for the landscape to be covered by these images, we will tile them. Click the Tile and Flip Alternates for both Width and height on both child textures. You should see the textures tiling in the Preview Windows as you change the settings. Change the preview size to 30m - The tiling at this point will be very noticeable, but there are some things we can do to reduce it:

43. Apply a Remap Function 1 to the Fractal Noise that is being used to mix the two images. Leave it as the default of Bell Curve, but set it with an Amplitude = 100%, Shift = 25% and Skew=15%.

44. OK - the tiling is still noticeable. We could add more images to the mix and try and generate some degree of blending that obscured this, but there is an easier way. Change the size of the Fractal Noise root texture to 8m in all three axes. Change the size of the first child texture to 5m in all three axes, and the scale of the second child texture to 6m in all three axes. Strictly, you don't need to change the z-axis with the images, as we are mapping in a planar fashion along that axis, but change it anyhow, just to keep things neat!

45. The same applies to the image center. Change the Center of the second child texture to 2m on the x-axis, and 3m on the y-axis. This helps misalign the "seams" that are produced by tiling the images, as the two sets of seams won't line up any more. Just make sure that if you choose to offset the image centers, you should not use factors of the image scale. ie: if your image is 12m by 12 m, I would avoid center offset values of 1, 2, 3, 4, 6 and 12 as they are all factors of the image scale (12m). Again, do a test render to see:

46. The last thing we can do to try and hide the tiling effect is to rotate the images slightly.

47. Select the first child texture in the Elements list and click the rotation button. Enter 13.769 degrees into the Z rotation field.

48 Select the second child texture and do the same, but enter -17.137 degrees into the Z rotation field. What we are trying to achieve here is to rotate the images so that they are neither aligned nor at a multiple of 90 degrees to each other. With the values chosen above, the two images should be rotated relative to each other by about 30 degrees which is ideal.

49. If you are unhappy with the way the grass looks, try playing with the settings until you get the look you want. Some seams are bound to occur if you tile image maps, but depending upon your viewpoint and other factors such as vegetation cover, they may or may not be visible. When you have got the hang of things, try and create two more materials for Mud and Rock in a similar way using either procedural textures or image maps, as I have just demonstrated. Here's what I came up with in just a minute or two:

Here are the settings for my Mud and Rock materials:

Mud:

Rock:

50. When you are happy with your ground cover component, save the component for later use: Click on the button at the right edge of the Ground Editor window. An interface similar to this will pop up, but with your details already entered:

Add a comment and, if you wish, use the last test render you did as a thumbnail (this will be located by default in your WCSFrames: folder and will be called WCSLastRender.iff)

51. Click on Save to Disk and Close. We will be using this component in Parts 7 and 8 of the tutorial to save us having to build it from scratch.

52. Feel free to try out different textures to drive our materials, too. We are using Fractal Noise to distribute our materials across the terrain, but we could just as easily use Bricks, or Turbulence, Stripes, or even an image map itself! Don't try out the Dynamic Parameters yet - I'm going to dedicate Part 7 of the tutorial to this very powerful feature. Here's an example of using F1 Cell Basis to rive the distribution of our 3 materials:

53. Save your project to disk and proceed on to Part 7, where we are going to make some changes to our Material Gradient Driver texture settings in order to result in a more realistic distribution of our 3 materials.

Copyright © 2003 N-Light Ltd All Rights Reserved