{"id":1935,"date":"2015-01-21T21:23:00","date_gmt":"2015-01-21T21:23:00","guid":{"rendered":"http:\/\/www.spellcasterstudios.com\/?p=1935"},"modified":"2015-01-19T16:39:43","modified_gmt":"2015-01-19T16:39:43","slug":"so-much-lost-time","status":"publish","type":"post","link":"https:\/\/www.spellcasterstudios.com\/?p=1935","title":{"rendered":"So much lost time&hellip;"},"content":{"rendered":"<p align=\"justify\">So today I started implementing SSAO, and it was demoralizing\u2026 <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-sadsmile\" style=\"border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none\" alt=\"Sad smile\" src=\"http:\/\/www.spellcasterstudios.com\/wp-content\/uploads\/2015\/01\/wlEmoticon-sadsmile.png\" \/><\/p>\n<p align=\"justify\">I was looking into my old SSAO shaders, and I decided to implement the simple version before moving towards more complex versions, and I hit the first hurdle\u2026<\/p>\n<p align=\"justify\">When I started work on my deferred renderer (which was going to be used by the SSAO stuff), I had to compute the world position of the pixel of the rendered image, based only on the depth at that point. But at the time, I wasn\u2019t getting the math right, and since I had a self-imposed deadline, I cheated and stored the world position into one my render targets, to be changed at a later time\u2026 Well, that later time never came, which means that the reconstruction of the position was never done\u2026 Since I don\u2019t want to make the same mistake again, I started working on that for this shader\u2026 and again, I couldn\u2019t get the math right!<\/p>\n<p align=\"justify\">After a long time looking at the math and the parameters, etc, I finally found out what the problem was\u2026 I was computing the position correctly, yes, but <u>relative to the camera<\/u>, not the actual world position. So, basically I was interpreting the data wrong\u2026<\/p>\n<p align=\"justify\">After this revelation, I could change the shader to display normals if the distance in X is lower than 10, and the depth if it\u2019s higher:<\/p>\n<p align=\"justify\"><a href=\"http:\/\/www.spellcasterstudios.com\/wp-content\/uploads\/2015\/01\/screen389.jpg\" class=\"thickbox\"><img loading=\"lazy\" decoding=\"async\" title=\"screen389\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"screen389\" src=\"http:\/\/www.spellcasterstudios.com\/wp-content\/uploads\/2015\/01\/screen389_thumb.jpg\" width=\"830\" height=\"482\" \/><\/a><\/p>\n<p>I think view-space position is good enough for AO, since it\u2019s all relative for its sake, but then I still have the problem of the normal\u2026 The normal is a world-space normal, so maybe I have to change it so it\u2019s a view-space normal instead to be able to use it this way, which would require me to do some math on the pixel shader to account for that\u2026 Need to check if I actually need it in view-space\u2026 I can find good reasons for both, so I really need to go into the math\u2026 <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-disappointedsmile\" style=\"border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none\" alt=\"Disappointed smile\" src=\"http:\/\/www.spellcasterstudios.com\/wp-content\/uploads\/2015\/01\/wlEmoticon-disappointedsmile.png\" \/><\/p>\n<p><em>Now listening to \u201cThe Metal Opera, Part I\u201d by \u201cAvantasia\u201d<\/em><\/p>\n<p><em>Link of the Day: All gamers have a backlog\u2026 Mine is mostly on Steam, and thanks to this nifty site, I can see how much time it would take me to play through all my unfinished games on Steam: About 105 days\u2026 Check yours out at <a title=\"http:\/\/steamleft.com\/\" href=\"http:\/\/steamleft.com\/\">http:\/\/steamleft.com\/<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So today I started implementing SSAO, and it was demoralizing\u2026 I was looking into my old SSAO shaders, and I decided to implement the simple version before moving towards more complex versions, and I hit the first hurdle\u2026 When I started work on my deferred renderer (which was going to be used by the SSAO [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,147,8],"tags":[254,255,253],"class_list":["post-1935","post","type-post","status-publish","format-standard","hentry","category-development","category-chrome-hunter","category-technology","tag-ambient","tag-occlusion","tag-ssao"],"_links":{"self":[{"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=\/wp\/v2\/posts\/1935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1935"}],"version-history":[{"count":1,"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=\/wp\/v2\/posts\/1935\/revisions"}],"predecessor-version":[{"id":1936,"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=\/wp\/v2\/posts\/1935\/revisions\/1936"}],"wp:attachment":[{"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spellcasterstudios.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}