{"id":70,"date":"2014-07-20T13:22:33","date_gmt":"2014-07-20T13:22:33","guid":{"rendered":"https:\/\/blogs.scummvm.org\/akz\/?p=70"},"modified":"2022-03-31T20:01:52","modified_gmt":"2022-03-31T20:01:52","slug":"correction-to-the-shadow-data-format","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/akz\/2014\/07\/20\/correction-to-the-shadow-data-format\/","title":{"rendered":"Correction to the shadow data format"},"content":{"rendered":"<p>After writing the previous blog post about shadows, I discovered that my shadow implementation caused a crash in the House of Sticks at Lucre island. The format of the shadow data in this particular set did not seem to match the format I described in the\u00a0previous post.<\/p>\n<p>It turned out that my interpretation of the shadow data was wrong. The shadow color is not part of the &#8216;sector reference&#8217; structure as I thought before. Instead it is part of the &#8216;shadow&#8217; structure. The color is stored after the array of &#8216;shadow reference&#8217; structures.<\/p>\n<figure id=\"attachment_71\" aria-describedby=\"caption-attachment-71\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-15-18-66.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-71\" src=\"https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-15-18-66-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-15-18-66-300x225.png 300w, https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-15-18-66.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-71\" class=\"wp-caption-text\">The House of Sticks after correcting the issue.<\/figcaption><\/figure>\n<p>It appears that in most cases a &#8216;shadow&#8217; structure only contains one sector reference. This is why my initial implementation seemed to work. However, the House of Sticks set file contains a &#8216;shadow&#8217; structure that references multiple sectors, and in this case my implementation tried read too much data, since it attempted to read a color for each sector reference.<\/p>\n<p>This discovery indicates that a single shadow will always have a uniform color. However, if multiple shadows are drawn on top of each other, this can give the appearance of a single shadow with multiple colors. This happens for example in the Place of Prostheses.<\/p>\n<figure id=\"attachment_72\" aria-describedby=\"caption-attachment-72\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-16-14-56.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-72\" src=\"https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-16-14-56-300x225.png\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-16-14-56-300x225.png 300w, https:\/\/blogs.scummvm.org\/akz\/wp-content\/uploads\/sites\/12\/2022\/03\/residualvm-2014-07-20-23-16-14-56.png 640w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-72\" class=\"wp-caption-text\">A combination of two shadows with different colors can be seen in the Place of Prostheses.<\/figcaption><\/figure>\n<p>Since the shadow color is uniform, rendering the shadows is simplified.\u00a0<a href=\"https:\/\/github.com\/residualvm\/residualvm\/pull\/956\">PR #956<\/a>\u00a0now contains much less changes to the renderer code, as the EMI shadow rendering is now very similar to that of Grim.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After writing the previous blog post about shadows, I discovered that my shadow implementation caused a crash in the House of Sticks at Lucre island. The format of the shadow data in this particular set did not seem to match the format I described in the\u00a0previous post. It turned out that my interpretation of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/posts\/70\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/akz\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}