{"id":1317,"date":"2011-09-07T15:22:16","date_gmt":"2011-09-07T22:22:16","guid":{"rendered":"http:\/\/the-witness.net\/news\/?p=1317"},"modified":"2011-09-07T15:22:16","modified_gmt":"2011-09-07T22:22:16","slug":"a-pleasant-lightmapping-update","status":"publish","type":"post","link":"http:\/\/the-witness.net\/news\/2011\/09\/a-pleasant-lightmapping-update\/","title":{"rendered":"A pleasant lightmapping update"},"content":{"rendered":"<p>It's been a little bit since the last post.  We have been busy doing a lot of good things with the game.  Here's one of them: Ignacio just got back from vacation and implemented a simple lightmap encoding idea that improves the color resolution of our lightmaps, removing banding, like so:<\/p>\n<p><a href=\"http:\/\/the-witness.net\/news\/wp-content\/uploads\/2011\/09\/before_after.jpg\"><img class=\"aligncenter size-medium wp-image-1318\" title=\"before_after\" src=\"http:\/\/the-witness.net\/news\/wp-content\/uploads\/2011\/09\/before_after-300x168.jpg\" alt=\"\" width=\"300\" height=\"168\" \/><\/a><\/p>\n<p>The difference is not too pronounced in this scene, but with smoother-colored textures it becomes a lot more obvious (and I do want to use more smoother-colored textures, art-direction-wise!)<\/p>\n<p>The situation is, the lightmaps are HDR (for some definition of \"high\"), so we needed a way to encode those values reasonably into a bitmap.  We were using RGBM where M is just an overall brightness factor; you read RGB from the texture then multiply by M to get the output color.  We used to just encode this naively, but the problem is, when M is less than 1 then it actually kills precision in your RGB, so the solution is, well, don't ever let M go below 1; just clamp it.  This is not rocket science and in fact is the kind of thing that is a little funny, as one starts wondering why we didn't think of that a long time ago, but hey, that's how it is sometimes.  The results made me happy, though, so I am posting them.<\/p>\n<p>The improved image quality may enable us to have higher dynamic range throughout the game (this is probably something we will evaluate later on), which would be very nice!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a little bit since the last post. We have been busy doing a lot of good things with the game. Here&#8217;s one of them: Ignacio just got back from vacation and implemented a simple lightmap encoding idea that improves the color resolution of our lightmaps, removing banding, like \u2026<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"http:\/\/the-witness.net\/news\/2011\/09\/a-pleasant-lightmapping-update\/\">Continue reading<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts\/1317"}],"collection":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/comments?post=1317"}],"version-history":[{"count":1,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts\/1317\/revisions"}],"predecessor-version":[{"id":1319,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts\/1317\/revisions\/1319"}],"wp:attachment":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/media?parent=1317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/categories?post=1317"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/tags?post=1317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}