{"id":364,"date":"2013-12-05T08:54:55","date_gmt":"2013-12-05T08:54:55","guid":{"rendered":"http:\/\/www.world-machine.com\/blog\/?p=364"},"modified":"2013-12-05T21:42:32","modified_gmt":"2013-12-05T21:42:32","slug":"whats-new-on-the-dev-branch-localspaces-new-interpolation-technique","status":"publish","type":"post","link":"https:\/\/www.world-machine.com\/blog\/2013\/12\/whats-new-on-the-dev-branch-localspaces-new-interpolation-technique\/","title":{"rendered":"What&#8217;s new on the Dev Branch"},"content":{"rendered":"<p>Hi folks! Lots of things are in flight right now on the dev branch &#8212; time for a progress report.<\/p>\n<p><span style=\"line-height: 1.5;\">One of the things that goes hand-in-hand with the previous library and multiresolution support is the ability to create things in <strong>localspace<\/strong>. What does this mean?<\/span><\/p>\n<h1>Localspace<\/h1>\n<p>Localspace is a mode switch for your generators to allow you to create &#8220;free floating&#8221; individual textures, hero terrain elements, etc. These items are not located anywhere in the world; they don&#8217;t have a firmly defined scale or location. Think texture assets.<\/p>\n<p>You can feel free to use all of the potentially-problematic devices you want (flipper, displacement, normalize, etc). \u00a0As the packet is guaranteed to exist only in isolation, these manipulations are completely OK &#8212; there&#8217;s no tiles to mess up or anything like it. And you can of course\u00a0save or load them like any other terrain (the library I\/O works great here for banks of textures, etc).<\/p>\n<h2>Into the World &#8230;<\/h2>\n<p><span style=\"line-height: 1.5;\">When you want to integrate the localspace items into the world, you use a <strong>Placer<\/strong> device to insert the localspace item at a particular scale, to a particular location.\u00a0<\/span><span style=\"line-height: 1.5;\">And of course, the Placer uses the same sampling framework as introduced previously, so you can use fractal resampling, etc when placing it.<\/span><\/p>\n<p>I&#8217;ve talked to a number of people who have found the &#8220;Object Placer&#8221; macro very useful when creating their worlds. This is basically the same idea, but formalized and integrated into WM itself &#8212; and consequently more powerful.<\/p>\n<h2>&#8230; with Tiling<\/h2>\n<p>In addition, you can use the Placer to\u00a0<strong><em>tile<\/em><\/strong><strong><em>\u00a0<\/em><\/strong>the texture across the entire world. Right now there is only the option of regular tiling, but eventually I could see the placer also having an option to randomly scatter the object throughout the world, with optional rotation, etc.<\/p>\n<p>An additional device that will eventually appear to complement the above is a seamless tile\u00a0making device, which takes any localspace packet and blends the edges so that it will tile seamlessly when inserted into the world. In addition, it&#8217;s technically straightforward (though UI-wise somewhat challenging) to allow periodic noise and cellular textures, so that those generators will natively tile.<\/p>\n<p>&nbsp;<\/p>\n<p>So that&#8217;s the plan, how are things progressing? Functionally, we&#8217;re almost at 100%. As always, the lagging element is the GUI &#8212; everything from displaying what is local and what isn&#8217;t, to making it illegal to cross-connect local or worldspace items except through designated devices, etc. There&#8217;s a lot to be done in that department yet, and as usual for GUI work, it&#8217;s slow going.<\/p>\n<p>In other news&#8230;<\/p>\n<p>&nbsp;<\/p>\n<h2>A New Interpolation Technique<\/h2>\n<p>Something neat that I ran across earlier today and I thought was work a mention.<\/p>\n<p>Here&#8217;s the scenario: You are using a texture atlas or something similar, where each color has an encoded meaning (perhaps RGB(0,255,0) is grass, and RGB(127,64,64) is mud). Or perhaps you&#8217;re trying to segment a world into regions.<\/p>\n<p>When re-scaling this texture or placement map, traditional interpolation techniques give very bad outcomes &#8212; they introduce new intermediate values that are no longer correct in your texture atlas index, or that don&#8217;t map to your region correctly.<\/p>\n<p>What you really want to do is have the output use only the exact same colors as the input. Of the common interpolation methods in broad use, only Nearest Neighbor does this. And it looks terrible.<\/p>\n<p>Here&#8217;s a different way of doing it:<\/p>\n<figure id=\"attachment_366\" aria-describedby=\"caption-attachment-366\" style=\"width: 604px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.world-machine.com\/blog\/wp-content\/uploads\/2013\/12\/blog_newinterp1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-366 \" title=\"Interpolation Techniques\" alt=\"Interpolation Techniques\" src=\"http:\/\/www.world-machine.com\/blog\/wp-content\/uploads\/2013\/12\/blog_newinterp1-1024x335.jpg\" width=\"604\" height=\"197\" srcset=\"https:\/\/www.world-machine.com\/blog\/wp-content\/uploads\/2013\/12\/blog_newinterp1-1024x335.jpg 1024w, https:\/\/www.world-machine.com\/blog\/wp-content\/uploads\/2013\/12\/blog_newinterp1-300x98.jpg 300w, https:\/\/www.world-machine.com\/blog\/wp-content\/uploads\/2013\/12\/blog_newinterp1.jpg 1920w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><figcaption id=\"caption-attachment-366\" class=\"wp-caption-text\">(Click to expand)<\/figcaption><\/figure>\n<p>From left to right, we have:<\/p>\n<ol>\n<li>The 64&#215;64 Voronoi-colored source texture<\/li>\n<li>#1 resampled to full size using nearest neighbor. Ugh.<\/li>\n<li>#1 resampled using <em>&#8220;A New Technique<\/em>&#8220;!<\/li>\n<\/ol>\n<p>As you can see, we&#8217;re using smooth interpolation techniques to find the edge, but then snapping the output color (or height value..) to the nearest (in a least-squares sense) of the existing inputs. This provides a very neat <strong>&#8220;set-preserving&#8221; interpolation<\/strong> that is very useful for texture atlases.<\/p>\n<p><span style=\"line-height: 1.5;\">I haven&#8217;t decided yet if this interpolation technique will make an appearance in WM; it seems simple but useful, \u00a0so it has a strong chance.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi folks! Lots of things are in flight right now on the dev branch &#8212; time for a progress report. One of the things that goes hand-in-hand with the previous library and multiresolution support is the ability to create things in localspace. What does this mean? Localspace Localspace is a mode switch for your generators [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-364","post","type-post","status-publish","format-standard","hentry","category-world-machine-development-news"],"_links":{"self":[{"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/posts\/364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/comments?post=364"}],"version-history":[{"count":9,"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/posts\/364\/revisions"}],"predecessor-version":[{"id":375,"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/posts\/364\/revisions\/375"}],"wp:attachment":[{"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/media?parent=364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/categories?post=364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.world-machine.com\/blog\/wp-json\/wp\/v2\/tags?post=364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}