{"id":161,"date":"2024-03-31T00:51:46","date_gmt":"2024-03-31T00:51:46","guid":{"rendered":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/?p=161"},"modified":"2024-03-31T00:51:46","modified_gmt":"2024-03-31T00:51:46","slug":"harshuls-status-report-for-3-30","status":"publish","type":"post","link":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/2024\/03\/31\/harshuls-status-report-for-3-30\/","title":{"rendered":"Harshul&#8217;s Status Report for 3\/30"},"content":{"rendered":"<p>This week I mainly worked on the core feature of being able to draw on the floor plane using the position of our phone in the environment as a reference point. SceneKit allows projecting elements from the 2D coordinate frame of the &#8216;view&#8217;, in this case, the screen, into a 3D world plane, using the &#8216;unprojectOntoPlane&#8217; method My first approach was to take the camera coordinates, convert them into 2d screen coordinates, and then perform the projection. However, there seemed to be a disconnect between the view port and the camera&#8217;s coordinates so I pivoted to using the center of the screen as the base point.\u00a0 In order to project onto the plane and also ensure specifically that I&#8217;m only projecting onto the desired floor plane, I updated my tap gesture to set variables of projectedPlane and a flag of selectedPlane to only enable the projection logic once a plane was selected and allowed the projection renderer to access the plane object. I then performed a hittest which sends out a ray from that 2d point into the 3d world and returns AR objects that it passes through.\u00a0 In order to make planes uniquely identifiable and comparable I added a uuid field to the class which I then cased on to ensure I&#8217;m only drawing on the correct plane.\u00a0 The result of a HitTest returns the world coordinates at which it intersected the plane which I then passed into a function to draw.<\/p>\n<figure id=\"attachment_167\" aria-describedby=\"caption-attachment-167\" style=\"width: 996px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-167 size-full\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-7.39.47-PM.png\" alt=\"\" width=\"996\" height=\"2104\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-7.39.47-PM.png 996w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-7.39.47-PM-142x300.png 142w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-7.39.47-PM-768x1622.png 768w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-7.39.47-PM-485x1024.png 485w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption id=\"caption-attachment-167\" class=\"wp-caption-text\">image highlighting the drawn points all being coplanar with the floorplane<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/18Ri3PR0NEJlr86E3ocJxy51cIJQTLgQ5\/view?usp=sharing\">Video of Drawing on plane with circles<\/a><\/p>\n<p><a href=\"https:\/\/drive.google.com\/file\/d\/1YdRyhHlcTWI_ebke3x9FX7oIjQAeth1p\/view?usp=sharing\">Video of Drawing on plane with connected cylindrical segments<\/a><\/p>\n<p>Functionally this worked, but there was a notable performance drop. I attempted to introduce a time interval to reduce the frequency of the hittests and draw spheres, which are more shader optimized than cylinders, but there is absolutely more work to be done.<\/p>\n<p>I then profiled the operation of the app and while for some reason debug symbols did not export. This outlined that there was a delay in wait for drawable.<\/p>\n<figure id=\"attachment_168\" aria-describedby=\"caption-attachment-168\" style=\"width: 2914px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-168 size-full\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-8.16.48-PM.png\" alt=\"\" width=\"2914\" height=\"1776\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-8.16.48-PM.png 2914w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-8.16.48-PM-300x183.png 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-8.16.48-PM-768x468.png 768w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-content\/uploads\/sites\/285\/2024\/03\/Screenshot-2024-03-30-at-8.16.48-PM-1024x624.png 1024w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption id=\"caption-attachment-168\" class=\"wp-caption-text\">image of xcode instruments profiling the AR app<\/figcaption><\/figure>\n<p>Researching this led me to find out that drawing repeated unique shapes and adding them is not as <a href=\"https:\/\/stackoverflow.com\/questions\/57012473\/scenekit-ar-game-fps-getting-low-and-the-device-getting-hot-with-use\/57016925#57016925\">performant<\/a> as stitching them together. Additionally, performing physics\/mathematics calculations in the renderer (non GPU ones, at least) can cause this performance impact. In discussing these findings with Nathalie, we identified 2 candidate approaches forward to cover our bases on the performance bottleneck that we could work on in parallel. The first approach consists of 2 key changes. Firstly, I&#8217;m going to try to move the hittest outside of the renderer. Secondly,\u00a0 Natalie outlined that the child nodes in our initial plane detection did not have this impact on performance so I plan on performing a coordinate transform and drawing the shapes as child nodes to see if that makes load on the renderer better and experiment with <a href=\"https:\/\/developer.apple.com\/documentation\/scenekit\/scnnode\/1407960-flattenedclone\">flattened clone<\/a> to coalesce these shapes.<\/p>\n<p>When looking up native parametric line implementations in Xcode I could only find bezier curves in the UI library. We managed to find a package SceneLine that implements parametric lines in sceneKit which is what Nathalie is going to install and experiment with. to see if we unlock a performance speedup by only having one node that we update instead of a new node for every shape.<\/p>\n<p>Next steps involve addressing this performance gap in time for our demo and syncing with Nathalie on our optimization findings. Additionally\u00a0 integrating Nathalie&#8217;s freeze frame feature as well as Bluetooth messages is our next highest priority post-demo as Professor Kim outlined that integration would take more time than we anticipate. Eventually we will need to have the line be invisible, but place planes along its coordinates and orient them the correct way which should be unlocked once we have the ability to draw in a performant way.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I mainly worked on the core feature of being able to draw on the floor plane using the position of our phone in the environment as a reference point. SceneKit allows projecting elements from the 2D coordinate frame of the &#8216;view&#8217;, in this case, the screen, into a 3D world plane, using the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/2024\/03\/31\/harshuls-status-report-for-3-30\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Harshul&#8217;s Status Report for 3\/30&#8221;<\/span><\/a><\/p>\n","protected":false},"author":852,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/posts\/161"}],"collection":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/users\/852"}],"replies":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":1,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":169,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/posts\/161\/revisions\/169"}],"wp:attachment":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s24-teamc1\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}