{"id":20,"date":"2009-04-20T15:50:11","date_gmt":"2009-04-20T22:50:11","guid":{"rendered":"http:\/\/lucasmagder.com\/blog\/?page_id=20"},"modified":"2017-10-30T08:49:35","modified_gmt":"2017-10-30T15:49:35","slug":"terrain-generator","status":"publish","type":"page","link":"http:\/\/lucasmagder.com\/blog\/projects\/terrain-generator\/","title":{"rendered":"Terrain Generator"},"content":{"rendered":"<p>In my last term at Waterloo I took CS 488 which is the computer graphics course offered by the CS Department. The course culminates in a really open-ended final project where you can basically do whatever you want so I decided to take my game engine Emerson for a spin and try to develop a procedural terrain generator. It turned out to be kind of overkill for what the course actually required, but I did manage to tie for first place in the professor's \"best project\" competition.<\/p>\n<p>I completed this in about 3 weeks working from a fork of my Emerson renderer. The project required that your submission could run on Linux with a GeForce 8800 GT. Theoretically Emerson is pretty portable but that's never really been tested since I run Windows on all my machines. Luckily for once theory and practice actually gave the same results and it took less than a day to port things over.<\/p>\n<p>Some of the main features:<\/p>\n<ul>\n<li>All geometry is generated procedurally from perlin noise<\/li>\n<li>A quad-tree based level of detail system manages the level of detail of a pool of terrain tiles that reuse a pool of buffer resources<\/li>\n<li>You can walk forever and new terrain is generated as you go<\/li>\n<li>There are shadows using cascaded shadow maps<\/li>\n<li>Parallax mapping on the tree trunks<\/li>\n<li>A dynamic sky including haze, clouds, and the sun<\/li>\n<li>Water implemented as a post-processing effect<\/li>\n<\/ul>\n<p>All in all, I think it turned out pretty well and I'm planning to backport it to the mainline engine since it's the best demo we've got so far.<\/p>\n<h3>Screenshots<\/h3>\n<p>These screenshots are 1920x1080 so they may take a while to open<\/p>\n<p><!-- index.php -->\n<div\n\tclass=\"ngg-galleryoverview ngg-ajax-pagination-none\"\n\tid=\"ngg-gallery-0e518f60173cb6dc28210c032a84bced-1\">\n\n    \t\t<!-- Thumbnails -->\n\t\t\t\t<div id=\"ngg-image-0\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-07-56-77.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-07-56-77.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-07-56-77.png\"\n               data-image-id=\"1\"\n               data-title=\"terrain-2009-04-20-15-07-56-77.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-07-56-77-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-07-56-77.png\"\n                    alt=\"terrain-2009-04-20-15-07-56-77.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-07-56-77.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\t\t<div id=\"ngg-image-1\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-09-11-47.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-09-11-47.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-09-11-47.png\"\n               data-image-id=\"2\"\n               data-title=\"terrain-2009-04-20-15-09-11-47.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-09-11-47-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-09-11-47.png\"\n                    alt=\"terrain-2009-04-20-15-09-11-47.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-09-11-47.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\t\t<div id=\"ngg-image-2\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-09-43-55.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-09-43-55.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-09-43-55.png\"\n               data-image-id=\"3\"\n               data-title=\"terrain-2009-04-20-15-09-43-55.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-09-43-55-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-09-43-55.png\"\n                    alt=\"terrain-2009-04-20-15-09-43-55.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-09-43-55.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\t\t<div id=\"ngg-image-3\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-17-00-73.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-17-00-73.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-17-00-73.png\"\n               data-image-id=\"4\"\n               data-title=\"terrain-2009-04-20-15-17-00-73.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-17-00-73-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-17-00-73.png\"\n                    alt=\"terrain-2009-04-20-15-17-00-73.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-17-00-73.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\t\t<div id=\"ngg-image-4\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-20-08-94.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-20-08-94.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-20-08-94.png\"\n               data-image-id=\"5\"\n               data-title=\"terrain-2009-04-20-15-20-08-94.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-20-08-94-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-20-08-94.png\"\n                    alt=\"terrain-2009-04-20-15-20-08-94.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-20-08-94.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\t\t<div id=\"ngg-image-5\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-22-24-93.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-22-24-93.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-22-24-93.png\"\n               data-image-id=\"6\"\n               data-title=\"terrain-2009-04-20-15-22-24-93.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-22-24-93-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-22-24-93.png\"\n                    alt=\"terrain-2009-04-20-15-22-24-93.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-22-24-93.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\t\t<div id=\"ngg-image-6\" class=\"ngg-gallery-thumbnail-box\" >\n\t\t\t\t        <div class=\"ngg-gallery-thumbnail\">\n            <a href=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-27-48-53.png\"\n               title=\"\"\n               data-src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/terrain-2009-04-20-15-27-48-53.png\"\n               data-thumbnail=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-27-48-53.png\"\n               data-image-id=\"7\"\n               data-title=\"terrain-2009-04-20-15-27-48-53.png\"\n               data-description=\"\"\n               data-image-slug=\"terrain-2009-04-20-15-27-48-53-png\"\n               >\n                <img\n                    title=\"terrain-2009-04-20-15-27-48-53.png\"\n                    alt=\"terrain-2009-04-20-15-27-48-53.png\"\n                    src=\"http:\/\/lucasmagder.com\/blog\/wp-content\/gallery\/terrain\/thumbs\/thumbs_terrain-2009-04-20-15-27-48-53.png\"\n                    width=\"100\"\n                    height=\"75\"\n                    style=\"max-width:100%;\"\n                \/>\n            <\/a>\n        <\/div>\n\t\t\t\t\t\t\t<\/div> \n\t\t\t\n        \n\t\t\n\t\t<!-- Pagination -->\n\t<div class='ngg-clear'><\/div>\t<\/div>\n<\/p>\n<h3>Demo Reel<\/h3>\n<p>I've also made YouTube video showing off some\u00a0 of the stuff I thought was cool, although running the actual program is better since you can mess with the controls.<\/p>\n<p><object width=\"640\" height=\"505\" data=\"http:\/\/www.youtube.com\/v\/gM8qth9x8u4&amp;hl=en&amp;fs=1&amp;rel=0&amp;hd=1\" type=\"application\/x-shockwave-flash\"><param name=\"align\" value=\"center\" \/><param name=\"allowFullScreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"src\" value=\"http:\/\/www.youtube.com\/v\/gM8qth9x8u4&amp;hl=en&amp;fs=1&amp;rel=0&amp;hd=1\" \/><param name=\"allowfullscreen\" value=\"true\" \/><\/object><\/p>\n<h3>Download<\/h3>\n<p>If you're interested, you can download the <a href=\"http:\/\/lucasmagder.com\/downloads\/TerrainRelease.zip\">source and windows binaries<\/a>. The code actually builds on Linux too but you need CMake. Currently, this version will only work on NVIDIA hardware, not because I used to work there, but because NVIDIA exposes a very useful proprietary OpenGL extension.<\/p>\n<h5>System Requirements<\/h5>\n<ul>\n<li>Windows XP\/Vista or Linux<\/li>\n<li>A SM3.0 capable NVIDIA graphics card with recent drivers. (GeForce 7800 and up running 16x.xx or greater should be fine)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In my last term at Waterloo I took CS 488 which is the computer graphics course offered by the CS Department. The course culminates in a really open-ended final project where you can basically do whatever you want so I decided to take my game engine Emerson for a spin and try to develop a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":22,"menu_order":999,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0},"_links":{"self":[{"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/pages\/20"}],"collection":[{"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":25,"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/pages\/20\/revisions"}],"predecessor-version":[{"id":185,"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/pages\/20\/revisions\/185"}],"up":[{"embeddable":true,"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/pages\/22"}],"wp:attachment":[{"href":"http:\/\/lucasmagder.com\/blog\/wp-json\/wp\/v2\/media?parent=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}