{"id":29,"date":"2007-07-18T16:14:05","date_gmt":"2007-07-18T20:14:05","guid":{"rendered":"https:\/\/www.webomator.com\/making-displacement-mapped-terrain-with-world-machine-and-3ds-max\/"},"modified":"2007-07-18T16:14:05","modified_gmt":"2007-07-18T20:14:05","slug":"making-displacement-mapped-terrain-with-world-machine-and-3ds-max","status":"publish","type":"page","link":"https:\/\/www.webomator.com\/wordpress\/making-displacement-mapped-terrain-with-world-machine-and-3ds-max\/","title":{"rendered":"Making Displacement Mapped Terrain with World Machine and 3DS Max"},"content":{"rendered":"<em>Note:  This article was written in 2007, when I was using World Machine 1.0.  The basic functions of the software remain unchanged so the article still &#8220;works&#8221; &#8211; you should just know that World Machine also does much more now!<\/em>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/terraintest.jpg\" alt=\"Displacement Mapped terrain from World Machine and 3DS Max\" height=\"298\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nThis is a test rendering of a natural landscape which I rendered in 3DS Max 8. The terrain&#8217;s  from a height map I generated with the free version of <a href=\"http:\/\/www.world-machine.com\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em>World Machine<\/em><\/a>. This height map became a Displacement map in 3DS Max.\n<\/p><p>\nWorld Machine is a program that generates terrain in the Terragen format &#8211; but it also exports 16 bit displacement maps that you can use in just about any 3D rendering system. The free version that I used here is missing a few features &#8211; though not many &#8211; and it can only export maps up to 512 x 512 pixels in size. The  paid version doesn&#8217;t have those limitations and only costs $40. So, since I&#8217;m always fascinated with tools for building believable terrain, I thought I owed it to myself to give the free version a spin.\n<\/p><p>\nI&#8217;m going to write about how I used the program below. But because generating the terrain is often less of a problem than texturing it, I&#8217;ll continue with the way I built the complex material you see in this scene in 3DS Max.\n<\/p><p>\nI started by <a href=\"http:\/\/www.world-machine.com\/download.html\" target=\"_blank\" rel=\"noopener noreferrer\">downloading<\/a> the free &#8220;Basic&#8221; edition of World Machine. Then I fussed about with it and spent some time with its docs, which was time well spent because of the way in which the software works.\n<\/p><p style=\"text-indent:0px;\"><br \/>\n<strong>1. Creating the Height Map<\/strong>\n<\/p><p>\nThe interface for World Machine will remind 3DS Max users of Particle Flow &#8211; it uses a very similar system of operators (&#8220;devices&#8221;) that are linked together in a chain. So you start with a generator device, which is your starting point, and then add additional devices linked to it in sequence. These other devices include both Erosion and Thermal Weathering, Terracing, and so on.\n<\/p><p>\nStill more devices can be used for selecting part of the terrain based on its slope or angle; these and other techniques are used to create masks for some of the operations you&#8217;ll perform; and you can import a bitmap image to use as a mask, too. Two separate device chains can be linked together using a &#8220;Combiner&#8221; device that controls the way they&#8217;re blended.\n<\/p><p>\nFinally you have a file output device, through which you can save off your terrain as a Terragen file, or in several image formats.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/Wmachine_01.jpg\" alt=\"World Machine graph view\" height=\"371\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nThis kind of system makes absolute sense to a programmer. It&#8217;s not my favorite sort of UI because of its abstract and indirect nature &#8211; I always have an urge to reach out for the thing I want to change, and <em>just change<\/em> the damn thing. But in practice, one has to alter a property that affects the thing one wants to change, then observe the result. This is what I mean when I say &#8220;abstract and indirect&#8221;.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/Wmachine_02.jpg\" alt=\"World Machine 3D Preview\" height=\"371\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nSo now that you know I&#8217;m not a fan of this kind of interface, I&#8217;ll tell you that in World Machine&#8217;s case it&#8217;s not excruciating. There&#8217;s a 3D preview of your landscape that updates as you change the properties of a device, so at least you&#8217;re not working in total isolation from the piece you&#8217;re working on.\n<\/p><p>\nAnd as you grow more familiar with the ways the Devices work, that preview almost feels interactive. Just keep it displayed on the screen unless you&#8217;re adding to or changing the device chain (you&#8217;ll want the graph view for that), and you&#8217;ll be fine.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/Wmachine_03.jpg\" alt=\"World Machien 3D View, Built\" height=\"371\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n\n<p>One thing you&#8217;ll want to know is that the 3D preview is a low quality version of the terrain. You&#8217;ll need to &#8220;Build&#8221; the terrain in order to see the true effect you&#8217;ve created &#8211; which is <em>much<\/em> more interesting, believe me, than the preview. The preview just serves to show you a quick version of the terrain as you change it. (<em>You can see the difference between a preview and a &#8220;Built&#8221; terrain in the two screen shots above.<\/em>)<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/explorer.jpg\" alt=\"World Machine Explorer View\" height=\"202\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nIn World Machine&#8217;s &#8220;Explorer View&#8221;, you&#8217;re able to move the active box you&#8217;re working on. You can scroll that active box around a gigantic world that&#8217;s been generated based on the parameters you set. It&#8217;s pretty neat.\n<\/p><p>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/DeviceList.gif\" alt=\"World Machine Device List\" height=\"244\" width=\"184\" style=\"float:left;margin:12px;margin-left:-12px;\"\/>At left, you can see the list of Devices I used to generate my mountains. In the first screen shot above you can see what these Devices look like in the graph view where they link together. There&#8217;s a Perlin Noise Device to start off &#8211; but I&#8217;ve also loaded a <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/CanyonPaths.gif\" height=\"150\" width=\"150\" style=\"float:right;margin:12px;margin-right:0px;\"\/>bitmap image to create some less procedural features.  That bitmap looks like the scaled down version here, on the right.\n<\/p><p>\nThe Combiner Device lets me mix these two together using Add, Subtract, Min, Max, and other options. In this case I&#8217;ve opted to Subtract. You can see below how the terrain looked in each of these three stages.\n<\/p><p>\nWhy did I use the bitmap? First off, I wanted to try creating a path through the landscape that I might use later; but also, the completely procedural landscapes &#8211; while they look good &#8211; are always a little bit&#8230; procedural. I wanted to carve something through that landscape in a more deliberate way. And hats off to World Machine, because that worked out just great.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/Wmachine_04.jpg\" alt=\"World Machine - 3 stages\" height=\"140\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nI especially like the Erosion device. It has several options that are easily grasped, and the &#8220;Channeled Erosion&#8221; mode does some wonderful and natural-looking things. Adjust those &#8211; then &#8220;Build&#8221;, because you won&#8217;t get much of this from the quick preview &#8211; and your landscape really begins to come to life.\n<\/p><p>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/heightmap.jpg\" alt=\"Height map from World Machine\" height=\"220\" hspace=\"6\" width=\"220\" style=\"float:right;margin:12px;margin-right:-12px;\"\/>Finally I used the File Output Device to create my displacement map. Apart from the initial learning curve, this presented the biggest problem.\n<\/p><p>\nI had to work out which of the available formats I could use, knowing that I had to convert the file afterwards to something I could load in 3DS Max. The answer turned out to be that I needed to export a 16 bit RAW file and load it into Photoshop (using &#8220;Load As&#8221; Raw). From there I was able to save it as a 16 bit TIFF file, which Max would read. A scaled down, 8 bit version is shown on the right.\n<\/p><p>\nIt&#8217;s at this point, having output my height map, that I moved on to 3DS Max.\n<\/p><p style=\"text-indent:0px;\"\"><br \/>\n<strong>2. From Height Map to 3D Object<\/strong>\n<\/p><p>\nIf you&#8217;ve ever applied a displacement map to an object there aren&#8217;t any surprises here. I started up Max and created a plane that was divided into 64 polygons on each axis. I added a Meshsmooth modifier on top of that, so that I could control how much subdivision I was applying. Then I added a Displace modifier, using World Machine&#8217;s converted 16 bit image as my displacement map. I played around with the strength of the displacement till I liked it. You can see the terrain at this stage in the image below.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/terrain_A.jpg\" alt=\"Displacement mapped terrain from Height Map\" height=\"299\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nThis wasn&#8217;t at all bad. But I thought that even though my displacement map was only 512 x 512, there was more detail in it than what I was getting. The obvious thing to do there was to increase the Meshsmooth value to add resolution to my object. Chancy &#8211; because it was pretty high res already &#8211; but easy to try.\n<\/p><p>\nSo after Max crashed, I decided to try something else. First I lowered the resolution of my original object a little, so that I could increase the Meshsmooth value on an object that was initially less complex. No joy there either, I&#8217;m afraid. After some trial and error what I eventually did was to collapse the object&#8217;s stack, then apply a second, slight displacement to it with a Noise map as the source. This let me add a finer level of detail to the landscape. Here&#8217;s what that looked like:<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/terrain_B.jpg\" alt=\"Final Displacement Mapping\" height=\"295\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nYou may notice that I used the X, Y and Z tiling settings for the Noise map to create horizontal ridges in the rock face. This was much more what I was looking for. It could be that with the &#8220;Standard&#8221; version of World Machine  I&#8217;d find that a higher res height map would give me that greater level of detail I wanted. But for this experiment, that second, fine-grained displacement seemed to work just fine.\n<\/p><p>\nAnd that was it, for creating the object itself. From here on out, everything was about creating the right material for the mountains.\n<\/p><p style=\"text-indent:0px;\"><br \/>\n<strong>3. The Material<\/strong>\n<\/p><p>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/material.jpg\" alt=\"3DS Max Natural Material\" height=\"347\" width=\"197\" style=\"float:left;margin:12px;margin-left:-12px;\">By the time I made my mountains I&#8217;d been playing around with World Machine for a couple of days and I had several texture experiments behind me already. Texturing this kind of terrain is always challenging. You want to treat the different areas (cliffs, meadows, and so on) differently, but you need those different materials to blend together smoothly and in a believable pattern. So while the materials you make for rock, dirt and grass are all important, masking the transitions between them is usually the most complicated problem.\n<\/p><p>\nI&#8217;ve tried lots of different things. I most often do my large area masking with vertex colors, and I generally bake in those vert colors based on lighting.\n<\/p><p>\nIn terrain that has a lot of contrast between vertical and flat areas I often place a shadow-casting light source above the terrain. That lights the flat areas, but leaves the cliffs in shadow &#8211; so when I bake the lighting into the vert colors (with &#8220;Assign Vertex Colors&#8221;, from the Utilities panel) I get white on the upward-facing flats, and black on the vertical faces. And though I do a little hand painting afterwards, that most often gets me  where I want to go.\n<\/p><p>\nBut not this time. I guess it was the many slopes, which are typical of height mapped terrain &#8211; but for whatever reason, my usual tricks weren&#8217;t giving me the kind of vertex color mask that I needed.\n<\/p><p>\nSo what I eventually did was to apply a Top\/Bottom material to the terrain. I made both the top and bottom materials self-illuminated &#8211; one white, the other black &#8211; to better see what they were doing, and changed the &#8220;Blend&#8221; and &#8220;Position&#8221; parameters to adjust which slopes on the object went white, and which black. Although it did take some trial and error, this eventually gave me about what I needed. So I used &#8220;Assign Vertex Colors&#8221; to bake the object&#8217;s diffuse colors into its vertices, and that gave me a vertex color map that I could use to blend my materials together.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/terrain_C.jpg\" alt=\"Vertex Colors for Masking\" height=\"282\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nAt this stage, I had a vertex color map that would let me blend between two materials. One would be for earth and grass, the other for stone. As you can see above, in the vertex color mask the white areas (flat) are to be earth and grass, while the black areas (vertical) are to be stone.\n<\/p><p>\nThe actual material gets quite a bit more complicated &#8211; but that single division is the main one.\n<\/p><p>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/material_tree.gif\" alt=\"3DS Max material tree\" height=\"546\" width=\"306\" style=\"float:right;margin:12px;margin-right:-12px;\"\/>Looking at this material tree may make your brain hurt. But because it <em>is<\/em> a tree, you can see that at its top level there are two materials (&#8220;Stone and Dirt (Blend)&#8221; and &#8220;Grass Overlay (Standard&#8221;). Those two are combined using an image map which I haven&#8217;t mentioned &#8211; because it came along very late.\n<\/p><p>\nThe material we&#8217;ve been preparing the vertex colors for is the &#8220;Stone and Dirt&#8221; material.\n<\/p><p>\nThis uses a <a href=\"http:\/\/www.darksim.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Dark Tree<\/a> material called &#8220;Morro Rock&#8221; (coincidentally named after a huge volcanic plug that sits on the beach in a town where I used to live). That&#8217;s our stone material, which shows in the vertical faces and anyplace else where that vertex color mask is black.\n<\/p><p>\nSecondly, there&#8217;s a &#8220;Two tone Dirt&#8221; material which is two different <em>Ground Crew<\/em> textures (available from <em><a href=\"http:\/\/www.digimation.com\/home\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">Digimation<\/a><\/em>) mixed together using a Falloff map, set to &#8220;Fresnel&#8221;. I adjusted the Falloff mixing curve to get just the blend I wanted between these two natural textures. The Falloff map, as a mask, makes one of those textures strong on surfaces that face us; the other texture is strong on surfaces that are perpendicular to the camera. The blend between those two gives us a rich dirty surface.\n<\/p><p>\nThese &#8220;Stone&#8221; and &#8220;Two-Tone Dirt&#8221; materials  are blended together based on the vertex color mask I created above. But as you look at the material tree, you&#8217;ll see that there are several levels of materials and maps within these, which are blended based on masks; whether the vertex color mask, at the highest level, or the various Falloff and procedural masks at lower levels of the tree. So while that first vertex color mask creates the main division between stone and earth, within those divisions I&#8217;ve created additional variety and subtle gradations of color.\n<\/p><p>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/mask.gif\" height=\"250\" width=\"250\" style=\"float:left;margin:12px;margin-left:-12px;\n\"\/>The final material is the &#8220;Grass Overlay&#8221;. I found that I just needed to place some greener bits at specific places in the landscape, so I painted a mask to place those where I wanted them. A reduced version of that mask is shown here.\n<\/p><p>\nIn fact, I guess it&#8217;s worth noting that this and the photographic grass texture are the only two image maps used in the terrain. Everything else is procedural, including the material I used to bake in the vertex colors.\n<\/p><p>\nBecause materials and lighting are interdependent I would continue to adjust the material once I had a particular picture in the works. But as shown here it&#8217;s a nice, general sort of &#8220;almost-there&#8221; material that&#8217;ll do fine until the terrain arrives in a picture.<\/p>\n\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webomator.com\/grafx2\/tutes\/terrain01\/terraintest.jpg\" alt=\"Natural Terrain with World Machine and 3DS Max\" height=\"298\" width=\"501\" style=\"margin-top:16px;margin-bottom:12px;\"\/>\n<p>\nSo there it is; for now, just a hunk of terrain. Overall I found that World Machine did a fine job &#8211; even though, as I admitted, its UI is exactly what I normally hate.\n<\/p><p>\nRemember that I made this test with the <em>free<\/em> version of the program. More features and higher res height maps are available in the full version, which at $40 sounds like a bargain to me.\n<\/p><p>\nThis won&#8217;t suit for absolutely <em>any<\/em> sort of terrain you want. Height maps have an inherent limitation. They&#8217;re images that show a piece of terrain from directly above, and by definition only one pixel in the image can give height information at that position. That means that  height maps can&#8217;t define undercuts in the landscape, like eroded river banks and canyon walls &#8211; and they can&#8217;t do caves or arches. You can always edit the object, of course, but for a truly wild landscape with lots of undercuts, caves, and free-standing, overhanging features you&#8217;ll want to take another tack entirely. I touched on this in my <a href=\"https:\/\/www.webomator.com\/making-of-warrior-tools\/\"><em>Warrior Tools<\/em><\/a> tutorial.\n<\/p><p>\nBut aside from that limitation height maps are pretty versatile. <a href=\"http:\/\/www.world-machine.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">World Machine<\/a> has a useful set of tools for creating interesting and realistic landscapes, and depending on the version you want, it&#8217;s either cheap, or free. <a href=\"http:\/\/www.world-machine.com\/download.html\" target=\"_blank\" rel=\"noopener noreferrer\">Go for it<\/a>!\n<\/p><p>\n&#8220;World Machine Pro&#8221;, which is now in development, will include some very useful features that give even more realistic terrain and options for creating landscape-based textures and texture masks (huzzah!).  You can peek at the <a href=\"http:\/\/www.world-machine.com\/blog\/\" target=\"_blank\" rel=\"noopener noreferrer\">development diary<\/a> for more information.\n<\/p><p style=\"text-indent:0px;\"><br \/>\n<strong>Miscellaneous notes:<\/strong>\n<ul><li>\nMeshsmooth Levels: 4<\/li><li>\nObject polygons, after meshsmooth: 524,288<\/li><li>\nHeight map resolution: 512 x 512<\/li><li>\nImage mask resolution (in World Machine): 512 x 512<\/li><li>\nImage mask resolution (in 3DS Max, for grass): 2048 x 2048<\/li><li>\nSky image: based on one of many spiffy ones at <a href=\"http:\/\/www.cgtextures.com\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em>CG Textures<\/em><\/a><\/li><\/ul>\n<\/p><p style=\"text-indent:0px;\">\n<em>Updates:\n<\/p><p>\nLike I mentioned at the start, World Machine&#8217;s come a long way since I posted this article.  It&#8217;s now much easier to export a Max-friendly displacement map, for one; and among the other changes I especially like, you can export a mask image based on the terrain&#8217;s slopes, erosion, and other characteristics.<\/em>\n<\/p><p>","protected":false},"excerpt":{"rendered":"<p>Note: This article was written in 2007, when I was using World Machine 1.0. The basic functions of the software remain unchanged so the article still &#8220;works&#8221; &#8211; you should just know that World Machine also does much more now! This is a test rendering of a natural landscape which I rendered in 3DS Max [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-29","page","type-page","status-publish","hentry"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/pages\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":0,"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/pages\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.webomator.com\/wordpress\/wp-json\/wp\/v2\/media?parent=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}