{"id":511,"date":"2014-09-26T21:52:03","date_gmt":"2014-09-26T21:52:03","guid":{"rendered":"http:\/\/blogs.discovery.wisc.edu\/projects\/?p=511"},"modified":"2014-10-06T16:27:54","modified_gmt":"2014-10-06T16:27:54","slug":"modyfing-the-projection-fov","status":"publish","type":"post","link":"https:\/\/blogs.discovery.wisc.edu\/projects\/2014\/09\/26\/modyfing-the-projection-fov\/","title":{"rendered":"Rift: Modifying the Projection \/ FOV part 1"},"content":{"rendered":"<p>I&#8217;ve attempted to recreate the FOV\u00a0used by the Rift, by calling CalculateFovFromEyePosition using defaults found in\u00a0OVR_Stereo.cpp (mostly in\u00a0OVR_Stereo.cpp::CreateDebugHMDInfo):<\/p>\n<pre> info.ProductName = \"Oculus Rift DK2\"; \r\n info.ResolutionInPixels = Sizei ( 1920, 1080 );\r\n info.ScreenSizeInMeters = Sizef ( 0.12576f, 0.07074f );\r\n info.ScreenGapSizeInMeters = 0.0f;\r\n info.CenterFromTopInMeters = info.ScreenSizeInMeters.h * 0.5f;\r\n info.LensSeparationInMeters = 0.0635f;\r\n info.Shutter.Type = HmdShutter_RollingRightToLeft;\r\n info.Shutter.VsyncToNextVsync = ( 1.0f \/ 76.0f );\r\n info.Shutter.VsyncToFirstScanline = 0.0000273f;\r\n info.Shutter.FirstScanlineToLastScanline = 0.0131033f;\r\n info.Shutter.PixelSettleTime = 0.0f;\r\n info.Shutter.PixelPersistence = 0.18f * info.Shutter.VsyncToNextVsync;\r\n\r\n\r\n case EyeCup_DKHD2A:\r\n renderInfo.LensDiameterInMeters = 0.035f;\r\n renderInfo.LensSurfaceToMidplateInMeters = 0.02357f;\r\n \/\/ Not strictly lens-specific, but still wise to set a reasonable default for relief.\r\n renderInfo.EyeLeft.ReliefInMeters = 0.010f; \r\n renderInfo.EyeRight.ReliefInMeters = 0.010f; \r\n\r\n renderInfo.EyeLeft.NoseToPupilInMeters = 0.032f; \r\n\r\nconst float OVR_DEFAULT_EXTRA_EYE_ROTATION = 30.0f * MATH_FLOAT_DEGREETORADFACTOR;\r\n\r\n<\/pre>\n<p>I expected\u00a0to reproduce the default FOV, which yields a scene like so:<a href=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-513\" src=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/not-calling-the-function.jpg\" alt=\"not calling the function\" width=\"1279\" height=\"800\" srcset=\"https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/not-calling-the-function.jpg 1279w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/not-calling-the-function-300x187.jpg 300w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/not-calling-the-function-1024x640.jpg 1024w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/not-calling-the-function-479x300.jpg 479w\" sizes=\"(max-width: 1279px) 100vw, 1279px\" \/><\/a><\/p>\n<p>What I see instead is this:<a href=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-512\" src=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function.jpg\" alt=\"calling the function\" width=\"1280\" height=\"801\" srcset=\"https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function.jpg 1280w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function-300x187.jpg 300w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function-1024x640.jpg 1024w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/calling-the-function-479x300.jpg 479w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>It needs some work.<\/p>\n<p>That work may be probing the values via debugger, as the default FOV is built; or, I could work through the code in that function and decide how things would go awry as displayed above. \u00a0Or arguing with include files some more, so I can probe values via code. \u00a0(Or, finding some bug in my code that&#8217;s doing something dumb.)<\/p>\n<p>But soon that work will have to become bypassing the Oculus SDK as much as possible; it&#8217;d be nice to standardize to their system, but it&#8217;d be even nicer to actually get this working.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve attempted to recreate the FOV\u00a0used by the Rift, by calling CalculateFovFromEyePosition using defaults found in\u00a0OVR_Stereo.cpp (mostly in\u00a0OVR_Stereo.cpp::CreateDebugHMDInfo): info.ProductName = &#8220;Oculus Rift DK2&#8221;; info.ResolutionInPixels = Sizei ( 1920, 1080 ); info.ScreenSizeInMeters = Sizef ( 0.12576f, 0.07074f ); info.ScreenGapSizeInMeters = 0.0f; &hellip; <a href=\"https:\/\/blogs.discovery.wisc.edu\/projects\/2014\/09\/26\/modyfing-the-projection-fov\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":89,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,3],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/511"}],"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\/89"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/comments?post=511"}],"version-history":[{"count":5,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/511\/revisions\/524"}],"wp:attachment":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/media?parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/categories?post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/tags?post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}