Blender 3D: Noob to Pro/How to Do Procedural Landscape Modeling< Blender 3D: Noob to Pro
I was playing around in Blender several months ago and messing with cloud textures when I found a great way to make landscapes entirely within Blender (without height maps from The Gimp or some other application) and decided to make a tutorial (yes, it does use the noise tool).
For 2.7X blenderers out there:
though this is a 2.4 based tutorial it works fine for 2.7X versions. The only big difference that doesn't work is that the normal button in the influence panel instead of map to panel, and the diffuse shader they mention later is actually in the material's context and in the diffuse panel.
Making the MeshEdit
To start, open up Blender and with the cube selected, press the XKEY and click Erase Selected Objects.
Add a grid (SPACE--> Add--> Mesh--> Grid), using whatever numbers you like, remembering that bigger numbers means more vertices. For this tutorial, I'll use 60 for x and y resolution. Scale the grid up, but only a little bit (I went up to 1.3) as the texture won't make very tall landscape with a very big grid. Press the F5 key to go to the Materials tab, then add a new material.
Displace and ShadeEdit
Now press the F6 key to go the Textures panel, and add a cloud texture in the very first slot (slot 0).
After Pressing F6, look at the windows on the bottom. To the left is the "preview" window and next to that (to the right) is a Texture window with an Add button... click that and then go to the little pull down menu that shows up just below and to the right. From there, find and select "Clouds"... and now, continue!
You may be wondering how we are going to make landscape with a cloud texture, when you could just use the Gimp height map plugin, Terragen, or the A.N.T. modeling script right in Blender. Well, we are going to make the landscape with a height map. The color determines the height: white = very tall; grey = halfway tall; black = no height. This makes the cloud texture a very good candidate for land.
The next thing we are going to do is adjust the size. You can set the noise size to whatever you want, but I want to have several bigger pieces of landscape, instead of a bunch of little ones so I'm setting noise size to 1.00 and noise depth to 6, as I want a high level of detail. (The Preview immediately shows you the effect of your "tweaks" as you make them.)
Noob Note: You can hold shift and click the number next to noise size then just type 1 and press enter instead of using the arrows. The same applies for NoiseDepth, almost every other setting in blender changes like this as well.
At the top, we can select Hard noise or Soft noise. Each gives a different landscape, so experiment with them. Next, go to the Colors tab (it's right next to the texture button by default). Adjust the brightness and contrast as required. For "Hard noise," try a brightness of 1.9 and a contrast of 3.45. For "Soft noise," a brightness around 1.0 to 1.2 should be fine.
Noob Note: The above noob note applies to the brightness setting as well!
Jump back to material buttons with F5 and go into the "Map To" panel. Turn off col and press nor once.
Noob Note: I had a difficult time finding the "Map To" so if you are too... This is one of the several small Windows that opens at the bottom of your screen after pressing F5 and for me, it was on the far, far right, off my screen. I had to use my mouse wheel to scroll the Windows to the side to bring it into view and found it as a Tab on a Window with two other tabs. "Col" and "Nor" are buttons in the Map To Tab.
Another Noob note: In version 2.66, the "map to" equivalent is found in the texture window (under the tab "influence") there you can adjust the color and normal settings. they are referred to by their full names.
- What the buttons are for: The "Map To" settings determine which various attributes of the material will be affected by our "cloudy texture."
- "Col" refers to "color." We turn it off here, because we don't want our surface to look "cloudy."
- "Nor" refers to "surface normals." This is the angle at which light seems to reflect from the surface. (The so-called "bump map.")
- Experiment with the other "Map To" buttons, as well! For instance, "Disp" (for "displacement) actually causes a map to deform the geometry of a surface... but doing so only during rendering.
In this tutorial, as you will see, we are going to combine several techniques to produce a very rocky surface. Here, we are changing the way that the surface reflects light. Then, we'll actually deform the surface geometry.
Turn the nor value all the way up, to 25 (that will give it a nice rocky look). Go into the Shaders tab and then change the "Diffuse Shader" (the top left selector, defaulting to "Lambert") to "Oren-Nayer," and the "Specular Shader" (the 2nd selector, defaulting to "CookTorr") to "Blinn." Adjust the Rough value in Oren-Nayer to 1.5 (rock is really rough). Also, set the Spec value to 0.01 and Hard to 25. Now we are ready to make some mountains!
- Trivia note: In computer graphics, a "shader" is a mathematical function, and they're customarily named after the clever people who invented them. These functions determine exactly how the cloudy-texture will "map to" the attributes (e.g. "Nor"...) that we selected.
Press TAB to go into edit mode and press the AKEY twice, in case you had any specific vertices selected. Go into the front view and press the "Noise" button(located under mesh tools in F9). You should see the vertices jump up a good bit.
If not, you may have scaled your grid up too much, so make it somewhat smaller. Depending on how high you want your mountains, press the Noise button to your required amount, though I pressed it 8 more times. The mesh doesn't look very good right now, as it is not only blocky, but it is missing that last bit of random detail.
- Important note! The mesh-editing button named "Noise" causes a permanent change to the geometry of the object in the "Z"-axis, as provided by the texture. (The vertices actually moved, and their new position is permanent.)
- There is also a procedural texture named "Noise," but that is just pure coincidence. The two are unrelated, both in what they do and in how they work.
- Important note! Those using Blender 2.5 Beta in order to get the height map to affect the geometry you will need to use the displace modifier instead.
If you are not in edit mode, go into it and select all the vertices. Press Fractal (in the same row as Noise under mesh tools) and enter a value of 15 in the random factor. Hopefully, your system can manage all these vertices: if not, then don't do any fractal subdivide. If you want to, you can use a smaller value in the fractal box and do it several more times for more displacement. Be careful, though: too much randomness will cause vertices to separate, causing tears in the mesh that you will have to fix by hand.
Finally, tab out of edit mode and press Set Smooth. Then, if you want to make the mesh even more smoother, add a Subsurf modifier, with what ever level you want. (I'm going with 1 for faster render times.)
If you desire, you can scale up the mesh however big you want though for close-ups, you may want another level of subsurf or another subdivide. Then, apply colors, set up the lights, and render! A word to the wise, however: this process creates a huge file (about 986kb).
You have just made mountains all in Blender, without having to generate height maps in The Gimp, or any other program. The next step is to go beyond the tutorial. Try using different noise sizes and noise basis, and even try using other textures like musgrave and marble. Or try using two textures and see the conclusion. The possibilities are almost infinite! Have fun.
Observe how the technique illustrated this tutorial is "the same, yet different" from the one demonstrated in the tutorial for "height maps":
- A procedural texture was used to supply changes to the Normal Mapping of the object at render time. (This is the angle at which the object reflects light.) (The "height mapping" tutorial did not do this.)
- Then, the mesh-editing button (also...) named "Noise" was used to deform the actual geometry of the mesh. (This is the same technique used in the "Height Map" tutorial, although a different kind of texture .. an image .. was used.)
- The texture, once used for the height-mapping (deformations) was left in place, still mapped to the surface "Nor"mals. The result will be a very mountainous landscape.
Yep! The techniques shown in all of these terrain-modeling tutorials can be combined! And, they frequently are. Very often the most satisfactory results are obtained by combining several different techniques. You could have used an image-map (from the "Height Mapping" tutorial) to deform the geometry, then used the "noisy Normal-mapping" idea from the first part of this tutorial, and even used smoothing. All at the same time. The choice is yours.
When using "Map To," remember that a single material can have several different textures applied to it, each one mapped to the same or to different attributes. This mapping can even be animated.
Experiment! The sky's the limit!