{"id":236,"date":"2014-03-14T22:48:55","date_gmt":"2014-03-14T22:48:55","guid":{"rendered":"http:\/\/blogs.discovery.wisc.edu\/projects\/?p=236"},"modified":"2014-03-14T22:48:55","modified_gmt":"2014-03-14T22:48:55","slug":"more-mirror-stuff","status":"publish","type":"post","link":"https:\/\/blogs.discovery.wisc.edu\/projects\/2014\/03\/14\/more-mirror-stuff\/","title":{"rendered":"More mirror stuff"},"content":{"rendered":"<p>Implemented mirrors with reflections about arbitrary planes at arbitrary distances from the origin. The math runs something like this:<\/p>\n<p>Let R be the Reflection matrix (see Essential Maths for Games, pg152), then the combined matrix <strong>R<\/strong>&#8216; is: <strong>R<\/strong>&#8216; = <strong>T<\/strong> x <strong>R<\/strong> x inv(<strong>T<\/strong>) with <strong>T<\/strong> being the translation matrix of the mirror.<\/p>\n<p>The complete matrix pipeline for the mirrored content is then: <strong>P<\/strong> x <strong>V<\/strong> x <strong>R<\/strong>&#8216; x <strong>M<\/strong>, with <strong>P<\/strong>=Projection matrix, <strong>V<\/strong>=View matrix, <strong>R<\/strong>&#8216; as above and <strong>M<\/strong> = Model matrix. It&#8217;s interesting that the reflection matrix sits between the model and the view matrix and it makes local transformation of objects easy: we just have to modify the Modelview matrix and can chain the object&#8217;s transforms regularly.<\/p>\n<p>In the current (test app) it looks like this:<\/p>\n<div id=\"attachment_237\" style=\"width: 689px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/mirrors_no_avatar.png\"><img aria-describedby=\"caption-attachment-237\" loading=\"lazy\" class=\"size-full wp-image-237\" alt=\"Virtual mirrors\" src=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/mirrors_no_avatar.png\" width=\"679\" height=\"665\" srcset=\"https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/mirrors_no_avatar.png 679w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/mirrors_no_avatar-300x293.png 300w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/mirrors_no_avatar-306x300.png 306w\" sizes=\"(max-width: 679px) 100vw, 679px\" \/><\/a><p id=\"caption-attachment-237\" class=\"wp-caption-text\">Virtual mirrors<\/p><\/div>\n<p>The big mirror is artificially defined and reflects the ground grid perfectly. The other mirrors are loaded from the detected mirrors in Ross&#8217; house. As their angle is slightly offset, their reflection appears offset as well.<\/p>\n<p>Empty mirrors are strange, so I implemented a very simple billboarded Avatar:<\/p>\n<div id=\"attachment_238\" style=\"width: 708px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/avatar-in-mirrors.png\"><img aria-describedby=\"caption-attachment-238\" loading=\"lazy\" class=\"size-full wp-image-238\" alt=\"Avatar in mirror\" src=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/avatar-in-mirrors.png\" width=\"698\" height=\"684\" srcset=\"https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/avatar-in-mirrors.png 698w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/avatar-in-mirrors-300x293.png 300w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/03\/avatar-in-mirrors-306x300.png 306w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/a><p id=\"caption-attachment-238\" class=\"wp-caption-text\">Avatar in mirror<\/p><\/div>\n<p>The matrix chain is similar to above, except that the resulting upper-left rotation-scale matrix is set to identity before multiplying with the projection matrix.<\/p>\n<p>I also tried recursive mirrors. This should be not very expensive with this method, as each reflection is just a texture access. However, there was a strange rendering and transformation issue so I dropped it for now.<\/p>\n<p>The VizHomeOOC rendering core has been modified quite a bit and now supports distinct rendering passes. Next week should see the merging of mirrors and the current rendering core. At the same time, I am looking into taking live video-feed from a kinect and streaming it onto the billboard as some kind of augmented virtuality system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Implemented mirrors with reflections about arbitrary planes at arbitrary distances from the origin. The math runs something like this: Let R be the Reflection matrix (see Essential Maths for Games, pg152), then the combined matrix R&#8216; is: R&#8216; = T &hellip; <a href=\"https:\/\/blogs.discovery.wisc.edu\/projects\/2014\/03\/14\/more-mirror-stuff\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/236"}],"collection":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/comments?post=236"}],"version-history":[{"count":1,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/236\/revisions"}],"predecessor-version":[{"id":239,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/236\/revisions\/239"}],"wp:attachment":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/media?parent=236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/categories?post=236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/tags?post=236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}