<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shivang Chopra on Medium]]></title>
        <description><![CDATA[Stories by Shivang Chopra on Medium]]></description>
        <link>https://medium.com/@shivangchopra11?source=rss-9cebef7b1383------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cuLO-E4ZZOvhucpHS974uA.png</url>
            <title>Stories by Shivang Chopra on Medium</title>
            <link>https://medium.com/@shivangchopra11?source=rss-9cebef7b1383------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 10:36:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shivangchopra11/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using ARCore and Unity3D to Draw Lines in Augmented Reality]]></title>
            <link>https://heartbeat.comet.ml/the-subtle-art-of-making-lines-in-augmented-reality-using-arcore-and-unity3d-e26718dffa03?source=rss-9cebef7b1383------2</link>
            <guid isPermaLink="false">https://medium.com/p/e26718dffa03</guid>
            <category><![CDATA[augmented-reality]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[heartbeat]]></category>
            <category><![CDATA[arcore]]></category>
            <dc:creator><![CDATA[Shivang Chopra]]></dc:creator>
            <pubDate>Mon, 10 Sep 2018 14:04:41 GMT</pubDate>
            <atom:updated>2021-09-23T17:49:36.074Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vE9cXwzTKx7Ryqrkj3-s9w.jpeg" /></figure><p>A few months back, as I was browsing through some fascinating projects on <a href="https://heartbeat.comet.ml/building-a-gesture-based-interface-ios-app-with-core-ml-and-arkit-910b5c94da80">Augmented Reality</a>, I came across an extremely intriguing project, which was one of the most artistic applications of AR I could think of. The final effects of the app looked something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whyFFpPg_nkLuJxMPX-HPA.jpeg" /></figure><p>Cool isn’t it!? Go ahead and try out the awesome app for yourself.</p><p><a href="https://play.google.com/store/apps/details?id=com.arexperiments.justaline">Just a Line - Draw Anywhere, with AR - Apps on Google Play</a></p><p>After having thoroughly played around with the app, I decided to try and replicate the project to learn something new and have some fun. But I didn’t realize the extent of theoretical understanding I needed before even attempting the project.</p><p>Here are some of the most important concepts I had to learn and understand while attempting this project.</p><h3>Coordinate Spaces in 3D Applications</h3><p>In any 3D application, there are four main coordinate spaces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*52zn8xAB6ttQHPwBHHyNSQ.png" /><figcaption><em>Sphere transformed from model space to world space</em></figcaption></figure><ol><li><strong>Model Space</strong>: The model space is the space local to the objects. It describes the relative position of the points on the body of the object. These relative locations don’t change with a change in the location or orientation of the object in the world space.</li><li><strong>World Space</strong>: The world space describes the relative position of all the objects in your application. This includes the location as well as the orientation of all the objects relative to each other. All the physics calculations are performed on the world space coordinates.</li><li><strong>View Space</strong>: The view space is also known as c<em>amera space</em>. This is the coordinate system <em>relative to the camera</em>. In this space, the camera is at the position (0, 0, 0), and the direction of the camera is the z-axis of the coordinate system. We don’t need to render anything with a negative Z value, since it would be behind the camera.</li><li><strong>Screen Space</strong>: The screen space is the (X, Y) coordinate system of whatever screen you’re displaying your graphics on. In our case, this will represent the coordinated of the screen of the phone and all the user touches will be mapped onto this space.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*bWn7ke5tXIQl3z2EroOR1A.png" /><figcaption><em>On the Left two teapots and a camera in World Space; On the right everything is transformed into View Space</em></figcaption></figure><p>Now, since there are multiple coordinate spaces, we need some way to transform coordinates from one space to another.</p><p>In computer graphics, the transformation from one space to another is done using a matrix. So when rendering the full scene, the following matrices are stored:</p><ul><li>Matrices corresponding to each object in the world space. These matrices represent the transformations of the local coordinates of the objects in the model space to the respective coordinates in the world space.</li><li>One overall matrix for the view. This corresponds to the transformation from world space to view space. Note that you only need one of these, since it’s assumed that everything will be in world space before being transformed into view space.</li><li>One overall matrix known as the <em>Projection Matrix</em> is saved in order to transform objects from view space into a space that’s ready for mapping into screen space.</li></ul><p>Now that we understand the basics of coordinate spaces, the next step is to understand the principles involved in treating 2D lines as 3D.</p><h3>Visualizing 2 Dimensional lines in 3 Dimensions</h3><p>By itself, drawing a line is one of the simplest things you can do. Ironically, when we try to draw 2D lines in 3D, we encounter a number of problems:</p><ul><li>The lines have a 2D look, which means the width of lines does not depend on the distance from the camera view. Think of a simple 2D application and how the lines have the same thickness regardless of their location or viewpoint.</li><li>The rendered lines are broken and not of customary thickness.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*jwYw1Ru5N9OI8M9RZkbD_g.png" /></figure><p>One of the ways to solve this problem is to represent each line segment as a set of triangles. Adjacent triangles (or quads) are drawn without any gaps between them. In this case, we have to deal with two problems:</p><ol><li>In 3D, a set of triangles looks like a ribbon, i.e., it may look like a solid line under certain views, but the appearance of a line is lost when the viewpoint is changed.</li><li>The line width depends on the camera view.</li></ol><p>To address problem 1, we have to make sure the geometry is always facing the camera, i.e., recompute the geometries every time the viewpoint is changed. For problem 2, the solution is similar — re-adjust the ribbon width with the change of viewport.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*YbJTHvRWXdPAZ9FHR0frsw.png" /></figure><p>A very effective way to achieve the desired effect is to use GLSL shaders. The discussion on shaders is a supplementary part and is not used explicitly in the project, so I’ve added this as an <a href="#9465">Appendix</a> at the end of this tutorial.</p><h3>Line Smoothing</h3><p>Another thing to remember is that after rendering the lines in this way, we need to smooth the line edges to improve the experience. Next, I’ll try to give a brief overview of how the smoothing process is being carried out.</p><h4>inTangent and outTangent</h4><p>The rendering of lines in Unity is done in form of multiple Keyframes. The incoming tangent (or inTangent) affects the slope of the curve from the previous key to this key. The outgoing tangent (or outTangent) affects the slope of the curve from this key to the next key. The incoming tangent matches the incoming slope of the curve and the outgoing tangent matches the outgoing slope of the curve.</p><h4>Line Smoothing using SmoothTangent</h4><p>In our project, we are using a function AnimationCurve.SmoothTangent to smooth out the lines. What this function basically does is that it makes the inTangent and outTangent line up.The first parameter in the function is a weight. Using a weight of 0 will make the final smooth slope an average of what the inTangent and outTangent were before.</p><p>So this was the basic theory that was being implemented on the backend of this project.</p><p>Here, I present a step-by-step tutorial for making a simple and easy implementation of the above theory in Unity3D using a custom Unity Package named CurvedLineRenderer.</p><h3>Making the app in Unity3D</h3><p>In this section, I’ll be explaining the steps involved in making this project in Unity.</p><p>Step 1: Open Unity3D and create a new project named ARDraw101. Make sure to select 3D in the template section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*ybvy3KJ57MZFL5THyaPY5Q.png" /></figure><p>Step 2: After the project is created, head over to Unity-&gt;Unity Preferences-&gt;External Tools. Add the path of Android SDK and Android JDK taken from Android Studio into the respective fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*KBlgOzEtGhVYDlHrjCi6FQ.png" /></figure><p>Step 3: Go to File-&gt;Build Setting and select Android in the Platforms list. Then click Switch Platform. The Unity logo should appear in front of Android in the platforms list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*Saq362sCXvLQlMce7_hq7g.png" /></figure><p>Step 4: Download the ARCore SDK for Unity from the following link:</p><p><a href="https://github.com/google-ar/arcore-unity-sdk/releases">google-ar/arcore-unity-sdk</a></p><p>Step 5: Right click in the Assets window-&gt;Import Package-&gt;Custom Package and select the downloaded ARCore SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*nPQwK-Y-lArpxVrenmwR1A.png" /></figure><p>Step 6: Click on All and then Import in the dialog box that appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*LQ0V0Zhs8ra4WpL3vZ6NEQ.png" /></figure><p>Step 7: The Project window should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*7xyg61X3sjgfMyljAZvOhA.png" /></figure><p>Step 8: Go to File-&gt; Build Settings and click on Player Settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*2ARVqeZ0H2xgRbCHKaxEiA.png" /></figure><p>Step 9: The following window will appear in the Inspector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*vSN4MijMzgwF1xWnFa6cjg.png" /></figure><p>Step 10: In the Inspector window, configure the following settings except for Target API level, which should be set to Automatic (highest installed):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*SxMJjIzdPQevNzOZABmLuw.png" /></figure><p>Step 11: Download and import the following package in Unity3D (similar to steps 5 and 6).</p><p><a href="https://drive.google.com/file/d/1WTWYmAIhu0kFuDk3i13hwKfHH7nIit1R/view?usp=sharing">CurvedLine-2017.1.2.unitypackage</a></p><p>Step 12: The Project window should now look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*L_lbcqZvOMddmDD_4c9TyA.png" /></figure><p>Step 13: Go to Assets-&gt;GoogleARCore-&gt;Examples-&gt;Scenes and open HelloAR scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*4eM5gS0qltH2H8moXkUCUQ.png" /></figure><p>Step 14: Now, for the following gameObjects: Example Controller, Plane Generator, Point Cloud, and Canvas, click on each one of them, and in the Inspector window, disable each one of them by unchecking the check box next to the top cube as shown below. This is done because these are the default components for ground plane detection and raycasting in ARCore, which are not required for this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*ndwJWyZ1H78dglUQOWoq3w.png" /></figure><p>Step 15: Create an empty object in Hierarchy and name it Renderer. The Hierarchy window should now look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*ksqadwyuyoPe5_0P_bMjvw.png" /></figure><p>Step 16: Add the CurvedLineRenderer component to the Renderer GameObject. In the LineRenderer component, set the value of Positions-&gt;Size to 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*c4LdVVhigop2f27NOvSGcg.png" /></figure><p>Step 17: In the Assets folder, create three new folders named Materials, Prefabs, and Scripts. The Project window should now look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*bhyAV6N5CT-JppLLRGEZag.png" /></figure><p>Step 18: Open the Materials folder and create a new material named TrailMaterial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*xvCFvN9OPjl6cHJANeZCRA.png" /></figure><p>Step 19: Drag and drop this material into Renderer-&gt;LineRenderer-&gt;Material.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*Tk_-w0FabTlWgrvxUlCHyg.png" /></figure><p>Step 20: Create a new Sphere in Hierarchy and rescale it to (0.1, 0.1, 0.1) in the Inspector window. Also add the Curved Line Point component to it and disable its MeshRenderer. The basic thing we’re doing here is instantiating new spheres at every touch and then rendering a line between consecutive spheres. When we disable the MeshRenderer, we see only the lines and not the spheres.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*jOFsjwCqOh29ifKpuU0HwA.png" /></figure><p>Step 21: Drag and drop this sphere in Prefabs folder to make it a Prefab and then delete the sphere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*Syc3uBXPlwtQ7q50Fo7IRA.png" /></figure><p>Step 22: Go to the Scripts folder and create a new C# script named TrailScript. Open the script and paste the following code in it. Then add this script to the Renderer GameObject. Essentially, what this script is doing is instantiating a sphere at every touch and then rendering a line between all the spheres. Also, as the MeshRenderer of the sphere prefab is disabled, they are invisible in the final project. Then the spheres are set as children of FirstPersonCamera to anchor them in place.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4de003f26dd2407be4aaab2ee6c07d81/href">https://medium.com/media/4de003f26dd2407be4aaab2ee6c07d81/href</a></iframe><p>Step 23: In the TrailScript component of Renderer GameObject, drag and drop Prefabs-&gt;Sphere to Game Object and ARCoreDevice-&gt;First Person Camera to Camera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*hFZ3WUMoWoTgbeO1UXQ6vA.png" /></figure><p>Step 24: Go to File-&gt;Build Settings and click on add open scenes and uncheck Scenes/SampleScene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*DuE8HOlSU1L9Hy0GCHTGPA.png" /></figure><p>Step 25: Finally, build the app by pressing Ctrl.(Cmd.) + B and test it out. The final result should be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*jtiHe3qmjFKOF9OMP12iBA.gif" /></figure><p>For the repository of the above project, visit the following link:</p><p><a href="https://github.com/shivangchopra11/ARDrawUnity">shivangchopra11/ARDrawUnity</a></p><p>That’s it! I hope you liked this post. If you did, don’t forget to 👏 and <em>leave a comment </em>💬<em> below.</em></p><p><strong>Next Up</strong>: Adding multiple lines in the same project and adding functionality for changing color and thickness of the rendered lines.</p><p><strong>Discuss this post on</strong><a href="https://news.ycombinator.com/item?id=17951966"><strong> Hacker News</strong></a><strong> and </strong><a href="https://www.reddit.com/r/androiddev/comments/9eot5x/drawing_lines_in_augmented_reality_using_arcore/"><strong>Reddit</strong></a></p><p><strong>Want to have more fun building such apps, we at Coding Blocks are dedicated to teach cutting-edge technologies in simple and exciting ways. Check out our courses at</strong><a href="https://codingblocks.com/"><strong> https://codingblocks.com/</strong></a></p><h3>Appendix</h3><h4>Shaders</h4><p>The various types of shaders and their respective purposes are discussed below.</p><h4>Vertex shader</h4><p>The vertex shader is what helps transform 3D world coordinates into screen coordinates. Simply speaking, this is where we deal with making sure lines always face the camera. In order to implement a vertex shader, we have to use a model-view-projection (MVP) matrix, which is the matrix updated on every view change.</p><p>The calculation of each vertex is done like this:</p><p>position = ModelViewProjectionMatrix * Vertex;</p><h4>Geometry shader</h4><p>The geometry shader’s main goal is to take each line segment and turn it into a strip of triangles that have enough filling on each side so that the consecutive line segment is connected without a gap. The position of each vertex of the triangle is calculated in relation to the viewport of the widget that displays the whole scene. This allows the lines to have a constant thickness despite their location in the 3D world.</p><h4>Fragment shader</h4><p>The fragment shader is a simple pass-through shader. It takes the incoming color and assigns it to each fragment.</p><p>After the shaders have been applied, there is still work that needs to be done on the lines in order to smoothen them and improve their texture.</p><p><em>Editor’s Note:</em><a href="http://heartbeat.fritz.ai/"><em> Heartbeat</em></a><em> is a contributor-driven online publication and community dedicated to providing premier educational resources for data science, machine learning, and deep learning practitioners. We’re committed to supporting and inspiring developers and engineers from all walks of life.</em></p><p><em>Editorially independent, Heartbeat is sponsored and published by </em><a href="http://comet.ml/?utm_campaign=heartbeat-statement&amp;utm_source=blog&amp;utm_medium=medium"><em>Comet</em></a><em>, an MLOps platform that enables data scientists &amp; ML teams to track, compare, explain, &amp; optimize their experiments. We pay our contributors, and we don’t sell ads.</em></p><p><em>If you’d like to contribute, head on over to our</em><a href="https://heartbeat.fritz.ai/call-for-contributors-october-2018-update-fee7f5b80f3e"><em> call for contributors</em></a><em>. You can also sign up to receive our weekly newsletters (</em><a href="https://www.deeplearningweekly.com/"><em>Deep Learning Weekly</em></a><em> and the </em><a href="https://info.comet.ml/newsletter-signup/"><em>Comet Newsletter</em></a><em>), join us on</em><a href="https://join.slack.com/t/fritz-ai-community/shared_invite/enQtNTY5NDM2MTQwMTgwLWU4ZDEwNTAxYWE2YjIxZDllMTcxMWE4MGFhNDk5Y2QwNTcxYzEyNWZmZWEwMzE4NTFkOWY2NTM0OGQwYjM5Y2U"><em> </em></a><a href="https://join.slack.com/t/cometml/shared_invite/zt-49v4zxxz-qHcTeyrMEzqZc5lQb9hgvw"><em>Slack</em></a><em>, and follow Comet on </em><a href="https://twitter.com/Cometml"><em>Twitter</em></a><em> and </em><a href="https://www.linkedin.com/company/comet-ml/"><em>LinkedIn</em></a><em> for resources, events, and much more that will help you build better ML models, faster.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e26718dffa03" width="1" height="1" alt=""><hr><p><a href="https://heartbeat.comet.ml/the-subtle-art-of-making-lines-in-augmented-reality-using-arcore-and-unity3d-e26718dffa03">Using ARCore and Unity3D to Draw Lines in Augmented Reality</a> was originally published in <a href="https://heartbeat.comet.ml/">Heartbeat</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Motion Tracking in ARCore…]]></title>
            <link>https://medium.com/coding-blocks/introduction-to-motion-tracking-in-arcore-f3e584ce0ba0?source=rss-9cebef7b1383------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3e584ce0ba0</guid>
            <category><![CDATA[augmented-reality]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[ar]]></category>
            <category><![CDATA[arcore]]></category>
            <dc:creator><![CDATA[Shivang Chopra]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 08:02:34 GMT</pubDate>
            <atom:updated>2018-07-23T08:02:34.048Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*x5PtFHCtJizyp34c6z11jg.png" /></figure><p>Before digging into the concept of Motion Tracking in ARCore and it’s implementation, it is important to learn about the various hardware of a phone used by ARCore and their purpose in creating a better Augmented experience for the user.</p><p>The mobile hardware can be Bradly categorised into 3 categories based on their functionality:-</p><ol><li>Hardware that enables motion tracking</li><li>Hardware that enables location based AR</li><li>Hardware that enables view of real world with AR</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gla-xI95DlzRNR1RJwUd8A.jpeg" /></figure><h4>Hardware that enables Motion Tracking</h4><p><strong>Accelerometer</strong>:<strong> </strong>Measures acceleration, which is speed divided by time. Simply put, it’s the measure of change in velocity. Acceleration forces can be static/continuous — like gravity — or dynamic, such as movement or vibrations.</p><p><strong>Gyroscope</strong>:<strong> </strong>Measures and/or maintains orientation and angular velocity. When you change the rotation of your phone while using an AR experience, the gyroscope measures that rotation and ARCore ensures that the digital assets respond correctly.</p><p><strong>Phone Camera</strong>:<strong> </strong>With mobile AR, your phone camera supplies a live feed of the surrounding real world upon which AR content is overlaid. In addition to the camera itself, ARCore-capable phones like the Google Pixel rely on complementary technologies like machine learning, complex image processing, and computer vision to produce high-quality images and spatial maps for mobile AR.</p><h4>Hardware that enables location-based AR</h4><p><strong>Magnetometer:</strong> Gives smartphones a simple orientation related to the Earth’s magnetic field. Because of the magnetometer, your phone always knows which direction is North, allowing it to auto-rotate digital maps depending on your physical orientation. This device is key to location-based AR apps.</p><p><strong>GPS: </strong>A global navigation satellite system that provides geolocation and time information to a GPS receiver, like in your smartphone. For ARCore-capable smartphones, this device helps enable location-based AR apps.</p><h4>Hardware that enables view of real world with AR</h4><p><strong>Display:</strong> the display on your smartphone is important for crisp imagery and displaying 3D rendered assets. For instance, Google Pixel XL’s display specification is 5.5&quot; AMOLED QHD (2560 x 1440) 534ppi display, which means that the phone can display 534 pixels per inch — making for rich, vivid images.</p><h3>Tracking in AR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O5BCnOT3HRQPBUOoXm7eBQ.jpeg" /></figure><p>AR relies on computer vision to see the world and recognise the objects in it. The first step in the computer vision process is getting the visual information, the environment around the hardware to the brain inside the device. The process of scanning, recognising, segmenting, and analysing environmental information is called tracking, in immersive technologies. For AR, there’s two ways tracking happens, inside-out tracking and outside-in tracking.</p><h4>Outside-In Tracking</h4><p>With Outside-in Tracking, cameras or sensors aren’t housed within the AR device itself. Instead, they’re mounted elsewhere in the space. Typically, mounted on walls or on stands to have an unobstructed view of the AR device. They then feed information to the AR device directly or through a computer. Outside-in Tracking overcomes some of the space and power issues that can occur with AR devices. The external cameras or sensors can be as large as you want, at least theoretically. You don’t have to worry about people wearing them on their faces or carrying them in their pockets. But what you gain in function, you lose in portability. If your headset loses connection to the outside sensors for even a moment, then they can lose tracking. The visuals will suffer breaking immersion.</p><h4>Inside-Out Tracking</h4><p>With inside-out tracking, cameras and sensors are built right into the body of the device. Smartphones are the most obvious example of this type of tracking. They have cameras for seeing and processors for thinking in one wireless battery-powered portable device. On the AR headset side Microsoft’s HoloLens is another device that uses inside-out tracking in AR. But all that hardware takes up space, power, and generates heat. The true power of standalone AR devices will emerge when they become as ubiquitous and as useful as smartphones.</p><h3>Motion Tracking</h3><p>Whether it’s happening on a smartphone or inside a standalone headset, every AR app is intended to show convincing virtual objects. One of the most important things that systems like ARCore do is motion tracking. AR platforms need to know when you move. The general technology behind this is called <strong>Simultaneous Localisation and Mapping or SLAM</strong>. This is the process by which technologies like robots and smartphones analyse, understand, and orient themselves to the physical world. SLAM processes require data collecting hardware like cameras, depth sensors, light sensors, gyroscopes, and accelerometers. ARCore uses all of these to create an understanding of your environment and uses that information to correctly render augmented experiences by detecting planes and feature points to set appropriate anchors. In particular, ARCore uses a process called <strong>Concurrent Odometry and Mapping or COM</strong>. That might sound complex, but basically, COM tells a smartphone where it’s located in space in relationship to the world around it. It does this by capturing visually distinct features in your environment. These are called feature points. These feature points can be the edge of a chair, a light switch on a wall, the corner of a rug, or anything else that is likely to stay visible and consistently placed in your environment. Any high-contrast visual conserve as a feature point. This means that vases, plates, cups, wood textures, wallpaper design, statues, and other common elements could all work as potential feature points. ARCore combined, it’s new awareness of feature points with the inertial data, all the information about your movement, from your smartphone. Many smartphones in existence today have gyroscopes for measuring the phones angle and accelerometers for measuring the phones speed. Together, feature points in inertial data work together to help ARCore determine your phones pose. Pose means any object’s position and orientation to the world around it. Now that ARCore knows the pose of your phone, it knows where it needs to place the digital assets to seem logical in your environment. Remember, virtual objects need to have a place and be at the right scale as you walk around them. For example, this lion needs to have its feet on the ground to create the illusion that it is standing there, rather than floating in space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Y9_FPsjUVCKRWfOanmBRQ.jpeg" /></figure><h3>Playing with Motion Tracking in Unity3D</h3><p>In the app we will be building, we will not be anchoring the objects to a plane as we are just focussing on the motion tracking component of ARCore and not the complete environmental understanding.</p><p>Step 1: Open Unity3D and create a new project names ARCore102. Make sure to select 3D in the template section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*PWCHzpTnqrwtJlO8wME0yA.png" /></figure><p>Step 2: After the project is created, head over to Unity-&gt;Unity Preferences-&gt;External Tools. Add the path of Android SDK and Android JDK taken from Android Studio into the respective fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*2W6TaiKA9hMYa9cOqqMPsA.png" /></figure><p>Step 3: Go to File-&gt;Build Settings, select Android in the Platforms list. Then click Switch Platform. The unity logo should appear in front of Android in the platforms list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*3ftP0Cuf0LYgVy8YFV1t3g.png" /></figure><p>Step 4: Download ARCore SDK for Unity from the following link:</p><p><a href="https://github.com/google-ar/arcore-unity-sdk/releases">google-ar/arcore-unity-sdk</a></p><p>Step 5: Right click in the Assets window-&gt;Import Package-&gt;Custom Package and select the downloaded ARCore SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*7wokAXatLbriO8SLvLlqkw.png" /></figure><p>Step 6: Click on All and then Import in the dialog box that appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*MEnCheeBY0CgGRjKEj5q2A.png" /></figure><p>Step 7: The Asset window should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*WmQTB5Xb0a4pTbhz2ScP-Q.png" /></figure><p>Step 8: Go to File-&gt; Build Settings and click on Player Settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*4oK5ApYNqZhuYbB_Jct23A.png" /></figure><p>Step 9: The following window will appear in the Inspector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*rPagmUUtBrDhbBQebgdj6Q.png" /></figure><p>Step 10: In the Inspector window, configure the following settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*SxMJjIzdPQevNzOZABmLuw.png" /></figure><p>Step 11: Go to Asset Store Window and search for SD Martial Arts Girl.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*yiHcmEqHT8f1gbfwPV_6ew.png" /></figure><p>Step 12: On the page that appears scroll down and click on Downlaod and then Import.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*fcnz9Xwqubdvi-ZgkvUcDQ.png" /></figure><p>Step 13: The Project window should now look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*Ta-t3xYScvU56YjQCcX0qw.png" /></figure><p>Step 14: Go to SD_Character-&gt;Character-&gt;4Hero-&gt;Prefabs and add the Model to the scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*v2RKAu4JIp-ha7rr5xcCiA.png" /></figure><p>Step 15: Go to SD_Character-&gt;Character-&gt;4Hero-&gt;Animations-&gt;Chara_4Hero_Controller. The following screne appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*Bwsy1ZzxGvskkEhOZ6bz8A.png" /></figure><p>Step 16: Delete all cells except Entry, Any State and Exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*1VVfPPsosB3Z4-bnSPMIwg.png" /></figure><p>Step 17: Add the Attack, Idle and Dead Animations to the Animator windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*43dYWhcTcjKSRsk8wi9EbA.png" /></figure><p>Step 18: Go to the MainCamera Game Object and click Add Component in the inspector window. Then type in Track Pose Driver and press Enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/1*odCS8vMlCltgmOSHY_Y0Lw.png" /></figure><p>Step 19: Set the Pose Source in Inspector Window to Center Eye.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*K6TOYopbR_K3uNuKg2Xp-g.png" /></figure><p>Step 20: Go to the MainCamera Game Object and click Add Component in the inspector window. Then type in ARCore Session and press Enter. Also add the ARCore Background Renderer component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*w-SFJL2GFQdJobig8aHQDA.png" /></figure><p>Step 21: Click on the circle beside Session Config and select Default Session Config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/1*uQd7xtkR80WW7p5ZcShqWA.png" /></figure><p>Step 22: Click the circle beside Background Material and select AR Background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*cjr06Vjbo5eoZ5cOYxBnRQ.png" /></figure><p>Step 23: Save the scene and build the app. Test the app on your Android device and play with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*hwPlGP7Vjll05IXClssyZQ.gif" /></figure><p>That’s it! I hope you liked this post. If you did, don’t forget to 👏.</p><p>Next Up: Point and Plane Detection in ARCore.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3e584ce0ba0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-blocks/introduction-to-motion-tracking-in-arcore-f3e584ce0ba0">Introduction to Motion Tracking in ARCore…</a> was originally published in <a href="https://medium.com/coding-blocks">Coding Blocks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ARCore: Diving into the world of Augmented Reality]]></title>
            <link>https://medium.com/coding-blocks/arcore-diving-into-the-world-of-augmented-reality-31ba228d8530?source=rss-9cebef7b1383------2</link>
            <guid isPermaLink="false">https://medium.com/p/31ba228d8530</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[augmented-reality]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[arcore]]></category>
            <category><![CDATA[unity3d]]></category>
            <dc:creator><![CDATA[Shivang Chopra]]></dc:creator>
            <pubDate>Fri, 29 Jun 2018 07:28:52 GMT</pubDate>
            <atom:updated>2018-06-29T13:23:29.943Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Huge advances in the field of Computer Vision has paved the path for one of the most exciting fields of Mobile-Platform based Augmented Reality. Apple’s ARKit and Google’s ARCore are one of the finest frameworks available to develop Augmented Reality apps. This short tutorial will be covering the basic working of Google’s ARCore and it’s integration with Unity Game Engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*LasC1pPGRIWc_v0Ddf0WXQ.png" /></figure><h4>What is Augmented Reality?</h4><p>Augmented reality (AR) is a view of things of real world enriched (augmented) by video, GPS, graphics or sound. This technology helps to enhance human perception of reality. In Augmented Reality, physical real-world environments are augmented with superimposed computer-generated images over a user’s view of the real-world, thus enhancing one’s current perception of reality.</p><h4>Types of Augmented Reality</h4><ul><li><strong>Marker-Based Augmented Reality</strong> uses a camera and some type of visual marker, such as a QR/2D code, to produce a result only when the marker is sensed by a reader.</li><li><strong>Marker-Less Augmented Reality</strong> uses a GPS, digital compass, velocity meter, or accelerometer which is embedded in the device to provide data based on your location.</li><li><strong>Projection Based Augmented Reality</strong> allows for human interaction by sending light onto a real world surface and then sensing the human interaction (i.e. touch) of that projected light.</li><li><strong>Superimposition Based Augmented Reality</strong> either partially or fully replaces the original view of an object with a newly augmented view of that same object.</li></ul><h4>How does ARCore work?</h4><p>Before diving into development, let’s look into what’s under the hood of Google’s SDK.</p><p>Fundamentally, ARCore uses three key capabilities to integrate virtual content with the real world as seen through your phone’s camera:</p><ul><li><strong>Motion Tracking</strong> allows the phone to understand and track its position relative to the world. ARCore uses an algorithm called <strong>Concurrent Odometry and Mapping</strong> (COM) to understand where the phone is relative to the world around it.</li><li><strong>Environmental Understanding </strong>allows the phone to detect the size and location of all type of surfaces: horizontal, vertical and angled surfaces like the ground, a coffee table or walls. ARCore looks for clusters or feature points that appear to lie on common surfaces such as desks, chairs, etc. and makes these surfaces available to your device as ground planes.</li><li><strong>Light Estimation</strong> allows the phone to estimate the environment’s current lighting conditions and lets you light your virtual objects under the same lighting condition.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhgt8xGUQrQ-IJKfDEf3QA.png" /></figure><p>ARCore was essentially derived from Google’s Project Tango which had special hardware to do it’s AR. Unfortunately, it wasn’t practical to implement this hardware on all the devices. Therefore, ARCore emerged after the likes of ARKit.</p><h4>Setting up your first ARCore project in Unity3D</h4><p>Before starting with the project, it is important to note that, because ARCore is a relatively new SDK, only a limited number of mobile devices are supported. Make sure you have access to one of them in order to work on this platform.</p><p>You can get a list of the supported devices here:-</p><p><a href="https://developers.google.com/ar/discover/supported-devices">ARCore supported devices | Google Developers</a></p><p>Let’s first start by importing and playing around with the official HelloAR project. After that we can start making new apps using the official app as a framework.</p><p>Step 1: Go ahead to the following link and download Unity3D. Make sure to download version 2017.4 or later.</p><p><a href="https://unity3d.com/get-unity/download/archive">Get Unity - Download Archive - Unity</a></p><p>Step 2: During installation, select Android Build Support in the components section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*LtYi2TI7WN7iBSFSIGxnzg.png" /></figure><p>Step 3: Head over to this link and download Android Studio.</p><p><a href="https://developer.android.com/studio/">Download Android Studio &amp; App Tools - Android Developers</a></p><p>Step 4: Open Unity3D and create a new project names ARCore101. Make sure to select 3D in the template section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*lGuPgvUsLlBOFix7R3MoYg.png" /></figure><p>Step 5: After the project is created, head over to Unity-&gt;Unity Preferences-&gt;External Tools. Add the path of Android SDK and Android JDK taken from Android Studio into the respective fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*SYdY7EHwLtZHpv3cwMLhcw.png" /></figure><p>Step 6: Go to File-&gt;Build Settings, select Android in the Platforms list. Then click Switch Platform. The unity logo should appear in front of Android in the platforms list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*hWNGZyBGACtb5b0ZQuoiLw.png" /></figure><p>Step 7: Download ARCore SDK for Unity from the following link:</p><p><a href="https://github.com/google-ar/arcore-unity-sdk/releases">google-ar/arcore-unity-sdk</a></p><p>Step 8: Right click in the Assets window-&gt;Import Package-&gt;Custom Package and select the downloaded ARCore SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*Sl74zeHurKEmFRfK3QSfDg.png" /></figure><p>Step 9: Click on All and then Import in the dialog box that appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*ltUqQqE8DGLJLgpAITfG5w.png" /></figure><p>Step 10: The Asset window should look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*cpJabOMVNVI59bcdC_FSug.png" /></figure><p>Step 11: Go to Assets-&gt;GoogleARCore-&gt;Examples-&gt;Scenes and open HelloAR scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*avwfYVZB4skC8FUACgq0CQ.png" /></figure><p>Step 12: Go to File-&gt; Build Settings and click on Player Settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*b2FxzzxwkPChpRafpW97iw.png" /></figure><p>Step 13: The following window will appear in the Inspector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*FbI9OK0o326QQkqYnr4LWw.png" /></figure><p>Step 14: In the Inspector window, configure the following settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*WStthZQ30n46SOH6fu_Ahw.png" /></figure><p>Step 15: Save the scene, go to File-&gt;Build Settings, click on Add Open Scenes and deselect Scenes/SampleScene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*qw-foMClzyOZLbvk8dH0hw.png" /></figure><p>Step 16: Connect your Android device with USB Debugging Enabled and then go to File-&gt;Build Settings and click Build And Run. Save the build and wait for the app to build on your device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*qw-foMClzyOZLbvk8dH0hw.png" /></figure><p>Step 17: Play with the app on your Android device. Make sure to search for surfaces with a texture, as plane surfaces are not detected by ARCore SDK. Touch on the screen to spawn an Android Object at the desired spot in Augmented Reality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*IpEtE8W9J81mO7Fdd-DoXA.gif" /></figure><p>That’s it! I hope you liked this post. If you did, don’t forget to 👏.</p><p>Next Up: Motion Tracking in ARCore.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31ba228d8530" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-blocks/arcore-diving-into-the-world-of-augmented-reality-31ba228d8530">ARCore: Diving into the world of Augmented Reality</a> was originally published in <a href="https://medium.com/coding-blocks">Coding Blocks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>