{"id":143,"date":"2006-02-03T18:24:17","date_gmt":"2006-02-03T23:24:17","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=143"},"modified":"2011-04-10T05:42:18","modified_gmt":"2011-04-10T10:42:18","slug":"terrain-part-3","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=143","title":{"rendered":"Terrain, Part 3"},"content":{"rendered":"<div class=date>Distance-based polygon reduction<\/div>\n<p>Work continues on the <a href=\"?p=141\">Terrain Engine<\/a>.  <\/p>\n<p>As I mentioned in previous updates, the terrain uses fewer polygons in flat areas and more in uneven areas. This is nice, but we can still do more. For example, Polygon density is the same all over the terrain.  A better idea is to have it be more agressive in removing polygons in the distance.  Stuff that is far away could be much simpler. Let&#8217;s see:<\/p>\n<p><center><img src='http:\/\/www.shamusyoung.com\/twentysidedtale\/images\/terrain5.jpg'\/><\/center><br \/>\n<!--more--><br \/>\nThis time, the lower-left shows the normal optimization, and on the upper-right is the one where it removes more polygons in the distance.  As you can see, close up they work the same, but in the distance I&#8217;m now using a lot less polygons.  I&#8217;m all the way down to 65,195 polygons!  That is a reduction of about 88% from our first terrain.  We <i>can<\/i> see the difference at this point, but the differences are subtle and easily worth the massive savings.<\/p>\n<div class=date>Terrain coloring<\/div>\n<p>I&#8217;ve added some code to look at the shape of the land and color it accordingly.  The high grass is pale, the lowland grass is deep, lush green.  Steep banks are dirt-colored.  High banks are grey (rock) colored.  <\/p>\n<p>Note that all of this is simple vertex coloring, just to give an idea of how the terrain might look if used in a game of some sort.  This is cheap and simple, and will be replaced later in the project by something more robust.<\/p>\n<p><center><img src='http:\/\/www.shamusyoung.com\/twentysidedtale\/images\/terrain6.jpg'\/><\/center><\/p>\n<p>Now it&#8217;s starting to look like something. However, the surface is so smooth and the color changes are so gradual that the whole thing looks like dull plastic.  That&#8217;s not what I want.  Let&#8217;s give it a texture.<\/p>\n<p><center><img src='http:\/\/www.shamusyoung.com\/twentysidedtale\/images\/terrain7.jpg'\/><\/center><\/p>\n<p>That makes a big difference!  The texture I&#8217;m using is very simple: it&#8217;s just random greyscale noise, like a low-contrast version of television snow.  Still, the small variations of brightness really brings the surface to life.  All these screenshots so far have been from the same position for comparison, but there is a lot more to the terrain. Let&#8217;s look at it from another angle:<\/p>\n<p><center><img src='http:\/\/www.shamusyoung.com\/twentysidedtale\/images\/terrain8.jpg'\/><\/center><\/p>\n<p>I want to point out that I am avoiding adding lots of fancy effects to the scene.  I could make this look much more striking by using dramatic lighting (sunrise or sunset shading), adding a proper horizon (so this isn&#8217;t a square island floating in space), adding clouds, sun, lens flares or any number of other scene-enhancing effects.  Without these, things may look bland, but it also means I won&#8217;t be propping up a lame system with a lot of makeup.  The time to add that stuff is later.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Distance-based polygon reduction Work continues on the Terrain Engine. As I mentioned in previous updates, the terrain uses fewer polygons in flat areas and more in uneven areas. This is nice, but we can still do more. For example, Polygon density is the same all over the terrain. A better idea is to have it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"class_list":["post-143","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=143"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}