{"id":47,"date":"2009-06-24T00:33:00","date_gmt":"2009-06-23T22:33:00","guid":{"rendered":"http:\/\/www.tapper-ware.net\/blog\/?p=47"},"modified":"2010-07-11T12:05:11","modified_gmt":"2010-07-11T10:05:11","slug":"fake-voxels-with-filters","status":"publish","type":"post","link":"https:\/\/www.tapper-ware.net\/blog\/fake-voxels-with-filters\/","title":{"rendered":"Fake Voxels with filters"},"content":{"rendered":"<p><a href=\"http:\/\/www.tapper-ware.net\/stable\/web.filter.voxels\/index.xhtml\"><img decoding=\"async\" src=\"http:\/\/www.tapper-ware.net\/stable\/web.filter.voxels\/screen.png\"><\/a><\/p>\n<p>\nClick the image above to get to the demo<\/p>\n<div>\n<h3>Video<\/h3>\n<div>\n <video id=\"player\" controls=\"controls\" type=\"video\/ogg\" src=\"\/stable\/web.filter.voxels\/screen.ogg\"><br \/>\nApparently, your browser is unable to play open web video. Currently, compatible browsers include Firefox and Chrome.<br \/>\n<\/video>\n  <\/div>\n<p><a href=\"\/stable\/web.filter.voxels\/screen.ogg\">Download\/View in external player<\/a>\n <\/div>\n<\/p>\n<p>\n     Voxels are a way to display 3D data that dates back to the days before 3D accelerators became popular. Voxels (VOLume piXELS) don&#8217;t store models as triangles or polygons, but instead<br \/>\n     function much like a traditional bitmap, only these bitmaps have 3 dimensions, much like a video (where the third dimension is time). Today you find them mostly in medical scanners.\n    <\/p>\n<p>\n     This demo however doesn&#8217;t use real voxel data (we get to the rendering in a second, this is just about the data itself), but a variant where there is only a two dimensional bitmap and a third channel<br \/>\n     that contains the Z position of the pixel. The benefit is that there&#8217;s a lot less data, but there can only be one color for each pixel at all depths, which makes it well suited for terrains, but not so<br \/>\n     much for anything else. This is the way most games used voxels and it even has found its way into modern games as &quot;parallax mapping&quot; for textures, which is really just voxel rendering<br \/>\n     implemented as a shader.\n    <\/p>\n<p>\n     The rendering itself isn&#8217;t real voxel rendering either. That would require a 3D buffer that&#8217;s currently not available to filters. Instead, a series of perspective renderings is just put<br \/>\n     on top of each other, so these voxels don&#8217;t have any side surfaces, just the top. At steep angles this would pose a problem, but since we&#8217;re looking at it from (roughly) a 45 degree<br \/>\n     angle, it works well enough.\n    <\/p>\n<p>\n     Code-wise this is really just a simple evolution of the <a href=\"http:\/\/www.tapper-ware.net\/2009\/05\/perspective-texture-with-6-lines-of-svg.html\">MarioKart demo<\/a> and if you<br \/>\n     want to know how the perspective rendering is done you should look there.\n    <\/p>\n<p>\n     The only real difference is that this uses 5 different perspective renderings, stacked upon each other. Then there&#8217;s a bit of fairly simple brightness\/contrast adjustments: The bottom layers<br \/>\n     are made a little darker and the alpha channel gets higher contrast and a brightness adjustments depending on its height. The top ones are made to display only where the alpha<br \/>\n     channel is entirely opaque\/very bright, while the bottom ones pretty much ignore the alpha channel.\n    <\/p>\n<p>\n     Frankly, I didn&#8217;t expect this to work, primarily because the filter is very, very long. It needs to process around 30 operations to generate each frame (4 operations for each of the 5 layers + 5 for the texture + 3 for the texture transformation)<br \/>\n     , and that&#8217;s with a 768&#215;512 surface. It&#8217;s not very difficult to understand, but there&#8217;s simply a lot of processing needed and the speed at which Firefox renders this is nothing short of amazing.\n    <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Click the image above to get to the demo Video Apparently, your browser is unable to play open web video. Currently, compatible browsers include Firefox and Chrome. Download\/View in external player Voxels are a way to display 3D data that dates back to the days before 3D accelerators became popular. Voxels (VOLume piXELS) don&#8217;t store &hellip; <a href=\"https:\/\/www.tapper-ware.net\/blog\/fake-voxels-with-filters\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Fake Voxels with filters<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":16,"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":169,"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/posts\/47\/revisions\/169"}],"wp:attachment":[{"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tapper-ware.net\/blog\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}