<?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 Kieran Lee Farr on Medium]]></title>
        <description><![CDATA[Stories by Kieran Lee Farr on Medium]]></description>
        <link>https://medium.com/@kfarr?source=rss-d2d11c1aa5d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CA5jwSDg1GVvBO6AC63Jfw.jpeg</url>
            <title>Stories by Kieran Lee Farr on Medium</title>
            <link>https://medium.com/@kfarr?source=rss-d2d11c1aa5d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 10:21:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kfarr/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[Experimenting with PBR textures and A-Frame]]></title>
            <link>https://medium.com/@kfarr/experimenting-with-pbr-textures-and-a-frame-26c5a034b7b?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/26c5a034b7b</guid>
            <category><![CDATA[a-frame]]></category>
            <category><![CDATA[threejs]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 05:15:37 GMT</pubDate>
            <atom:updated>2020-07-01T05:31:51.712Z</atom:updated>
            <content:encoded><![CDATA[<h3>Experimenting with PBR textures using A-Frame and Three.js</h3><h3>Context</h3><p>I’ve been working on an <a href="https://aframe.io/">A-Frame</a> hobby project <a href="https://github.com/kfarr/streetmix3d">Streetmix3D</a> which creates a 3D version of streetscapes designed using the drag and drop builder Streetmix.net. (Streetmix started as a <a href="https://nyc.streetsblog.org/2013/08/12/meet-streetmix-the-website-where-you-can-design-your-own-street/">Code for America hackathon project</a> and has been faithfully <a href="https://github.com/streetmix/streetmix">maintained as an open source project</a> for the past seven years!)</p><p>The visual style of Streetmix3D started out with voxel stylized graphics created in <a href="https://ephtracy.github.io/">Magicavoxel</a> (left). I then experimented with using a photorealistic “custom photo” style texture I made using photogrammetry techniques and made into a simple repeating texture using <a href="https://docs.substance3d.com/b2m3/get-started-67797042.html">Substance Bitmap-to-Material</a> (right).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzzOp-gpiQtTQhfFLzaKkg.png" /></figure><p>While I liked the look of the “custom photos style” (right) up-close, the “game ready” texture (center) looked better from a distance. I eventually found a reasonable quality output using a “Game Ready” style <a href="https://www.textures.com/download/roads0086/44877">texture from Textures.com</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTixDccrYUBGP2lKnCe1gw.png" /><figcaption>(<a href="https://twitter.com/kfarr/status/1196691160548302848">See more angles and original images from this tweet</a>)</figcaption></figure><p>While these texture improvements are more details than voxels, they are simply repeating “image map” textures from a single JPEG or PNG. They do not exhibit real life lighting effects aside from built-in defaults of A-Frame and <a href="https://threejs.org/docs/#api/en/materials/MeshStandardMaterial">three.js</a>.</p><h4>Moving beyond 80s and 90s style graphics on the web</h4><p>The evolution of Streetmix3D textures reminds me of the evolution from polygon 3D style games from the early 90’s to real time texture mapping in mid to late 90’s. When I was a kid I played a lot of racing games including the PC MS-DOS game Stunts (solid 3d polygons) and later the Need for Speed series (image map textures and sprites).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7Q8rEmZlkKWgPWjGw-rBA.jpeg" /><figcaption>Screencaps from <a href="https://en.wikipedia.org/wiki/Stunts_(video_game)">Stunts</a> 1990 (top) and <a href="https://en.wikipedia.org/wiki/The_Need_for_Speed">The Need for Speed</a> 1994 (bottom) PC Games (Stunts pics and download here <a href="https://www.myabandonware.com/game/the-need-for-speed-special-edition-7q5">NFS pictures and download from here</a>, Stunts)</figcaption></figure><p>Now it’s time to try to take Streetmix3D to the next level out of the 90’s and into the new millennia of 3D graphics using <a href="https://en.wikipedia.org/wiki/Physically_based_rendering">Physically Based Rendering</a> (PBR).</p><h3>PBR with A-Frame and three.js</h3><p>To learn about physically based rendering (PBR) and A-Frame I decided to start with a simple <strong>Project Goal: Display a plane in A-Frame that uses a PBR texture purchased from a third-party library.</strong></p><h4><strong>Ingredients</strong></h4><p>I saw the best results using PBR with A-Frame and three.js with each of the following texture types to make the material look the best:</p><ul><li>Metalness</li><li>Roughness</li><li>Ambient Occlusion</li><li>Image Map (aka Diffuse Map, Base Map)</li><li>Normal Map</li></ul><p>The scene will still render OK without all of these textures to varying degrees of success, depending on which are missing and what are your scene’s aesthetic goals.</p><h4>Finding a PBR Texture from CGAxis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sjfidcd0R-Exu6zWHo-hQ.png" /><figcaption><a href="https://cgaxis.com/product/road-with-tram-rails-pbr-texture/">Buy your own copy of the texture from CGAxis</a> if you want to use it in your project.</figcaption></figure><p>I was particularly interested in displaying a more realistic portrayal of the interplay between rail and asphalt for the tram and light rail lanes.</p><p>I found a beautiful looking <a href="https://cgaxis.com/product/road-with-tram-rails-pbr-texture/">“Road with Tram Rails” PBR Texture from CGAxis </a>— it was only $5 and had everything I needed!* (*The metalness texture was missing at first but after a chat with support they quickly provided one.)</p><h4>What’s inside of a PBR texture pack?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c1ZpdeMnEnhEq3CyDBz_Aw.png" /><figcaption>This is an example of the different files in a PBR texture pack as downloaded from CGAxis.</figcaption></figure><p>You may see varying files depending on the target platform and engine (Unity and Unreal seem to be the most common target platforms). Here are the files I found from the CG Axis “<a href="https://cgaxis.com/product/road-with-tram-rails-pbr-texture/">road with tram rails</a>”:</p><ul><li>AO (ambient occlusion)</li><li>Diffuse (aka base or image map)</li><li>Glossiness</li><li>Height</li><li>Metalness</li><li>Normal</li><li>Reflection (aka specular)</li><li>Roughness</li></ul><p>To start making sense of these different files and their function I found this guide <a href="https://academy.substance3d.com/courses/the-pbr-guide-part-2">“PBR Guide Part 2” from Substance</a> to be crucial helping me to understand the key parts of a basic PBR workflow. Highly recommended Sunday morning coffee reading!</p><h4>Preparing textures for three.js</h4><p><strong>Discard </strong>— A-Frame is based on three.js which uses a <a href="https://threejs.org/docs/#api/en/materials/MeshStandardMaterial">“Metallic-Roughness” workflow</a> and some of the files in the texture pack only apply to “Specular-Glossiness” workflow, so we can discard Glossiness and Reflection for this example.</p><p><strong>Combine </strong>— Some of the texture images have only a single color channel (grayscale). These can be cleverly be combined into one image file by mapping each of the 3 grayscale images on separate channels for Red, Green and Blue. In fact we <strong><em>must</em></strong> combine these into one file for three.js.</p><p><strong>Three.js expects Ambient Occlusion, Roughness and Metalness combined into one image file as RGB channels.</strong> You can combine this manually with Photoshop or a specialty tool like Substance Designer but that takes effort and those tools cost money, so I opted for a free command line solution instead!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNB-lrQxCgfeeDGwO_l4Pw.png" /><figcaption>Here’s a thumbnail of the texture image resulting from combining AO, Roughness and Metallic (ARM) into RGB color channels to prepare for three.js PBR</figcaption></figure><p>For this I used <a href="https://imagemagick.org/index.php">ImageMagick</a> — a versatile command line image manipulation utility. Install it using your method of choice, I used the <a href="https://brew.sh/">homebrew</a> command line utility for MacOS to install:brew install imagemagick.</p><p>This installs a utility convert that you can use to combine files together:</p><pre>magick convert texture_ao.jpg texture_roughness.jpg texture_metalness.jpg -channel RGB -combine texture_combined.jpg</pre><p>If one of the textures is missing, you can substitute it with black using this method but it will affect the quality of your final output:</p><pre>convert r.jpg g.jpg -background black -channel RG -combine combined.jpg</pre><p>Read more about convert from the <a href="http://www.imagemagick.org/Usage/color_basics/#combine">helpful ImageMagick documentation</a>.</p><h4>Displaying it with A-Frame</h4><p>I could not find a way to define all these elements of PBR textures in A-Frame “out of the box.” I did find a great example implementation in the form of an answer to a Stack Overflow question <a href="https://stackoverflow.com/questions/59625510/aframe-gltf-model-demo-with-envmap/59628444#59628444">How to Apply Environment Map to glTF in A-Frame</a> written by <a href="https://stackoverflow.com/users/2425787/piotr-adam-milewski">Piotr Adam Milewski</a>. He also provided a Glitch project proof of concept that renders a “<a href="https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet">Damaged Helmet</a>” test object with an equirectangular environment map: <a href="https://stack-59625510.glitch.me/">https://stack-59625510.glitch.me</a>/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-H0hiB1HoQb-4guDIteItw.png" /><figcaption>A good starting point to build <a href="https://stack-59625510.glitch.me/">from is this glitch repo</a> featuring <a href="https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet">the “Damaged Helmet” glTF model</a></figcaption></figure><p>I “remixed” Piotr’s glitch and replaced the glTF helmet with a plane geometry instead. This is practical for Streetmix3D roadway and in a more general sense to allow quickly experimenting with new textures before needing modeling software like Blender to apply it to a model.</p><p>I have renamed Piotr’s component to envmap and created a new component pbr that applies the specific textures to the plane material to support PBR. The syntax of the two components together are:</p><pre>&lt;a-plane pbr envmap&gt;&lt;/a-plane&gt;</pre><p>The pbr component does the following:</p><ul><li>Load the textures from hardcoded URLs using THREE.TextureLoader()</li><li>Traverses through all the materials in the three.js object3d</li><li>For each material: set the material’s maps to the loaded textures:</li></ul><pre>el.material.map = textureDiffuse;<br>el.material.aoMap = textureCombined;<br>el.material.metalnessMap = textureCombined; // can&#39;t set w/ A-Frame<br>el.material.roughnessMap = textureCombined; // can&#39;t set w/ A-Frame<br>el.material.normalMap = textureNormal;</pre><p>Note that we must also “create a <a href="https://discourse.threejs.org/t/why-do-ao-and-lightmap-need-a-second-set-of-uvs/4178/8">second set of UVs</a>” for ambient occlusion to work properly in three.js. I found a few lines of JavaScript to do this (from <a href="https://discourse.threejs.org/">somewhere in the three.js discourse group</a>) and put them in the pbr component:</p><pre>var geometry = mesh.geometry;<br>geometry.addAttribute( &#39;uv2&#39;, new THREE.BufferAttribute( geometry.attributes.uv.array, 2 ) );</pre><h4>What does it look like?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UPtI17zjF5YoS3YdQU02Qw.png" /><figcaption>Viewing as a plane</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5HD-qLfn13L07hNEnr2iXg.png" /><figcaption>Viewing as a sphere (left) to compare against rendering provided by texture library (right)</figcaption></figure><p>As you can see we are getting closer but there are still a few issues:</p><ul><li>The asphalt is still too “shiny”</li><li>The rails don’t look particularly shiny</li><li>The asphalt, rails and groove in between rails all look the same, would be nice to have more color difference</li></ul><h4>Improving with three.js</h4><p>I <a href="https://discourse.threejs.org/t/pbr-material-looks-too-shiny-in-three-js/16666">posted for help in the three.js discourse forum and received the following tips to improve the scene</a>:</p><blockquote><strong>Why doesn’t my output look the same as the example render? </strong>PBR implementation will always vary depending on platform or engine shader used to interpret the textures. “Comparing different rendering engines does not always work as expected since shaders are implemented differently. Even when using the same environment map, lighting can vary quite noticeably.” Test in your target platform and modify from there. <a href="https://discourse.threejs.org/t/pbr-material-looks-too-shiny-in-three-js/16666/2">Michael Herzog</a></blockquote><blockquote>If using <em>ACESFilmicToneMapping</em> then set <em>renderer.toneMappingExposure</em> to lower values than the default of <em>1</em> such as <em>0.75</em> or <em>0.5</em>. <a href="https://discourse.threejs.org/t/pbr-material-looks-too-shiny-in-three-js/16666/2">Michael Herzog</a></blockquote><blockquote><strong>Set </strong><a href="https://threejs.org/docs/#api/en/materials/MeshStandardMaterial.metalness"><strong>material.metalness = 1</strong></a>, otherwise the metalness map will have no effect — this is why the rails didn’t look particularly shiny or reflective. <a href="https://discourse.threejs.org/t/pbr-material-looks-too-shiny-in-three-js/16666/5">Don McCurdy</a></blockquote><h4>Improving with Photoshop</h4><p>I manually edited the roughness, metalness, and diffuse texture maps to achieve my desired look.</p><p>To reduce the shinyness of the asphalt, I edited the roughness texture map to significantly increase the brightness of the asphalt section. I also edited roughness and metalness to ensure the proper appearance of the “tram grooved rail.” Finally, I slightly darkened the asphalt color and made the “trough” between the tramrails nearly full black with full roughness / no metalness to look like a recessed shadow in between the rails.</p><p>Here are the before / after texture maps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yl0NcDxtmw0AcGRA1ErhEA.png" /><figcaption>New asphalt is “rougher” (brighter white)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGKdiFVzAg8tGHnppVh7zQ.png" /><figcaption>New metalness map has the correct part of the tram grooved rail highlighted</figcaption></figure><p>I almost forgot the last step —remember to recombine these new roughness and metalness maps into a new combined AO/Roughness/Metalness texture using the Image Magick instructions above.</p><p>Just for fun here’s what the old and new look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQFzTucfBcvgJCzaZhgMoA.png" /></figure><p>Finally after incorporating the three.js improvements along with manual editing of the textures resulted in an output that looks much better! The one on the right is very close to my “artistic goal” with this material :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CBlUoWiwZHolSpQkkVi7CQ.jpeg" /><figcaption>Old version (left), new final version (right)</figcaption></figure><p><strong>View the final project in your browser: </strong><a href="https://aframepbr.glitch.me/"><strong>https://aframepbr.glitch.me/</strong></a></p><p><strong>Remix your own A-Frame PBR project: </strong><a href="https://glitch.com/~aframepbr"><strong>https://glitch.com/~aframepbr</strong></a></p><h4>More things to research and fix</h4><ul><li>Would be nice to allow the pbr component to accept paths for texture files instead of hardcoding them in the component init function.</li><li>Investigate performance of PBR texture vs. simple image map, especially on Quest</li><li>What does it actually look like in the Quest? Good but laggy, lower performance? Needs more digging.</li><li>How do you extend this beyond current length without creating more draw calls? Will the uv2 trick still work? Time to use blender instead?</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26c5a034b7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Web Audio API Positional Audio Distance Models for WebXR]]></title>
            <link>https://medium.com/@kfarr/understanding-web-audio-api-positional-audio-distance-models-for-webxr-e77998afcdff?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e77998afcdff</guid>
            <category><![CDATA[webxr]]></category>
            <category><![CDATA[webvr]]></category>
            <category><![CDATA[desmos]]></category>
            <category><![CDATA[a-frame]]></category>
            <category><![CDATA[web-audio-api]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 06:34:30 GMT</pubDate>
            <atom:updated>2020-04-23T06:44:38.488Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m working on a WebXR project using the fabulous <a href="http://aframe.io/">A-Frame WebXR framework</a> but I’m struggling to understand how to make sound effects from various objects in my scene play at the proper volume for the in-VR experience at various distances. It just doesn’t make sense to me intuitively, so I decided to look under the hood and writeup my findings.</p><h4>What is the A-Frame Sound Component?</h4><p>A-Frame’s <a href="https://aframe.io/docs/1.0.0/components/sound.html">sound component</a> is a wrapper around the three.js <a href="https://threejs.org/docs/#api/en/audio/PositionalAudio">PositionalAudio object</a> which itself relies on the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API">Web Audio API</a>. (Turtles all the way down.)</p><p>The A-Frame sound component exposes the <a href="https://aframe.io/docs/1.0.0/components/sound.html#properties">following properties</a> pasted here as an image for convenience:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_cvoiGszwflh_0_lJKoXYw.png" /><figcaption><a href="https://aframe.io/docs/1.0.0/components/sound.html#properties">https://aframe.io/docs/1.0.0/components/sound.html#properties</a></figcaption></figure><p>The focus in this writeup is on cases where positional = true , the default value. (Non-positional audio is easy, it just plays at whatever volume you set globally. I use non-positional audio for ambient background noise.)</p><p>The key properties I’m focusing on understanding are:</p><ul><li>distanceModel: linear, inverse or exponential</li><li>maxDistance</li><li>refDistance</li><li>rolloffFactor</li></ul><p>For simplicity sake we’ll assume volume = 1 for all examples in this writeup.</p><h4>Web Audio API Distance Models</h4><p>The excellent <a href="https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/distanceModel">Mozilla Developer Network documentation</a> explains all 3 distanceModel options, pasted here for convenience:</p><blockquote><em>The </em><em>distanceModel property of the </em><a href="https://developer.mozilla.org/en-US/docs/Web/API/PannerNode"><em>PannerNode</em></a><em> interface is an enumerated value determining which algorithm to use to reduce the volume of the audio source as it moves away from the listener.</em></blockquote><blockquote><em>The possible values are:</em></blockquote><blockquote><em>linear: A </em>linear distance model<em> calculating the gain induced by the distance according to:<br></em><em>1 - rolloffFactor * (distance - refDistance) / (maxDistance - refDistance)</em></blockquote><blockquote><em>inverse: An</em> inverse distance model<em> calculating the gain induced by the distance according to:<br></em><em>refDistance / (refDistance + rolloffFactor * (Math.max(distance, refDistance) - refDistance))</em></blockquote><blockquote><em>exponential: An </em>exponential distance model<em> calculating the gain induced by the distance according to:<br></em><em>pow((Math.max(distance, refDistance) / refDistance, -rolloffFactor).</em></blockquote><blockquote><em>inverse is the default value of </em><em>distanceModel.</em></blockquote><p>Ok — I get these are some straightforward equations and maybe with some graph paper and a lot of time I could figure this out, but I’m impatient so I googled and found a nice <a href="https://www.desmos.com/calculator/yadn2gcpnc">visualization</a> created by an anonymous hero using a nifty web-based graphing calculator called <a href="https://www.desmos.com/">Desmos</a>.</p><p>I’ve <a href="https://www.desmos.com/calculator/lzxfqvwoqq">created an updated version to make it more understandable with variable and function labels</a> as they relate back to the Web Audio API docs as well as default values per the A-Frame sound component docs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbwA_4r7xqzqa1ZassyYBA.png" /><figcaption>Visualization Sound Reduction by Distance using default A-Frame settings — Note that the Blue (exponential) plot hides the Red (inverse) plot as they have identical output values.</figcaption></figure><p>From this simple visualization we instantly learn a few key things about the default A-Frame sound settings:</p><ul><li>There is no difference between inverse and exponential distance models with the default values of 1 for rolloffFactor and refDistance.</li><li>linear distance model practically acts as a non-positional audio source with the default value of 10000 for maxDistance.</li></ul><h4>Tweaking the parameters to match a real use case</h4><p>Now let’s try some alternative values. My use case is a streetcar tram emitting a noise as it passes. I tweaked values using common sense intuition to result in this graph comparing the different distance models:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LuAB1TunWMHoF7OT_gvoug.png" /></figure><p>Now we can see more clearly the difference between the 3 different distance model functions.</p><p>The tram in my virtual scene will sound at 100% up until 5 meters away regardless of distance model thanks to refDistance value of 5 (d_ref=5). At 10 meters away, I’d like it to be noticeably quieter but not imperceptible. It seems like the inverse distance model would be most appropriate with these values.</p><p>Let’s try it out. Here’s what I should test:</p><ul><li>If tram sound is set to linear with default settings (maxDistance = 10000) then I should be able to hear it anywhere in the scene.</li><li>If tram sound is set to exponential with f = 3, d_ref = 5 (per above graph) then I should hear it at 100% volume up to 5 meters away, and 0% volume at 20 meters away.</li><li>If tram sound is set to inverse with f = 3, d_ref = 5 (per above graph) then I should hear it at 100% volume up to 5 meters away and still perceptible but quiet at 20 meters away.</li></ul><p>For the record I tried out the above using Oculus Quest browser and my <a href="https://kfarr.github.io/streetmix3d/">Streetmix3D A-Frame project</a> and got the results I expected. However, there were audio artifacts on playback using positional audio, likely due to the overly complex scene that is skipping frames in Oculus Quest headset. Further, those are not the perfect variable settings as the tram is in motion which results in quieter audio when it approaches and leaves (but correct while it is nearby) so more tweaking will be necessary for this specific use case. However, the graph above has been proven to be accurate through this testing so I feel confident in using it again for future planning.</p><p><a href="https://www.desmos.com/calculator/lzxfqvwoqq">Try it for yourself by playing with the interactive graph to see the differences in Web Audio API sound distance models now!</a></p><h4>What about sound distance models in Real Reality?</h4><p>How does sound intensity behave in the real world? Real Reality (as opposed to Virtual Reality using Web Audio APIs) <a href="http://hyperphysics.phy-astr.gsu.edu/hbase/Acoustic/invsqs.html">exhibits drop in sound intensity as a function of the inverse square law</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQ_q4FEP09ujh9G1LevVLg.png" /><figcaption><a href="http://hyperphysics.phy-astr.gsu.edu/hbase/Acoustic/invsqs.html">http://hyperphysics.phy-astr.gsu.edu/hbase/Acoustic/invsqs.html</a></figcaption></figure><p>The closest I could get to the above “real life” chart was the following plot using inverse distance model and rolloffFactor of 3 (f=3) .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vd70VrgDZGuZUixAHzAuJg.png" /></figure><p>As a result I would recommend more “realistic” default sound parameter settings for A-Frame to be:</p><ul><li>rolloffFactor = 3 (for both inverse and exponential distance models)</li><li>maxDistance = 40 (for linear distance model) (There is no perfect value for this, linear is just not a realistic sound distance model so it really depends on application, but 10000 as a default practically defeats the purpose of using the linear distance model.)</li></ul><p>And keeping default property values distanceModel = inverse and refDistance = 1.</p><p>If you like this writeup clap and follow me on twitter <a href="http://twitter.com/kfarr">@kfarr</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e77998afcdff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Magic Matta for the 2019.1 Gray Area Showcase]]></title>
            <link>https://medium.com/@kfarr/creating-magic-matta-for-the-2019-1-gray-area-showcase-37df8f5d8aa0?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/37df8f5d8aa0</guid>
            <category><![CDATA[projection-mapping]]></category>
            <category><![CDATA[augmented-reality]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[a-frame]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Mon, 29 Jul 2019 05:46:32 GMT</pubDate>
            <atom:updated>2019-07-29T07:12:00.674Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D2jf8jBnks7zxNwr" /><figcaption><em>A guest pushes a bus controller as part of the interactive Magic Matta project. Photo Credit: </em><a href="http://www.mariahtiffany.com/"><em>Mariah Tiffany</em></a></figcaption></figure><p>I joined as an artist for the San Francisco Gray Area Foundation’s Incubator Program from January to June this year 2019. I had a great time, met some great artists, shipped a fun v1 of a project, and learned a lot about what it means to be an artist vs. incubate a company. This blog post is a quick overview of the experience and the final showcase.</p><h3>Why did I join this program?</h3><p>I have been experimenting with developing experimental VR gaming and non-gaming experiences using the open-source <a href="https://aframe.io/">A-Frame WebVR</a> framework for a few years. I was looking for a “forcing function” to combine the inspiration of these previous projects to actually ship something and get feedback from peers and new audiences that weren’t familiar with VR.</p><p>The Gray Area Incubator succeeded on all counts — it was a great forcing function to help me ship a project and get quick feedback from peers and the general public.</p><h3>What is the program?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fU74o9ttjX3wQ8SMO6guQ.jpeg" /><figcaption>Gray Area Foundation runs out of the historic Grand Theater in SF’s Mission District</figcaption></figure><p>The Gray Area Incubator is a 6-month program run by the <a href="https://grayarea.org/">Gray Area Foundation for the Arts</a> for beginner and experienced artists alike to develop and showcase new pieces. Gray Area runs out of the historic Grand Theater on Mission St between 22nd and 23rd Streets in San Francisco. It is a unique space with a large event venue downstairs in the converted theater and a multi-use space and classroom in the theater’s former projection room upstairs.</p><h3>What goes on?</h3><p>During the incubator I told my friends and colleagues that I was working on an “art project” — keeping things intentionally vague as I wasn’t sure if I’d be able to actually ship anything or that the program would work as intended. But here, finally, I reveal the secrets of what this “art project” entailed… :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yam6o9FbfzLBtGSzOn9yIA.jpeg" /><figcaption>Student perspective of a Gray Area Workshop in progress: a TouchDesigner course taught by <a href="https://formisfunction.io/work/depths">Stephen Standridge</a>.</figcaption></figure><p>There were about 12 participants, vetted as experienced artists or technically capable of shipping a project at the end of the program. (The “incubator” was not for beginners, there is a separate <a href="https://grayarea.org/learn/immersive/">“Immersive” Program</a> for those looking to learn interactive art technology skills.) Each incubator member had a dedicated co-working desk in the upstairs incubator work-space in exchange for a monthly fee (less than the cost of most co-working spaces in the city). Most folks worked full-time day jobs in addition to their work at the incubator.</p><p>Each month the program hosted a group critique led by the program lead <a href="http://www.nikiselken.com/">Niki Selken</a>. These critiques provided structured conversation — students were expected to come to each critique with a presentation following the format provided by the program to prompt a productive conversation.</p><p>For me, that helped to look past many of the short-term technical challenges and consider what the end-product might actually look like and what elements were still missing to see that vision through to completion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*YQPmRIjZJWoqKTQr2xbdRw.png" /><figcaption>A screenshot from my <a href="https://www.youtube.com/watch?v=mdLiW_4l5Ak">“Artist Salon” presentation about Magic Matta</a> mid-way through the program. This screenshot shows the HTC Vive Tracker attachment to the model toy bus.</figcaption></figure><p>Midway through the program we hosted an “Artist Salon” where each artist presented a quick overview of the motivations and influences behind their work. You can check out the full 15-minute video <a href="https://www.youtube.com/watch?v=mdLiW_4l5Ak">here</a>, but I’ll summarize much of it below.</p><h3>Art vs. Profit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b63ujntZQYgStEwumec_jQ.jpeg" /><figcaption>Gray Area instructor <a href="https://twitter.com/gabrieldunne">Gabriel Dunne</a> teaches a photogrammetry class.</figcaption></figure><p>I’ve been programmed over the past 10 years in the ways of venture-backed SaaS startups including their tendencies to steamroll over creativity in favor of short-term revenue, and I hold a lot of personal guilt for having steered (or NOT steered) in such a direction many times.</p><p>So I appreciated this venture into a new world of “art” and learned a couple of key things, at least new for me:</p><ul><li><strong>Anyone can be an “artist.” (Or not, and that’s ok too.)</strong> It was odd hearing people refer to me as an artist, but I now feel it’s an open term that anyone can adopt upon their own choosing. I don’t think I’ll voluntarily use that word again for a while to describe myself, but I dig the concept a lot more now, feel less guilt about me using it, and less judgment about others using it as well.</li><li><strong>What does success mean? </strong>I struggled with purpose and outcome for this project. What is the definition of success? If it isn’t revenue, adoption, investment, or even social cred, what is it? (My viewpoint after the program is that it’s a trick question when it comes to art: there is no definition of success, it’s up to you as an artist if you even want to ask that question, let alone answer it.)</li><li><strong>How do you provide and receive feedback?</strong> In a world without a definition of success, how do peers share feedback with each other? I really appreciated learning this “through doing” thanks to our <a href="https://grayarea.org/community-entry/niki-selken/">Creative Development Director Niki Selkin</a> who ran monthly critiques using a process inspired by Liz Lerman’s “Critical Response Process.” I definitely plan on using this again in the future — it can be applied to a wide range of group feedback settings. (For future reference, <a href="http://www.brooklynartscouncil.org/files/downloads/Critical_Response_Process.pdf">here’s a PDF about the process</a> from the Brooklyn Arts Council and a <a href="https://lizlerman.com/critical-response-process/">link to Liz Lerman’s own website on the topic</a>.)</li></ul><h3>What did I work on?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9tlg3ZDNE0dY2zr_rjKUhw.jpeg" /><figcaption><em>A user lines up the bus controller to pick up “peeps” from the bus stop. Photo Credit: </em><a href="http://www.mariahtiffany.com/"><em>Mariah Tiffany</em></a></figcaption></figure><p>My showcase project was called “Magic Matta”, an interactive experience to explore transportation and urban planning by encouraging kid-friendly play using the HTC Vive, projection mapping, A-Frame WebXR, and specially enabled toys. Players get down on their hands and knees to push model buses around the play area as controllers for a multi-user game designed for young children to learn counting and the basics of transit systems. (Why the name? “Matta” means carpet in Swedish, “Magic Carpet” is a registered trademark in the US.)</p><h3>Why did I do this?</h3><p>Modern VR can be antisocial and physically inaccessible for many people, especially children. Experiences are constrained to start and end inside of an isolated headset and outsiders at best can look on at an external mirror of the viewpoint of the in-VR participant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qAbIR2Ipw9x5CAy24lpawA.jpeg" /><figcaption>A child explores the relationship between the bus controller and the digital projector.</figcaption></figure><p>I believe this traditional approach to VR experiences is fundamentally wrong and in this piece I attempt to demonstrate a new paradigm of a persistent virtual experiences independent of any specific viewing device. Participants should be able to interact with the same virtual world in a variety of modes that suit their needs and abilities. Shared physical objects and architecture act as a gateway to ground the connection between the virtual, real, and all the participants.</p><p>Magic Matta is a proof of concept that attempts to prove the technology for such a paradigm exists and is accessible by modern developers today to create truly immersive multi-user experiences with standard off-the-shelf hardware and open-source web software tooling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4eWOTzKKkrjdEWGnvEAm9g.jpeg" /><figcaption>The VR headset allows an adult user to see the same scene updated in real-time with additional detail and enhanced data overlays.</figcaption></figure><p>The “Peeps on the Bus” game concept was inspired by my daughter who plays a similar game on her own to pick up and drop off little wooden people in a school bus. The bulk of technical work for this project was not the game itself, but the infrastructure and tooling to allow such a game to exist. This work is intended to serve as a foundation for other developers to create their own projects that make use of the Magic Matta platform. In other words, Peeps on the Bus, is just the first “app” for Magic Matta and I hope to make (and inspire others to make) many more.</p><h3>How does it work?</h3><p>At its core, Magic Matta uses the SteamVR Lighthouse tracking system and HTC Vive Trackers to track the location and pose of up to 16 toys or other input devices. A PC connected to the HTC Vive runs a server to broadcast the location of these devices as well as game state to one or more clients that can display the scene from different viewpoints. One of the display clients is a laptop connected to a projector mounted above and pointing straight down on a white reflective carpet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*EkS5V0R2a1u9Fy_QEtIgWA.png" /><figcaption>A simplified architecture diagram of Magic Matta</figcaption></figure><p>The setup enables the carpet to “magically” respond to the movement of the toys shown through environmental lighting effects and interaction with the game using visual guides superimposed on and around the toys.</p><p>A once static toy now has interactive lights, sound* and reactivity to a game scene without requiring the child to wear any hardware. Other players can join using more advanced VR or AR headsets, or just pull out their phone and use their browser to experience the same game scene. (*Ok I haven’t implemented sound yet, but it’s coming soon!)</p><h3>How did people react to it?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ym0J2UCAyRFV6aWaNgMVIA.jpeg" /><figcaption>A user is surprised to see the bus and scene elements rendered in VR 1:1 with reality, but not her hands.</figcaption></figure><p>I appreciated Gray Area’s ability to bring a new audience to my work who provided amazing feedback — sometimes directly and sometimes just by observing how they interacted with the scene.</p><p>I heard a lot of “wow” moments when people picked up the bus and saw the reaction to the scene on the floor, and sometimes then again when they looked at the same scene through the headset with the corresponding movement from the bus and virtual objects.</p><p>Kids took to the scene more quickly than adults, but credit is due to some adults who got it right away and knelt or sat on the ground and started pushing the bus along the visual guides from the game as intended.</p><p>My favorite user testing was with my daughter Avery who inspired the project in the first place. She was able to figure out the game with minimal prompting and her points of confusion (as well as others) are great guides for improving the experience in the future.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVM6PIuk1Zx0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVM6PIuk1Zx0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FVM6PIuk1Zx0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/08ca5f48c12966515a1a9f2837fa1ed9/href">https://medium.com/media/08ca5f48c12966515a1a9f2837fa1ed9/href</a></iframe><h3>Showcase Challenges</h3><p>The biggest challenge on day 1 of the show was visible lag from using the venue-provided WiFi for broadcasting the server object locations to client viewer computers including the projector. When the highest congestion time of the night came, the venue provided WiFi became overly congested and the project was not useable for up to an hour. We set up a separate router for the next day and that worked much better, even during peak attendance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1KxKy1U8HXUD1q-NnuMiWg.jpeg" /><figcaption>VIP-style stanchions restricted the play area to just 1 or 2 people at a time to prevent the tracking sensors from being blocked and interrupting the game. This is a limitation of Steam Lighthouse v1 and the Vive Tracker v1 used in this exhibit.</figcaption></figure><p>The exhibit is complicated to set up. It requires 3 simultaneously running computers: 1 PC running the Vive VR headset and accompanying base stations, 2 laptops, a projector connected to one of the laptops mounted on the ceiling pointing down at the floor at a nice right angle to prevent distortion, proper calibration of the playing field and projector, isolated WiFi router that also has a connection to the Internet, custom mounting of HTC Vive trackers to one or more toy controllers, and of course a carpet. (<a href="https://github.com/kfarr/magic-matta">There is also a fair amount of software setup. A more complete explanation of how to set this up yourself can be found in the Github repo.</a>)</p><p>When something goes wrong with one component of the setup, it cascades to make the entire experience unusable. Having a quick logo screen to tab over to during downtime helped make the piece look more professional even when things weren’t working as expected.</p><p>There were many other complicated technical issues developing the project itself which is beyond the scope of this article, but I look forward to writing more about the software side in a future post and as part of the repo docs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AmHOIDMHBEO0kS6W2Pm6EA.jpeg" /><figcaption>Down to the wire! Here I am deep in the shadows trying to make a last-minute change during the show.</figcaption></figure><h3>Was it worth it?</h3><p>Yes, definitely! Joining the Gray Area Incubator absolutely made it possible for me to complete an immersive art piece and get it in front of an audience.</p><p>It was hard. I only had only 1 or 2 nights available each week during the 6-month incubator period as I had a full time job, a wife and young daughter. There were many nights that I didn’t want to leave the house to go to the incubator workspace after a full day of work and family time. If I made the effort to get there, I forced myself to at least commit one line of code to the repo that night.</p><p>Much of my productivity was in the last month of the program, especially the very last week leading up to the showcase (highlighted in red below):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V7Dj7A5RGDMbeOKT" /></figure><p>I planned ahead wisely to take a few days of work during the final week and it turned out to be crucial to getting everything shipped in time.</p><p>It took tons of time. Well over 100 hours over the 6 months, and honestly from time that I didn’t think I had available. My wife did get annoyed at my lack of availability in the last week or so.</p><p>Even so, the final project fell short of my expectations. I had expected to be further along in core game design elements including a multiplayer component and additional polish such as sound effects and more effective UI guidance.</p><h3>What is next for Magic Matta?</h3><p>The next milestone is to get the core <a href="https://github.com/kfarr/magic-matta">Magic Matta repo</a> in a reasonable state for a stranger with web development and VR experience to be able to deploy this project on their own. It’s technically there, but needs updated and expanded documentation as well as visual and video guides for setup and calibration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*btzsrQ5-yYyV4pQddwcSFw.jpeg" /><figcaption>More tracked toys?</figcaption></figure><p>Then I’d like to add polish to the “Peeps on the Bus” minigame to have a more engaging multiplayer component and then seek out feedback from more users my daughter’s age as well as educators and game designers, and perhaps reaching out to complementary or overlapping projects like Dynamicland (@dynamicland1) or Tilt Five (@tiltfive).</p><p>Please contact me if you have any ideas or interest in the project! I’m @kfarr on Twitter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37df8f5d8aa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: “BabyPi” Step-by-Step Building Guide and Parts List]]></title>
            <link>https://medium.com/@kfarr/part-2-babypi-step-by-step-building-guide-and-parts-list-ba746fe10537?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba746fe10537</guid>
            <category><![CDATA[toys]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[baby]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Mon, 31 Dec 2018 04:47:39 GMT</pubDate>
            <atom:updated>2018-12-31T17:27:59.033Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a step-by-step guide to build your own BabyPi computer for a toy to teach basic typing, letters and numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*SxYjBAWpaeJKxQ9fKB8FhA.gif" /></figure><p><strong>(You can read more about the “why” behind making the BabyPi here in </strong><a href="https://medium.com/p/396fa323c9e1/"><strong>Part 1: “BabyPi,” a simple Raspberry Pi powered toy computer for kids.</strong></a><strong>)</strong></p><p>Or continue on below for simple instructions to make your own.</p><p>This takes about 2 hours and supplies cost at least $65 to $350 and up depending on how much you use existing peripherals like a keyboard and screen, or splurge on new components.</p><h3>List of Parts</h3><p>Depending on what parts you might have lying around, you make a BabyPi for as little as $65 if you use an existing keyboard and monitor. If you want an all-in-one touch-screen case or other goodies it will cost you a bit more. Here are 3 configurations:</p><ul><li><strong>$64.67 Basic</strong>: Raspberry Pi and basics including case (BYO USB Keyboard and HDMI Screen)</li><li><strong>$165.69 Fancy</strong>: Touchpad screen all-in-one Pi case (BYO USB keyboard)</li><li><strong>$345.68 Ultra fancy:</strong> Touchpad all-in-one with fancy RGB gaming keyboard (All new parts)</li></ul><h4>Basic Parts List</h4><p>Raspberry Pi minimum needed to operate and case. No screen, no keyboard, bring your own USB Keyboard and HDMI Screen.</p><p><strong>$34.74 </strong>Raspberry Pi 3 Model B Motherboard:</p><p><a href="https://www.amazon.com/gp/product/B01CD5VC92/">Raspberry Pi 3 Model B Motherboard</a></p><p><strong>$9.99</strong> CanaKit 5V 2.5A Raspberry Pi 3 Power Supply / Adapter / Charger</p><p><a href="https://www.amazon.com/gp/product/B00MARDJZ4/">CanaKit 5V 2.5A Raspberry Pi 3 B+ Power Supply / Adapter (UL Listed)</a></p><p><strong>$12.99 </strong>Samsung 32GB 95MB/s (U1) MicroSD EVO Select Memory Card with Adapter (MB-ME32GA/AM)</p><p><a href="https://www.amazon.com/gp/product/B06XWN9Q99/">Samsung 32GB 95MB/s (U1) MicroSD EVO Select Memory Card with Adapter (MB-ME32GA/AM)</a></p><p><strong>$6.95 </strong>Basic Case (KuGi Raspberry Pi 3 Model B case)</p><p><a href="https://www.amazon.com/Raspberry-Model-Protective-Heatsinks-Clear/dp/B01CDVSBPO/">KuGi Raspberry Pi 3 Model B case PC Protective Case with 2x Heatsinks for Raspberry Pi 3 Model B+ ,Raspberry Pi 3 Model B, Pi 2 Model B &amp; Pi Model B+ (Clear)</a></p><h4>Fancy Parts List</h4><p>For the all-in-one-touch Pi computer. Purchase all the above (but skip the case) and add these below to your shopping cart:</p><p><strong>$69.99</strong> Raspberry Pi 7&quot; Touchscreen Display:</p><p><a href="https://www.amazon.com/gp/product/B0153R2A9I/">Raspberry Pi 7&quot; Touchscreen Display</a></p><p><strong>$27.99</strong> Case for the Official Raspberry Pi 7&quot; Touchscreen Display: This is an all-in-one case for both the Raspberry Pi and the touch screen display from above. No need to order the standalone Pi case if you choose this option.</p><p><a href="https://www.amazon.com/Case-Official-Raspberry-Touchscreen-Display/dp/B01HKWAJ6K/">https://www.amazon.com/Case-Official-Raspberry-Touchscreen-Display/dp/B01HKWAJ6K</a>/</p><p><strong>$9.99 </strong>SmartiPi Touch back HAT cover — 37mm deep (You can get a more shallow back cover, but this deeper 3.7cm version is big enough to mount a USB battery inside the case for cord-free computing or hide the ferrite core from the power cable.)</p><p><a href="https://www.amazon.com/gp/product/B072M1YSQD/">https://www.amazon.com/gp/product/B072M1YSQD/</a></p><h4>Ultra Fancy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*kyR4f9eXxxdopbB0J-t1mg.gif" /></figure><p><strong>$179.99</strong> Optional, but recommended, an RGB keyboard with individually programmable keys helps both guide the user through the desired “safe” keys and sometimes offers interactive feedback through a fading effect from the pressed keys. For this project I used a worn Steel Series gaming keyboard with a few keys missing.</p><p><a href="https://www.amazon.com/SteelSeries-Mechanical-Gaming-Keyboard-Backlit/dp/B00SB6DO6M">https://www.amazon.com/SteelSeries-Mechanical-Gaming-Keyboard-Backlit/dp/B00SB6DO6M</a></p><h3>Assembly</h3><p>We’ll start with (1) Hardware, then (2) OS, (3) Kiosk Mode and (4) Application.</p><h4>Step 1. Hardware (15–30 minutes)</h4><p>The best instructions for the case and screen assembly are this YouTube video. Make sure subtitles are turned on so you can see the instructions. <a href="https://www.youtube.com/watch?v=XKVd5638T_8">https://www.youtube.com/watch?v=XKVd5638T_8</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXKVd5638T_8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXKVd5638T_8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXKVd5638T_8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eaacd279f8745cd2941c31ac78c6905/href">https://medium.com/media/0eaacd279f8745cd2941c31ac78c6905/href</a></iframe><p>Here my build is almost complete, just a final step to tidy the power cords:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H_obUXZ6RVw2B0t6YAwTUw.jpeg" /></figure><p>In the parts list I recommended a larger back cover (you can see it in the background of the picture above). You can use this back cover to insert the power splitter to make it more difficult for young hands to remove the power plugs.</p><p>Note: Before putting on the cover, you’ll want to do the first few steps of the next section (preparing the OS) since it’s impossible to access the SD card slot once you put the back cover on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnRmTn3VKg15qES_RCUYww.jpeg" /><figcaption>Careful placement of the USB power splitter and ferrite core allow you to hide it behind the rear case.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MpbdS3ou6RbXUxzQ5BfYTQ.jpeg" /><figcaption>Now there’s only one cord coming out of the back and the rest are hidden under the base.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otk2qRjVGd2xiJSBk1zMKg.jpeg" /><figcaption>Now the BabyPi hardware is ready for some pretty intense baby abuse!</figcaption></figure><h4>Step 2. Software — OS (30–45 mins)</h4><p>This guide written for NOOBS 3.0 (Release 2018–11–16). Most of it is taken from following <a href="https://www.raspberrypi.org/learning/software-guide/">this great getting started guide from Raspberry Pi themselves</a>.</p><ol><li>First, download the newest version of noobs and start fresh install from <a href="https://www.raspberrypi.org/downloads/">raspberrypi.org/downloads</a>. I chose to download “Offline and network install.”</li><li>Install the OS onto SD Card, detailed instructions here: <a href="https://www.raspberrypi.org/learning/software-guide/quickstart/">raspberrypi.org/learning/software-guide/quickstart</a></li><li>Put the SD card into Raspberry Pi and boot</li><li>Select “Raspbian Full” &gt; Install</li><li>Choose keyboard and language settings</li><li>Set a new password</li><li>Choose your WiFi settings and login to wifi</li><li>Check for updates</li><li>Reboot</li><li>Try loading the browser from the desktop after booting, navigate to “<a href="http://babypi.glitch.me/">babypi.glitch.me</a>”</li><li>Congrats, now you have a self-contained, all-in-one networked Raspberry Pi with touch screen! You can use it as-is now, or you can continue for how to configure the Raspberry Pi to auto-boot into BabyPi.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KV-YIFoncSEmM_QIDNbWdA.jpeg" /><figcaption>Installing Raspian, keyboard unplugged to prevent unwanted baby input during installation.</figcaption></figure><h4>Step 3. Software — Booting into Kiosk Mode (15–30 mins)</h4><ol><li>First, you’re going to need remote access. True Kiosk mode means we’ll try to make it difficult if not impossible to access the device configuration physically from the device itself.</li><li>Enable remote SSH access by clicking on the Raspberry Pi logo in the upper-left hand corner, then Preferences &gt; Raspberry Pi Configuration &gt; Interfaces &gt; SSH &gt; Enabled (more info: <a href="https://www.raspberrypi.org/documentation/remote-access/ssh/unix.md">https://www.raspberrypi.org/documentation/remote-access/ssh/unix.md</a>)</li><li>You’ll connect via SSH from your Mac or PC, and there are two options to connect:<br>(a) The “old fashioned” way to connect remotely to your Pi is through the Raspberry Pi’s IP (V4) address, one set automatically through DHCP or <a href="https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/">statically through manual configuration</a>.<br>(b) Or, you can use a local hostname. This is cool, and it’s enabled by default on Mac OS devices. To enable it on Windows PCs you’ll need to enable support for “zeroconf” / Avahi. The easiest way to do this is to simply install <a href="https://support.apple.com/kb/DL999?locale=en_US">Apple’s Bonjour Printer services for Windows</a> or iTunes (yucky). <a href="https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux/overview">See this documentation for more information</a>.</li><li>By default the local hostname is raspberrypi so you can connect from a Mac OS terminal on the same network by simply typing:<br>ssh pi@raspberrypi.local</li><li>Next we want to setup “Kiosk Mode” so that the Raspberry Pi auto boots into Chromium running the BabyPi website app.</li><li>First, we’ll need to copy the autostart default script from the root user into the “pi” user that is used to login by default. (<a href="https://raspberrypi.stackexchange.com/questions/40631/setting-up-a-kiosk-with-chromium/40745">Per this Stackoverflow ticket</a>.)</li><li>While you’re connected remotely through ssh per above instructions, or using the local terminal on the Pi, type:<br>mkdir -p &quot;/home/pi/.config/lxsession/LXDE-pi/&quot;</li><li>Then type (all one command, despite Medium’s dumb code formatting) cp /etc/xdg/lxsession/LXDE-pi/autostart /home/pi/.config/lxsession/LXDE-pi/autostart</li><li>Use your favorite text editor to edit the file, such as vi /home/pi/.config/lxsession/LXDE-pi/autostart and add the line: @chromium-browser --incognito --kiosk https://babypi.glitch.me</li><li>The modified autostart file should now read:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/663dbd1cffab05038d42be82c21e4e30/href">https://medium.com/media/663dbd1cffab05038d42be82c21e4e30/href</a></iframe><p>Now when you plugin the Pi it should autoboot into the BabyPi app. Here’s what it looks like from boot to app in about 45 seconds:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fj7w2fDzuL-w%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dj7w2fDzuL-w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fj7w2fDzuL-w%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e5b374ebd403f6dca24ac39711e5a0d/href">https://medium.com/media/6e5b374ebd403f6dca24ac39711e5a0d/href</a></iframe><h4>Step 4. Software — BabyPi App (0 minutes)</h4><p>You don’t need to do anything here as the above boot sequence launches the app, but you can feel free to modify the actual BabyPi app in any way you want, from simple changes like a new color scheme to more advanced features. The source code is available here: <a href="http://glitch.com/~babypi">https://glitch.com/~babypi</a>. A more detailed <a href="https://medium.com/p/396fa323c9e1/">writeup of the app can be found in Part 1 of this writeup</a>.</p><h3>Using the BabyPi</h3><p>Here are some “BabyPi” games I’ve played together with my daughter:</p><ul><li><strong>Find the Letter</strong> — Say a letter and she finds and presses it on the keyboard.</li><li><strong>Out Loud</strong> — whatever letter she presses I say out loud.</li><li><strong>Draw Picture</strong> — Draw something related to the letter! Show your artistic flair by drawing an Apple, Bear or Cat.</li><li><strong>Draw Letter </strong>— Practice drawing the letter by hand, start with uppercase and then add lowercase.</li><li><strong>Alphabet </strong>— Sing the alphabet song together and I type each letter as we go through the song. Same with numbers, sans the song.</li><li><strong>Pwn the Pi </strong>— advanced users only, break out of kiosk mode.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyhLrDaLTmwEz-G5qWxfTg.jpeg" /></figure><h3>Improving the BabyPi</h3><p>This app just scratches the surface of what I think is possible for (tiny) human-oriented design with the Raspberry Pi. Here are some more advanced things you can do and suggestions for future features:</p><ul><li><strong>Reactive Keys</strong>: With the SteelSeries keyboard I used it has a nice feature for highlighting the key that was recently pressed. Although awful for security when entering passwords, it is fun for this use case. If these keyboard makers made more open APIs for modifying the lighting settings you could imagine cool things like highlighting one key at a time or reacting more clearly to “correct” key presses.</li><li><strong>Advanced Kiosk Mode</strong>: You can go deep down the rabbit hole of creating a locked down Pi Kiosk, such as disabling function keys, disabling power management (preventing screen shut off), restricting accessible sites via DNS, etc. This is a nice writeup of more advanced Pi Kiosk configurations: <a href="https://gist.github.com/jongrover/6831346">https://gist.github.com/jongrover/6831346</a>. If you want to get really crazy you can dive deep into Linux internals to customize the boot logo, hide boot console output, etc. to make it a really smooth boot sequence a la Apple.</li><li><strong>Fix the drawing container sizing</strong>: The green drawing feature is sized for the RaspberryPi touch screen but doesn’t allow drawing on the full page for larger sized displays. Please feel free to help fix that if you’re handy at CSS. (<a href="https://glitch.com/~babypi">Simply “remix” the Glitch project here.</a>)</li><li><strong>Offline</strong>: There’s really no reason to have the BabyPi connected to the Internet, it was simply helpful during development to quickly prototype. You could easily make an offline version.</li><li><strong>More “games”</strong>: The possibilities are endless — counting, teaching basic addition, a screensaver that goes through the alphabet, guidelines for learning handwriting, etc. My brother suggested the ability to start typing longer words after pressing enter. What suggestions do you have?</li><li><strong>Battery</strong>: There are a number of battery options for the Pi, from integrated “hats” like the PiJuice to simply using a USB battery pack hidden inside the large case recommended above.</li><li><strong>Cases</strong>: A friend came up with an idea to create a custom wooden case with an embedded keyboard. With an integrated battery this could a super cool truly self-contained version.</li></ul><h3>Reception: Did the baby like it?</h3><p>I finished this project about a year ago when my daughter turned 1, and it has been sitting in the toy corner in the same place since then, always plugged in. (I kept the default power settings on, so the screen turns off after a few minutes but the keyboard still glows a beckoning purple all the time.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OHP5E7SrfmC8NfsEbfXrCQ.jpeg" /><figcaption>BabyPi at home with other baby and toddler toys</figcaption></figure><p>My daughter plays with it about once a week on average, similar to other toys strewn about. Sometimes for just a minute, sometimes longer. Sometimes on her own, sometimes prompted by me.</p><p>It’s no more special than the record player, blocks or toy cars, and that’s the point — my goal with the BabyPi was to create a “toy” that could sit right next to other baby and toddler toys.</p><p>Now that she’s 2 she is advancing surprisingly well with the alphabet. When we play the “Find the Letter” game she can quickly find a handful of her favorite letters (A for her name, B for bus, D for Dadda, M for Mamma, etc.). I can’t say that BabyPi was any sort of genius-making device, but it definitely contributed toward her having fun learning letters and the QWERTY layout at the same time. Yay!</p><h3>Share Your Build!</h3><p>I’d love to see how people use these instructions to make their own BabyPi. Please share your Raspberry Pi build on Twitter (@kfarr) and your ideas for improvements or simply retweet the below to share the project with others!</p><h3>Kieran Farr on Twitter</h3><p>Behold the #BabyPi! A fun little DIY project for little people to learn letters and numbers powered by the @Raspberry_Pi. Here&#39;s a writeup with step-by-step instructions to build your own, including source code posted on @glitch to remix and modify: https://t.co/s2eZ0WhN3R https://t.co/x1zlzjdcSn</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba746fe10537" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: “BabyPi,” a simple Raspberry Pi powered toy computer for kids.]]></title>
            <link>https://medium.com/@kfarr/part-1-babypi-a-simple-raspberry-pi-powered-toy-computer-for-kids-396fa323c9e1?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/396fa323c9e1</guid>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[baby]]></category>
            <category><![CDATA[toys]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Mon, 31 Dec 2018 04:46:25 GMT</pubDate>
            <atom:updated>2018-12-31T04:57:13.218Z</atom:updated>
            <content:encoded><![CDATA[<p>Introducing the BabyPi — a simple way to teach letters of the alphabet, numbers and basic drawing for learners of all ages running on the low cost and open Raspberry Pi platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p-RXjlGRlDRjup8RgJtrbQ.jpeg" /><figcaption>A picture of the finished product (flower drawing not included, you’ll need to provide your own drawing skills)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QtVlT9BbzEVAn02oXVRMWA.gif" /><figcaption>BabyPi can be a fun instructional tool for any age learner, in this example we show teaching lowercase letters.</figcaption></figure><p>This is what we’re making, a Raspberry Pi based kids toy that I’ve nicknamed the “Baby Pi.”</p><p>This takes about 2 hours and supplies cost at least $65 to $350 and up depending on how much you use existing peripherals like a keyboard and screen, or splurge on new components.</p><p><strong>If you’re ready to start building now and don’t care about the background or motivation of the project, </strong><a href="https://medium.com/p/ba746fe10537/"><strong>jump ahead to Part 2 — Build a BabyPi Step-by-Step Guide and Parts List</strong></a><strong>.</strong> Or continue reading below for more on why I created this project in the first place.</p><h3><strong>Project Background and Motivation</strong></h3><p>Since the birth of our daughter two years ago I’ve been revisiting many parts of my childhood including fond memories of our first family computer. When I was just a few years old (way back in the ’80s) my dad brought home our first computer, a Commodore 64.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*-7QDsz0kWfiRd4ML9vOKow.png" /><figcaption>Early Games Commodore 64 title screen (<a href="http://www.mobygames.com/game/c64/early-games-for-young-children">source</a>)</figcaption></figure><p>My memories of the system include playing a simple set of mini-games made for kids called <a href="https://en.wikipedia.org/wiki/Early_Games"><em>Early Games</em></a>. It was one of my formative memories of first using a computer and the simple exercises helped introduce me to computing from an early age.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*H3fcFgXSqk_r85xsCuhHOQ.png" /><figcaption>An example of a “puzzle” in <em>Early Games</em> for C64 (Answer: F)</figcaption></figure><p>There wasn’t much you could do with Early Games, but that was kind of the point. It had a very simple interface and its “games” were more like typing letters of the alphabet, answering basic arithmetic questions, and even simplistic drawing with the keyboard as some sort of digital etch-a-sketch.</p><p>Of course, like everyone, our daughter is attracted to the siren call of smartphones and is naturally intrigued by my laptop when I use it in her presence. As an alternative to more passive mobile games I wanted to create a more positive computing experience like I had when growing up with the Commodore 64 and <em>Early Games</em>. That was the motivation behind BabyPi.</p><h3>Creative Brief: What are we making?</h3><p>I set out to create a simple experience to learn letters and numbers and using a keyboard in a package that’s easy to use for truly all ages even 1-year-olds! Some ideal requirements:</p><ul><li><strong>Easy to use </strong>— anyone including a baby should be able to just “use it”. No menu, no written instructions.</li><li><strong>All inclusive hardware</strong> — It should be self-contained and packaged safely for children.</li><li><strong>Open source</strong> — Hardware and software should be freely replicable</li><li><strong>Easy to make </strong>— even non-geeks should be able to put this together with basic instructions</li><li><strong>Low cost </strong>— this should be cheaper than an iPad but shouldn’t be too much more expensive than a regular toy of similar capabilities</li></ul><h3>The Competition</h3><p>What toys are out there already, competing for her attention at home, daycare or friends places? I looked for inspiration in what she was already playing with — games like <a href="https://www.amazon.com/Playskool-Play-Favorites-Busy-Poppin/dp/B00DSIQS6G">Busy Poppin Pals</a> or this farm game at Grandma’s house where you get quick reactions to tactile input like figurines popping up or a cow mooing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*wk732tN10bybm5TsbYXXvw.png" /><figcaption>The competition, from upper-left moving clockwise: <a href="https://www.youtube.com/watch?v=Mt-ukNJqOvg">Busy Poppin Pals Sesame Street 1988</a>, Busy Poppin Pals 2018 Era, Fisher Price Cash Register Toy, <a href="https://www.amazon.com/Chicco-Interactive-Bilingual-Talking-Spanish/dp/B0002HNLWK">Chicco Interactive Talking Farm</a></figcaption></figure><h3>Researching the Technology Solution Set</h3><p>I started out by looking at what solutions already exist and how I might be able to assemble this from pre-built components.</p><h4>Software</h4><p>On the software side, I searched for a more recent equivalent of <em>Early Games</em> for PC or Mac and the closest I found was an <a href="https://github.com/shanselman/babysmash/">open-source</a> game <a href="http://www.hanselman.com/babysmash/">BabySmash</a> for PC (<a href="https://www.youtube.com/watch?v=WutB3KlO34A">lovely video of a satisfied user</a>). For mobile devices running iOS or Android there were a bunch of apps advertised for very young children, but dishearteningly most had in-app ads which is a nonstarter for young kids.</p><p>I decided to create my own app.</p><h4>Hardware</h4><p>On the hardware side I wanted to package this experience in a “computer” of her own similar to the simplicity Commodore 64, or perhaps even easier! That way she could have her own “toy computer” so when she tries to use my laptop I can redirect her to this one instead. I looked around for different options but quickly found that Raspberry Pi to be the best for my needs, also inspired by my friend Brendan Nee’s creation of a <a href="https://blog.bn.ee/2013/01/11/building-a-real-time-transit-information-kiosk-with-raspberry-pi/">Raspberry Pi powered real-time transit information kiosk</a>.</p><p>This project uses the same technique running Chromium on a Raspberry Pi in “kiosk mode” (removing browser and OS UI elements) to launch a simple website running a JavaScript application which is the heart of the experience.</p><h3>Kids and Tech Considerations</h3><p>Kids put things in their mouth and keyboards have small parts so they could suffocate or get electrocuted from this stuff, so please be a responsible parent.</p><p>What about screens? They’re embedded as part of our daily lives so it’s not a long-term option to prevent kids from using them forever. I hope with projects like these we can at least guide kids toward positive computer and screen behavior.</p><p>I think there are 2 core issues with so called “screen time” for kids: (1) the effect of the physical screen on their eyes — <a href="https://keck.usc.edu/too-much-screen-time-is-raising-rate-of-childhood-myopia/">screen time may cause or worsen myopia</a>, and (2) the effect of the content shown on the screen.</p><p>I think the effects caused by the content (2) are very powerful and when accumulated over time are impactful at life changing levels for task performance in daily life. My simplistic view of “screen time” divides its use cases into two buckets:</p><ul><li>“<strong>Captive</strong>”: watching, browsing, passive, following, directed, captivation — We seem to have infinite capacity for this. Gratification is immediate and generally constant after that, kids get mad when you stop their videos mid-stream.</li><li>“<strong>Creative</strong>”: making, taking action, seeing reaction, interact and create — We have a limited capacity for this. Gratification is delayed, slowly building with challenges and achievements ebbing and flowing with the activity.</li></ul><p>The rule of thumb is pretty obvious — being in the Creative is zone is generally good and try to avoid captive screen time. Easy to say, hard to do for even myself (reddit can be addictive!), but so far it has been easier with our daughter to avoid screens with the notable exception of cross country flights where captivation is the precise goal.</p><p>As a kid my fondest experiences of screen time were creative games that offered track and world creation features like <a href="https://en.wikipedia.org/wiki/Racing_Destruction_Set">Racing Destruction Set</a> on C64 or <a href="https://en.wikipedia.org/wiki/Stunts_(video_game)">Stunts</a> on IBM/PC. I spent countless hours coming up with the craziest “maze” tracks and stretching the boundaries of the built-in physics systems.</p><h3>Writing the BabyPi App</h3><p>The platform for this project is Raspberry Pi which promotes Python as one of its primary languages for learning. I’ve used Python as a server-side language and I could have fiddled around with some Python graphic libraries to make this, but I think the web is much simpler for interactive visual applications and we can simply run Chromium in kiosk mode and point it to any web page, so let’s do that instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QIGwlpdVhsG7Onz2E808A.jpeg" /><figcaption>Early user testing showed that displaying function key values was confusing.</figcaption></figure><p>The implementation was quite simple, a simple press of a button on the keyboard makes it show up on the screen. The letters are large and centered on the screen, capitalizing the letter and omitting key presses from non-alphanumeric function keys.</p><p>I used Glitch.com, an interactive code editor to make this project. You can <a href="https://glitch.com/edit/#!/babypi?path=index.html:222:0">check out the code right here right now</a> but I’ve also pasted it below as I explain the basic inner-workings.</p><p>It’s super simple, first there’s a place to display the letters which defaults to a keyboard emoji (⌨)when it first loads:</p><pre>&lt;div class=”container”&gt;<br>  &lt;span id=”letter” class=”text”&gt;⌨&lt;/span&gt; <br>&lt;/div&gt;</pre><p>Then the real magic are these few lines of code that update the letter when a key is pressed. The vanilla JavaScript is quite readable and I’ve included a few comments to explain additional logic:</p><pre>&lt;script&gt;<br>  window.addEventListener(&quot;keydown&quot;, function (event) {<br>    if (event.defaultPrevented) {<br>      return; // Do nothing if the event was already processed<br>    }<br>    // don&#39;t show funny key values like &quot;Alt&quot; or &quot;CapsLock&quot;<br>    if (event.key.length == 1) {<br>      var newLetter = event.key.toUpperCase();<br>      var oldLetter = document.querySelector(&quot;#letter&quot;).innerHTML;<br>      // only change letter and clear drawing canvas if new letter typed<br>      if (oldLetter !== newLetter) {<br>        document.querySelector(&quot;#letter&quot;).innerHTML = newLetter;<br>        clearCanvas(canvas,ctx);<br>      } <br>    }<br>    // Cancel the default action to avoid it being handled twice<br>    event.preventDefault();<br>  }, true);<br>&lt;/script&gt;</pre><p>That’s it, really! And here’s some CSS code to make it look ok:</p><pre>.container {<br>    text-align: center;<br>}<br>body {<br>  background-color: black;<br>  overflow:hidden;<br>}<br>.text {<br>  color: fuchsia;<br>  font-size: 80vmin;<br>  margin: 0;<br>  padding: 0;<br>  font-family: monospace;<br>}<br>canvas {<br>  position:fixed; top:0;left:0;<br>}</pre><p>I also added a basic drawing feature based off <a href="https://zipso.net/a-simple-touchscreen-sketchpad-using-javascript-and-html5/">an example app</a> I found with a quick Google search. That code is a bit long to paste here but you can <a href="https://glitch.com/edit/#!/babypi?path=index.html:5:0">take a look in the Glitch source code instead</a>.</p><p>So what does it do? Here’s a video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqewAsyteYeo&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqewAsyteYeo%3Ffeature%3Doembed&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b878a867ea223b140daf693525fef0c/href">https://medium.com/media/8b878a867ea223b140daf693525fef0c/href</a></iframe><p><strong>Ready to build your own? Continue to </strong><a href="https://medium.com/p/ba746fe10537/"><strong>Part 2: “BabyPi” Step-by-Step Building Guide and Parts List.</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sb9-Pm-Dvt5VEeZBLOb45Q.jpeg" /><figcaption>BabyPi is best served with your favorite pastry from a local cafe.</figcaption></figure><p>Or, you can use BabyPi right now without any new hardware! It’s good in a pickle when you’re on the go with your little loved one and need a distraction.</p><p>You can use BabyPi anytime, just go to <a href="https://babypi.glitch.me/">babypi.glitch.me</a> and enter fullscreen using your favorite browser.</p><p><a href="https://medium.com/p/ba746fe10537/">Continue to Part 2&gt;&gt;</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=396fa323c9e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decentraland as a Playground for Crypto-Collectibles]]></title>
            <link>https://medium.com/decentraland/cryptocollectibles-decentraland-and-you-130676002015?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/130676002015</guid>
            <category><![CDATA[english]]></category>
            <category><![CDATA[platform]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[cryptokitties]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Wed, 13 Dec 2017 08:08:39 GMT</pubDate>
            <atom:updated>2018-06-14T19:20:05.324Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>From crypto-pets to Rare Pepes, the possibilities are endless.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vIXuCx6qUt6js1rT1tSzXA.jpeg" /><figcaption>A rendering of a 3D prototype of a CryptoPet</figcaption></figure><p>As we prepare for the conclusion of our <a href="https://auction.decentraland.org/">Land Auction</a>, many in the community have turned their focus towards development. For example, each Decentraland District is targeting a specific interest or activity. Large blockchain projects (<a href="https://blog.decentraland.org/huobi-bigone-okex-exchange-union-hitbtc-join-the-terraform-event-to-build-virtual-trading-f9299841d0e3">such as major exchanges</a>) have also participated, with plans to develop new experiences within Decentraland.</p><p>Today, we’d like to cover a development possibility that will have major ramifications: <strong>crypto-collectibles</strong>. But before you start using Decentraland to breed virtual Ethereum cats, let’s take a look at the impact crypto-collectibles could have.</p><h3><strong>A Beginners Guide to Crypto-Collectibles</strong></h3><p>Before we get carried away, let’s review what a <strong>crypto-collectible </strong>is:</p><blockquote>A crypto-collectible is a <strong>cryptographically unique, non-fungible digital asset</strong>. Unlike cryptocurrencies, which require all tokens to be identical, each crypto-collectible token is unique or limited in quantity.</blockquote><blockquote>Typically, crypto-collectibles are visualized as real-life objects such as pets or avatars. Each token has variations in specific attributes and there are limits to the number of tokens that can be generated. Often, additional logic in the form of Ethereum smart contracts enables interaction between tokens such as breeding new unique tokens.</blockquote><h4><strong>Implementation</strong></h4><p>Newer crypto-collectibles use the Ethereum <a href="https://github.com/ethereum/EIPs/issues/721">ERC-721 Non-fungible Token Standard</a> which enforces uniqueness, while older crypto-collectibles use the <a href="https://github.com/ethereum/EIPs/issues/20">ERC-20 Token Standard</a> with a custom Ethereum smart contract to enforce uniqueness. Some tokens use custom Bitcoin implementations, hybrid off-chain algorithms, or hybrid centralized databases.</p><h4><strong>Breakout Star</strong></h4><p>The most (in)famous crypto-collectible is, without a doubt, the <strong>CryptoKitty</strong>. Within a few weeks, CryptoKitties hit over <a href="https://cointelegraph.com/news/cryptokitties-sales-hit-12-million-could-be-ethereums-killer-app-after-all">$12 million</a> in sales, accounting for <a href="https://blockonomi.com/cryptokitties/#Crypto-Collectibles_Are_The_Next_Big_Thing">14%</a> of Ethereum’s transaction volumes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/0*j2TGdVreaNW67ooK." /></figure><h4><strong>Why Crypto-Collectibles?</strong></h4><p>You may be asking yourself: What’s so special about digital crypto-kitties? Fair question. The answer is that crypto-kitties are just the beginning. The characteristics that make them “unique” can be applied to anything.</p><p>Crypto-collectibles have four primary characteristics:</p><ul><li><strong>Intrinsic </strong>— They’re cute (visual representation).</li><li><strong>Extrinsic </strong>— They can demonstrate status (rare attributes, high price).</li><li><strong>Utility </strong>—It’s possible to use them for various activities (card games, cat breeding).</li><li><strong>Trading </strong>— They are an asset that can fluctuate in price.</li></ul><h4><strong>Crypto-Collectibles &amp; Decentraland</strong></h4><p>The psychological and market drivers behind crypto-collectibles fit nicely with the concept of Decentraland’s persistent multi-user metaverse running on the blockchain.</p><ul><li><strong>Intrinsic </strong>— With Decentraland you can visualize and interact with your crypto-collectible in multiple dimensions, not just a 2D image. The ability to add a custom environment to match and the possibility for unlimited interactions is compelling for any crypto-collectible, and with Decentraland, the token administrators no longer need to create a custom app for this purpose. This saves money for collectible creators and owners, while adding more value to their users.</li><li><strong>Extrinsic </strong>— A multi-user VR environment is perfectly suited to display your crypto-collectible to other users in a complementary environment. You can flaunt your rare and pricey items, and, thanks to the blockchain, “genuine” collectibles can be indicated in the UI to call out the fakers — the ultimate nirvana in copy protection. Jump all the way down the rabbit hole by using your crypto-collectible as an avatar for your VR persona.</li><li><strong>Utility </strong>— Use collectibles for in-world games and activities. (For example, a Cryptopet&#39;s breeding effectiveness or rarity of its attributes could be improved by having more neighbors with similar or complementary collectibles.)</li><li><strong>Trading </strong>— Assets may be exhibited to potential buyers and sold right in your virtual land.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oDU4baXIG6V50YTKcuL1kQ.png" /><figcaption>A quick proof of concept of a 2D 8-bit CyberPunk extruded into 3D</figcaption></figure><h3><strong>The (Mostly) Complete Guide to Crypto-Collectibles</strong></h3><p>Which crypto-collectibles might be incorporated into Decentraland? Here’s a complete list of what you can (virtually) own <em>today </em>starting with the adorable crypto felines.</p><h4><a href="https://www.cryptokitties.co/"><strong>CryptoKitties</strong></a> (launched 23 November 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kO8ugqQ72uIS-seC4J58eg.png" /><figcaption>“Collectible. Breedable. Adorable. Collect and breed digital cats.”</figcaption></figure><p>Collectible unique (non-fungible) <a href="https://github.com/ethereum/EIPs/issues/721">ERC-721</a> tokens represented by cat avatars akin to virtual Beanie Babies or Pokemon cards. Each CryptoKittie represents a different non-fungible ERC-721 token on the Ethereum blockchain. Much of the game’s appeal comes from its breeding system and the unique offspring that can emerge. When two CryptoKitties breed, their offspring’s appearance, biography, and traits result from each parent’s 256-bit genome, leading to 4 billion possible genetic variations.</p><h4><a href="https://www.larvalabs.com/cryptopunks"><strong>CryptoPunks</strong> </a>(launched June 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rurv9aDY4AuuFRVKbQPdDw.png" /><figcaption>“10,000 unique collectible CryptoPunks with proof of ownership stored on the Ethereum blockchain.”</figcaption></figure><p>These 10,000 collectible characters rock an 8-bit sci-fi punk style represented by an <em>almost</em> compatible ERC-20 token running on the Ethereum blockchain. Variable attributes include Hair, Gender, Eyes, Facial Hair, Glasses, and Special Type.</p><h4><a href="https://mooncatrescue.com/"><strong>MoonCats</strong> </a>(launched August 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YynvhgKTch1vt4epu292BA.png" /><figcaption>“We are undertaking an Insanely Cute Operation to the moon to save the MoonCats from imminent danger, and we need your help. Are you ready to help?”</figcaption></figure><p>Move over CyptoKitties, the MoonCats are on the prowl! These 25,600 procedurally generated digital cats are managed by an Ethereum smart contract. Each unique visualizations is rendered in a dark 8-bit retro pixel art style. You can use your browser to mine for cats to “rescue” using an off-chain algorithm, the MD5 checksum of which is stored in an Ethereum smart contract. (A small gas fee in Ether is required to sign the contract to claim your mined MoonCats.)</p><h4><a href="https://mycuriocards.com/"><strong>CurioCards</strong></a><strong> </strong>(launched June 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SAFrTHUlXE6exDpm3GpD9w.png" /><figcaption>“With Curio Cards you can own rare and collectible digital artwork, and interact with it in amazing new ways, all built on proven blockchain technology.“</figcaption></figure><p>CurioCards are ERC-20 compatible Ethereum collectible tokens represented by a card image stored in IPFS. The tokens are ensured to be “limited in number and provably rare” through a smart contract that limits each card’s total supply (which may be 1 in extreme cases). Its mission is to create a platform for artists and collectors that “finally benefits artists.”</p><h4><a href="https://medium.com/@coin_and_peace/rarepepe-is-the-most-innovative-project-in-the-crypto-space-seriously-6d6b74749687"><strong>RarePepe Tokens</strong></a><strong> </strong>(launched 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*i3hrSH81psEI-YOC.jpg" /><figcaption>“Thanks to <strong>Bitcoin and Counterparty</strong> we can associate these Rare Pepes with tokens to make them<strong> truly rare.”</strong></figcaption></figure><p>User-generated Pepe memes are linked to specific tokens and get listed on the <a href="http://rarepepedirectory.com/">Rare Pepe Directory</a> after a thorough inspection by “Rare Pepe Scientists.” Token supply is limited, making them truly scarce (“rare”) digital Pepe assets.</p><h4><a href="https://www.cryptopets.co/"><strong>CryptoPets</strong></a><strong> </strong>(announced, not launched)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zyw-jpjN91DfgmIVB-nZcA.png" /><figcaption>“CryptoPets is a blockchain-based game for collecting, trading and raising your digital pets. All the affection of a real pet, but on the Blockchain.”</figcaption></figure><p>Variable attributes include: Species, Class, Visual (fur color, eye shape, paw, etc), RPG (Health, Attack, Defense, and Speed). CryptoPets claim to be limited in numbers and determined by class.</p><h4><a href="https://spellsofgenesis.com/"><strong>Spells of Genesis</strong></a> (Launched in 2015)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xA104nUuVf_zUAYj8hB2g.png" /><figcaption>“Spells of Genesis is a mobile game that is a mix of a trading card game (TCG), bringing in deck collection and strategy, along with arcade-style gaming aspects.”</figcaption></figure><p>A Mobile RPG/collectible card game for iOS and Android launched in 2015 with the token sale of “BitCrystals”, a Counterparty (XCP) cryptocurrency used as a means of in-game exchange for some game items. In December 2017, it announced its “blockchainization” to exchange in-game assets.</p><h4><a href="https://novablitz.com/"><strong>NovaBlitz</strong> </a>(Steam Game since July 2017, token sale Launched December 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*58G-Qrvs5gJCscKkxhmqRw.jpeg" /><figcaption>”The Nova Blitz real time trading card game is the first game to integrate the Nova Token platform.”</figcaption></figure><p>Nova Blitz is a real-time, digital, collectible card game set in a future universe. The Nova Token is an in-game currency allowing for in-game purchases and the trading, buying, and selling of cards.</p><h4><a href="https://www.deckbound.com/"><strong>Deckbound Heros</strong> </a>(Announced 2014, Steam Game since March 9 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*f8c9mfacgHCcIR0TaOEEhw.gif" /><figcaption>“Deckbound Heroes is a competitive multiplayer strategy card game. With no RNG or deck draw mechanic, the game’s focus on strategy is often compared to that of <em>chess</em> or <em>Go</em>.”</figcaption></figure><p>Deckbound supports a set of digital collectible card games that use the same cards. Every card is backed by a “blockchain” transaction with a “permanent, identifiable record.” Deckbound uses <a href="https://bitbind.io/">https://bitbind.io/</a> APIs which offers a middleware for representing objects and associated tags using the Bitcoin blockchain.</p><h4><a href="https://www.cryptibles.com/"><strong>Cryptibles</strong></a><strong> </strong>(launched November 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JhSRhP_3a29gi4XYPQzcrQ.png" /><figcaption>“Cryptibles are blockchain-secured digital collectibles. They can be collected, stored, and shared easily by mobile users!”</figcaption></figure><p>iOS and Android apps to create custom collectible tokens using an Ethereum smart contract. Information about the asset is stored using a “hybrid database-blockchain approach to provide the convenience of gas-free P2P transfers with ability to quickly transfer back to an Ethereum address on the blockchain.” The ERC-20 compatible tokens can be traded independently of the app.</p><blockquote>Note: I tried the Android version of this app. It asked for invasive permissions such as photo library and phone access, but I denied all of them and the app still worked. Use with care.</blockquote><h4><a href="https://cryptozombies.io/"><strong>CryptoZombies</strong></a> (launched 12 December 2017)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*S9Cg1wJCsr3ti9wIt_-uBQ.png" /><figcaption>“CryptoZombies is an interactive code school that teaches you to write smart contracts in Solidity through building your own crypto-collectables game.”</figcaption></figure><p>Hot off the presses from the <a href="https://loomx.io/">Loom Network</a> is a unique interactive ERC-721 crypto-collectible builder with an interactive coding platform. Learn Solidity by building your own Zombie Army. Every Zombie you create will have randomly generated DNA and have its own unique appearance. Further lessons (1 released each week) will add more functionality to your game, like the ability to battle other people’s zombies! I’m really excited about this project.</p><h4><strong>Decentraland</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_BeAgAaBYiMnzmUdWWdinQ.png" /><figcaption>Partial visualization of the in-progress Decentraland LAND auction as of December 20th, 2017</figcaption></figure><p>Let’s not forget Decentraland LAND tokens are fully compliant ERC-721 tokens, enforcing cryptographic uniqueness and associating each LAND parcel’s x and y coordinates with a definition of a parcel’s 3D scene that makes up the larger metaverse. Over 97,183,887 inMANA tokens have already been bid on, representing the largest virtual land auction in history. (Stats as of 22 December 2017)</p><h3><strong>Get Involved</strong></h3><p>Do you have a killer idea for combining crypto-collectibles with the virtual world? Are your CryptoKitties feeling lonely out there in the Ether? Just want to see what this whole thing is about?</p><blockquote>We are on the final stretch of the Terraform event, the largest ever virtual land auction. You can still register at <a href="https://t.co/gHoMEDWBNd">http://terraform.decentraland.org </a>, and participate in the auction at <a href="https://t.co/VCzewFkOzI">http://auction.decentraland.org </a>— Remember that additional time is added to all parcels that receive last-day bids.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=130676002015" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decentraland/cryptocollectibles-decentraland-and-you-130676002015">Decentraland as a Playground for Crypto-Collectibles</a> was originally published in <a href="https://medium.com/decentraland">Decentraland</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teaching WebVR: Using A-Frame and Glitch for intro to 3D programming summer course]]></title>
            <link>https://medium.com/@kfarr/teaching-webvr-using-a-frame-and-glitch-for-intro-to-3d-programming-summer-course-ff63a0dd3884?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff63a0dd3884</guid>
            <category><![CDATA[webvr]]></category>
            <category><![CDATA[a-frame]]></category>
            <category><![CDATA[teaching]]></category>
            <category><![CDATA[lesson-planning]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Mon, 21 Aug 2017 07:51:13 GMT</pubDate>
            <atom:updated>2017-08-25T23:19:56.191Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog post is a summary of our experience teaching a WebVR lesson at a summer enrichment program for middle school students using <a href="http://aframe.io/">A-Frame</a>, <a href="https://glitch.com/">Glitch</a>, a standard computer lab, and the students’ mobile phones.</p><p>In July I was kindly invited to help lead a half-day session as part of a virtual reality course taught by <a href="https://medium.com/u/9717a81ff6a4">Azine Davoudzadeh</a>. This course was part of the “<a href="https://www.srvef.org/Imagineering/Imagineering">Imagineering</a>” program — a STEAM enrichment program supported by the San Ramon Valley Education Foundation. Azine is an experienced media teacher who runs the San Francisco <a href="https://www.meetup.com/RICOH-THETA-Developers-SF-Bay-Area/events/240600772/">Ed Tech Connect</a> meetup and helps other educators explore using VR in the classroom.</p><h3><strong>Class Format and Equipment</strong></h3><p>Approximately 20 students attended this VR course ranging in grades from 6th to 9th. We had 5 stellar mentors who were older students with some programming experience.</p><p>The classroom had 20 desktop Mac computers, a projector for the teacher’s display and a white board. We asked the students to bring in their smart phone, but I’m pretty sure they would have brought them anyway. Azine made available Google Cardboard headsets and a few Ricoh Theta-S 360° cameras to borrow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Qe-XPsKQgWbyn94vVZ2Vw.jpeg" /></figure><p>The course went from 9 am to 12 noon with a break about halfway in the middle.</p><h3>Detailed Lesson Plan</h3><p>This is a detailed lesson plan for a 2–4 hour session. It is intended for beginners to HTML and web programming. It assumes each student has a computer with Internet access with a modern browser like Chrome, Firefox or Edge and also a smartphone with Internet access.</p><p><strong>1) What are we making? </strong>Today’s goal is to create a “3D Postcard” — a 360° photo with 3D objects or text in the scene that you can share with family and friends. You can share this project with a simple link and view it on any computer with a browser, on a smart phone (with optional Cardboard VR mode), or even an HTC Vive or Oculus Rift in VR mode using a <a href="https://webvr.rocks/">WebVR</a> compatible browser!</p><p>Here are a few actual 3D Postcards that the students made in this class:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*95o42Bj_N3xr51hAeJKgEw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHi1xb7C3xLWNlhEE1St_w.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQ8Z0RGJgijT8TNJj4il7Q.gif" /></figure><p><strong>2) A-Frame — what is it? </strong>Basically, it’s 3D on the web.</p><ul><li>Let’s see some examples: Open up your web browser and type in “<a href="http://aframe.io/">aframe.io</a>”. Click on the different names shown under theExamples heading in the left-hand nav to load different demo scenes.</li><li>Now try the same examples on your phone. What is going on? What is your phone doing differently than the desktop? On your phone, try pressing the button in the lower-right hand corner and put it in your Google Cardboard.</li><li>How do you usually download games or apps on your phone? Why is this experience different than downloading an app?</li></ul><p><strong>3) How does it work? (A Super Fast Primer on HTML)</strong></p><ul><li>These are just regular HTML websites with “special 3D powers”! First, let’s make sure we’re all familiar with what an HTML website is.</li><li>A website is made up of elements or “tags”. These tags are like instructions for your computer to draw the web page. (Do your parents or teachers help you with making a “to-do” list for chores or assignments? This is a similar idea — you’re making a to-do list for the computer to follow instructions to draw the webpage.)</li><li>A tag must (usually) be opened and closed: &lt;something&gt; &lt;/something&gt;. Tags can “nest” or include other child tags inside them.</li><li>There’s a simple pattern for HTML websites. It’s easy to remember — what’s above your neck? (Your&lt;head&gt;) What’s below?(Your &lt;body&gt;). Enclose those in an &lt;html&gt; tag and BOOM you’re a web developer!</li></ul><pre><strong>&lt;html&gt;<br>  &lt;head&gt;<br>    ( boring stuff goes inside here )<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    ( the good stuff goes inside here )<br>  &lt;body&gt;<br>&lt;/html&gt;</strong></pre><p><strong>4) Now, let’s try cloning an example to make our own 3D scene! </strong>Here’s where the magic of Glitch as a teaching tool comes in. Instead of starting from scratch we will simply “remix” an existing basic demo from the A-Frame website.</p><ul><li>Go to <a href="https://aframe.io/">aframe.io</a>, click the “<a href="https://aframe.io/examples/showcase/helloworld/">Hello World</a>” scene.</li><li>Click on “View Source”. (This should link you to the Glitch project <a href="https://glitch.com/~aframe">https://glitch.com/~aframe</a>.)</li><li>Click the green “Remix” button.</li><li>Click on “Show (Live)” to see the output of your project. (This usually opens in a separate tab. You can keep this open and tab back-and-forth as you make changes, or create a split screen view that shows both code and live output by manually resizing your browser windows.)</li><li>Now let’s go through the code and see how this works. Go back to the tab with the code that you “remixed” from the A-Frame Hello World scene. Click index.htmlon the left hand side. This shows the entire code that makes up the page. Now your screen should look something like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k2HY4vYc4wfhG1V93alAJQ.png" /></figure><ul><li>Let’s review the code. Can someone remind us what are the 2 parts of the HTML page? (The head and body.)</li><li>Can you guess what each line in the head does by looking at lines 4–6? (The title tag displays at the top of the browser window and tab. The meta tag is used by search engines to describe your page. The script tag loads A-Frame to do all this cool 3D stuff.)</li><li>What’s going on in thebody ? (It’s where the real action is going on. You’ll notice an a-scene element that has 5 “primitives” below. A “primitive” is a special element that A-Frame provides as a basic building block of a 3D scene. Thanks to these built-in primitives, this 3D scene is defined in just 5 lines of code.)</li><li>Each primitive element also has “attributes” inside of its opening tag. For example, &lt;a-box&gt; has position, rotation, and color attributes.</li></ul><p><strong>5) Let’s start changing things! </strong>(Note, if you are not able to edit code in your Glitch project, repeat the instructions in the step #4 above and make sure you click “Remix”.)</p><ul><li>Try changing the position attribute of the a-box to 1 0.5 -3 (by simply removing the negative symbol in front of the number one). Switch back to your output by clicking “Show (Live)”. What happened? Try changing the second value from0.5 to 1.5. What happens now?</li><li>What do you think the first number in the position triplet represents? What about the second and third? (These represent x, y, and z coordinates on a 3D graph.)</li><li>What happens when you change scale or rotation values of some of the other primitives? What do the triplets of numbers represent for rotation and scale?</li><li>What happens when you try rotating the sphere or box by 90°? Why don’t you see anything change?</li></ul><p>Sometimes switching back and forth between the Glitch code editor and the live view can get tedious. An easier way to quickly modify your A-Frame scene is using the “A-Frame Inspector”. While looking at your scene in the live view, press ctrl ,alt and i at the same time to load the A-Frame Inspector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TUV_rjPwd8v78g8hEdGQNQ.png" /></figure><p>Once the inspector loads, click on an element on the left-hand side such as the &lt;a-box&gt;element in the screenshot above. This will open a pane on the right-hand side of the screen that allows you to modify attributes like position and rotation by simply clicking and dragging the mouse or typing in new values.</p><p>The inspector is a powerful tool and <a href="https://aframe.io/docs/0.6.0/introduction/visual-inspector-and-dev-tools.html#a-frame-inspector">you can read more about its features here.</a> However using Glitch together with the A-Frame inspector is a little tricky. Changes to your scene made in the inspector will not be saved in Glitch. You must edit your Glitch project manually to save the new values. Also, by default Glitch will refresh your live view immediately when you make a change, closing your A-Frame inspector and the values of the changes you made.</p><p>The simplest solution to this problem is simply jotting down the new values you’ve created from the inspector down on paper or Notepad (PC) or TextEdit (Mac). The inspector has a copy to clipboard feature but that is not always reliable and sometimes confuses students with all the extra attributes it copies. You can disable auto refresh on a Glitch project but that requires creating an account.</p><p><strong>6) Now let’s try adding some new shapes! </strong>A-Frame comes with a variety of built-in primitives or shapes that we can place in our scene. Here are a few examples of shapes that you can add to your A-Frame scene:</p><pre>&lt;a-ring color=&quot;teal&quot; radius-inner=&quot;1&quot; radius-outer=&quot;2&quot;&gt;&lt;/a-ring&gt;</pre><pre>&lt;a-cone color=&quot;tomato&quot; radius-bottom=&quot;2&quot; radius-top=&quot;0.5&quot;&gt;&lt;/a-cone&gt;</pre><pre>&lt;a-tetrahedron color=&quot;#FF926B&quot; radius=&quot;5&quot;&gt;&lt;/a-tetrahedron&gt;</pre><pre>&lt;a-torus color=&quot;#43A367&quot; arc=&quot;270&quot; radius=&quot;5&quot; radius-tubular=&quot;0.1&quot;&gt;&lt;/a-torus&gt;</pre><ul><li>A-Frame has a bunch more primitives to play with, <a href="https://aframe.io/docs/0.6.0/introduction/">check out the Documentation for much more info</a>. You must scroll nearly to the bottom of the left-hand side nav in order to see the full list of primitives.</li></ul><p><strong>7) Let’s add a 360° image from our Ricoh Theta camera!</strong> Azine had made available a few 360° cameras and the students had already taken pictures the previous day.</p><p>It was easiest for her to download the pictures from the Ricoh Theta and then provide them to the students through a shared Google Doc that had links to the photos for the students to easily access, instead of having each student pair the Ricoh Theta with their own phones. Using the shared Google Doc had an added bonus that those pictures were made available for other students — this also helps provide images for students who weren’t able to take their own pictures or who simply wanted to try making projects with others’ pictures.</p><p>Regardless of the 360° camera you use and the process to get them off the camera to the students, these images should be saved from the camera as equirectangular jpeg files. The student should then download them to the local computer. (When the photo is open in its own tab right click and then click “Save image as…”).</p><p>Next we had each student upload at least one of the images into Glitch so they could use it in their A-Frame project. In the left-hand side of the Glitch code editor, click assets to show the assets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gl4LslHbcaCHgr68eu17ow.png" /><figcaption>The “assets” view in the Glitch editor</figcaption></figure><p>The Glitch asset manager is really handy for quickly uploading static files like these 360° photos to your project. It handles annoying web developer things like CORS permissions silently in the background so you can focus on learning instead of debugging silly dev environment problems. We instructed the students to drag and drop the files in from their download folder to the browser as the interface suggests, but we found it was sometimes easier for students to click the “Add asset” button which provides a dialog box for selecting a file to upload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*ZFwHWY0VkK1d1jDYwbfSxA.png" /></figure><p>Once the image is added to your assets view in Glitch, you should see it appear with a preview thumbnail. Next we want to use this file in our project. Click the thumbnail and you should see a dialog box that pops up with a button to Copy Url.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*xZK95F03H_9Hi94sWbUjTg.png" /></figure><p>Click the Copy Url button, then move back to your index.html file with your A-Frame project. Find the existing line with the a-sky element and remove the color attribute and replace it with asrc attribute with a link to the URL of the file that you just copied. So it should go from a line like this:</p><pre>&lt;a-sky color=&quot;#ECECEC&quot;&gt;&lt;/a-sky&gt;</pre><p>to a line like this:</p><pre>&lt;a-sky src=&quot;<a href="https://cdn.glitch.com/2f8a2fe2-d41c-4c52-a97c-e50622b7d4b7%2FR0010050-2.jpg?1501176296084">https://cdn.glitch.com/2f8a2fe2-d41c-4c52-a97c-e50622b7d4b7%2FR0010050-2.jpg?1501176296084</a>&quot;&gt;&lt;/a-sky&gt;</pre><p>Now go see your project. You should see your 360° photo as the sky of your scene. For maximum effect, this is a good time to try looking at your project from your mobile phone in Cardboard mode.</p><p><strong>8) Finally, let’s add some animations! </strong>To add that last bit of flair we can use a few lines of code that change an attribute of an element over a given time period, resulting in the object moving or rotating. Although each individual animation command is simple, by offsetting animations across multiple objects you can create complicated scenes that appear to be a work of art!</p><p>One of my favorite examples of chaining animations together is another student created A-Frame project from a different class. The “3D Postcard” concept was inspired by a more complicated “Kinetic Sculptures” project by <a href="https://medium.com/u/53e2ffe02093">jd pirtle</a> where <a href="https://aframe.io/blog/awoa-44/#kinetic-sculptures-by-7th-and-8th-graders-from-jd-pirtle">students combined many simple individual animated shapes to create a complicated looking whole</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1BwawtJN_XWtYSyYZffRTQ.gif" /><figcaption>A “Kinetic Sculpture” — today we’ll create something a little more simple to start with.</figcaption></figure><p>We’re going to start with something more simple on our “Hello World” scene. Let’s start by finding this line:</p><pre>&lt;a-box position=&quot;-1 0.5 -3&quot; rotation=&quot;0 45 0&quot; color=&quot;#4CC3D9&quot;&gt;&lt;/a-box&gt;</pre><p>Let’s add an animation to rotate this cube by 90°. You need to add the animation code <em>in between </em>the opening and closing tags of the element which you wish to animate.</p><pre>&lt;a-box position=&quot;-1 0.5 -3&quot; rotation=&quot;0 45 0&quot; color=&quot;#4CC3D9&quot;&gt;<br>  &lt;a-animation<br>    attribute=&quot;rotation&quot;<br>    from=&quot;0 45 0&quot;<br>    to=&quot;0 135 0&quot;<br>    direction=&quot;alternate&quot;<br>    dur=&quot;1000&quot;<br>    repeat=&quot;infinite&quot;&gt;&lt;/a-animation&gt;<br>&lt;/a-box&gt;</pre><p>We have added some line-breaks so that the text fits on the projector in front of the classroom. This new syntax can be a bit confusing but the space and line breaks don’t affect how the scene is rendered. You can format all attributes on one line instead which can be helpful when you add more animations to your scene.</p><p>If you’ve done this correctly you should see the box in the Hello World scene rotating 90° every second in an alternating direction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6mwDFsL8Sm-Vz90hPsQZkA.gif" /></figure><p><strong>9) Going beyond</strong>. With these basic building blocks you can now create a wide range of animated 3D scenes that work on any device from a PC to smartphone or even VR headset. But don’t stop there! Here are some ideas of projects and other things you can add to your 3D scene:</p><ul><li>Try adding textures to your other objects! Use the same method for adding a 360° image to the sky element but applied to other objects to quickly add an image as a texture.</li><li>Create “augmented reality” by annotating your 360° photo. Use the ring primitive, adjust its position to move it 10 units away from the center of the scene and the adjust its scale, radius or other attributes to highlight a certain part of the panorama scene. You can add also text using the A-Frame text component, <a href="https://aframe.io/docs/0.6.0/components/text.html">documentation here</a>.</li><li>You can make more complicated scenes with models from the primitive shapes and the ability to add textures and animations. Can you make a robot with waving arms? Or create a a solar system with rotating planets? Or maybe create a space ship or an airplane that flies through the air? Or annotate outdoor 360° pictures with names of the plants, people or animals in the scene?</li><li>Look at the rest of the <a href="https://aframe.io/docs/">A-Frame documentation</a> for other features that we didn’t have time to learn in this first class. Look up “laser controls” for info on adding interaction to your scene or “shadows” to add realism.</li></ul><h3>How did they like it? WOW and AHA Reactions!</h3><p>Here are some of things they liked:</p><ul><li><strong>WOW!</strong> Seeing their own 3D scene from their computer show up on their phone moving with the smartphone’s accelerometer, and then putting the phone inside the Cardboard headset</li><li><strong>AHA!</strong> Changing attributes of objects and seeing how it affected the 3D scene, sometimes as they expected but often not, which presented a learning experience</li><li><strong>WOW!</strong> Adding animations and seeing them work</li><li><strong>AHA! </strong>Getting a piece of code to work after getting an error or not seeing what they expected</li><li><strong>WOW!</strong> Seeing the effect of adding a 360° image to their scene’s sky element</li><li><strong>AHA!</strong> Realizing the same attribute that adds a 360° image to the sky can also be applied to other objects</li><li><strong>WOW!</strong> Seeing the work that other students created</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ozCTY-LI2iwuD8AECSjsGw.jpeg" /></figure><h3>What worked well?</h3><ul><li><strong>Mentors — </strong>Without the student mentors this event would not have been nearly as successful. Throughout the course they provided 1-on-1 assistance on everything from typos to missing brackets in html tags and more complicated problems like debugging multiple errors on a page. Their help made a <em>big difference</em>!</li><li><a href="https://glitch.com/"><strong>Glitch</strong></a> — This platform is an amazing educational tool for teaching web development. Alternatives such as codepen are viable options, however Glitch’s prominent “remix” cloning feature and its simple UI to handle uploading and hosting of large binary files such as 360° images make it the best I’ve seen.</li><li><a href="https://aframe.io/"><strong>A-Frame Website</strong></a><strong> — </strong>The A-Frame core contributors have done a great job of clearly documenting the platform and providing copious examples. This is a great resource.</li><li><strong>HTML Basics Lesson — </strong>The short HTML basics lesson proved to be valuable, especially as the exercises became more complicated. It felt rudimentary to me when writing the notes and I was worried the students would not pay attention, but it was critical to make sure they had the basic vocabulary of an HTML document to understand the code changes they needed to make and later to explain errors they encountered.</li><li><strong>Self Discovery — </strong>The more latitude they had to accomplish a task, the more engaged they seemed to be. For example, the early tasks of explicitly changing a value from one to another did teach some basic lessons but was not nearly as much fun as “change the code to make the box spin” and letting them experiment with the right attributes to change with the animation component to accomplish this.</li><li><strong>Photography / 360º — </strong>The integration of 360º images using the Ricoh Theta-S camera was a key part of the fun of this approach to learning A-Frame. The 360º offered a rush of creativity with a relatively simple process by sharing the downloaded photos and using Glitch to host them. I think 360 photography could be a bigger part of this course.</li><li><strong>Sharing and Teamwork — </strong>The students learned a great deal from each other. I was impressed by how the helped answer each other’s questions and get inspiration from their friends and neighbors using trial and error to make new things. The Glitch short URL names helped us feature projects on the teacher’s projector and allow the students to type them into their browser to see the scene or copy code.</li></ul><h3>What was difficult? What to improve for next time?</h3><p>Syntax errors were the most difficult part of the course. It can be frustrating for a page not to load as expected because of a misplaced quotation mark or missing bracket. This is a the reality of programming and part of the lesson the students are here to learn.</p><p>The volunteer student mentors were critical in making the class a smooth success by providing constant help to the students to debug and correct syntax errors. I highly recommend recruiting a few volunteers to help with this if you teach a similar class and age group.</p><p>More 360° photography and VR examples using the HTC Vive or Oculus Rift could be part of this course. You could also include other creation tools like <a href="https://ephtracy.github.io/">MagicaVoxel</a> (Mac and PC) and <a href="https://vr.google.com/blocks/">Google Blocks</a> (PC HTC Vive VR Headset) that make 3D modeling much more accessible to all age groups and create objects that can be imported into A-Frame scenes.</p><p>Perhaps an ideal course would interleave these different concepts and activities in a way to breakup the intense programming screen time and also offer structure to brainstorm project ideas and provide time after instruction for creating and then sharing projects with each other. Depending on age group and maturity, the project phase could also be suitable for working together in groups.</p><h3>Would you do it again?</h3><p>Yes! This was such a fun day and I was so impressed to see the creations that students made. I’d love to help teach another course like this, if you’re organizing one in the Bay Area (or beyond) feel free to reach out to me @kfarr on twitter or you can find me on <a href="https://www.linkedin.com/in/kfarr/">LinkedIn</a>.</p><p>Here are links to view a few of the projects, used the W A S and D keys to move around the scene:</p><ul><li><a href="http://busy-larch.glitch.me/">Hello, WebVR! - A-Frame</a></li><li><a href="http://glitter-temper.glitch.me/">Hello, WebVR! - A-Frame</a></li><li><a href="https://shocking-pixie.glitch.me/">SAAAAAAAAAAAAANNNNNNSSSSSSS!!!!!!!!!!</a></li><li><a href="http://absorbing-middle.glitch.me/">this is a new tab - A-Frame</a></li></ul><h3>Share this lesson plan with your fellow VR fans!</h3><h3>Kieran Farr on Twitter</h3><p>HowTo guide: teaching #WebVR programming to middle schoolers using @glitch and @aframevr https://t.co/ArDlzKwbVt thx @SRVEForg and @azined!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff63a0dd3884" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publishing an A-Frame scene on IPFS]]></title>
            <link>https://medium.com/@kfarr/publishing-an-a-frame-scene-on-ipfs-18a50853c5a6?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/18a50853c5a6</guid>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[a-frame]]></category>
            <category><![CDATA[webvr]]></category>
            <category><![CDATA[ipfs]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Sun, 13 Aug 2017 08:01:23 GMT</pubDate>
            <atom:updated>2017-10-10T04:37:54.031Z</atom:updated>
            <content:encoded><![CDATA[<p>Here are some quick notes on making an <a href="https://aframe.io/">A-Frame</a> deserted island scene using <a href="https://ipfs.io/">IPFS</a>. These instructions are for a Windows PC. This guide focuses just on the IPFS components not on A-Frame specifically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4vS6KokuOvw-C2oMpRhTw.png" /></figure><h3>#1 Install IPFS.</h3><p>Install IPFS following <a href="https://ipfs.io/docs/install/">the IPFS directions on the website</a> for your platform. You’ll need to add ipfs to your system path, reminder on Windows that it takes <a href="https://www.computerhope.com/issues/ch000549.htm">clicking through a few dialog boxes to get there</a>.</p><h3>#2 Do the first 2 steps of the getting started guide.</h3><p><a href="https://ipfs.io/docs/getting-started/">Follow the first 2 steps of the IPFS getting started guide</a> so that you see the readme file in your command prompt window as follows:</p><pre>Hello and Welcome to IPFS!<br><br>██╗██████╗ ███████╗███████╗<br>██║██╔══██╗██╔════╝██╔════╝<br>██║██████╔╝█████╗  ███████╗<br>██║██╔═══╝ ██╔══╝  ╚════██║<br>██║██║     ██║     ███████║<br>╚═╝╚═╝     ╚═╝     ╚══════╝<br><br>If you&#39;re seeing this, you have successfully installed<br>IPFS and are now interfacing with the ipfs merkledag!</pre><p>At first it didn’t work for me with a merkledag: not founderror and <a href="https://github.com/ipfs/website/issues/85">then I learned</a> you need to have the IPFS background daemon running whenever using IPFS locally.</p><p>Open up a separate command prompt and type ipfs daemon.</p><h3><strong>#3 Now make a nifty A-Frame project.</strong></h3><p>Create a new directory for your project, I called mineipfs-aframe and started to put together a little deserted island scene. I used an <a href="https://vr.google.com/objects/3klCCwls9MW">island object asset from Google Blocks</a> (downloaded as a zip file and extracted the obj and mtl files in the project directory), a nifty looking <a href="https://samsunginter.net/a-frame-components/">ocean material</a> by @Lady_Ada_King , some background <a href="https://archive.org/details/aporee_2057_2974">ocean wave sound effects</a> and <a href="https://archive.org/details/ocean_shores">music</a> from Archive.org, and a <a href="https://www.cgskies.com/sky.php?sky=343">non-commercial use sky</a> from CGSkies.</p><p>I assume users will still have access to the regular Internet when accessing IPFS files, and IPFS can take some time to serve and propagate files, so I tried to reference as many regular Internet assets as possible and minimize the files served from IPFS. So I directly referenced the ogg audio files, A-Frame, and the ocean material JavaScript files.</p><p>Here’s what my project folder structure looked like before adding to IPFS:</p><pre>08/12/2017  09:28 PM             1,602 blocks3klCCwls9MW.mtl<br>08/12/2017  09:30 PM           137,292 blocks3klCCwls9MW.obj<br>08/12/2017  10:23 PM           293,033 CGSkies_0343_free_ER.jpg<br>08/13/2017  12:24 AM             2,013 index.html</pre><h3><strong>#4 Add your project to IPFS.</strong></h3><p>From the project dir, add files to IPFS by typing ipfs add . -r -w . (The two extra options -w wrap files with a directory object and -r add directory paths recursively.)</p><p>Here was the output of running that command:</p><pre>C:\Users\kfarr\dev\ipfs-aframe&gt;ipfs add . -r -w<br> 286.17 KB / 427.75 KB [=======================================================&gt;---------------------------]  66.90% 0sadded QmNjDWSSobSUShu1cRxHwKgrEf1whDUb5uVzRTddGv3jJL ipfs-aframe/CGSkies_0343_free_ER.jpg<br> 287.73 KB / 427.75 KB [=======================================================&gt;---------------------------]  67.27% 0sadded QmVZDdnjEWipXLF3cBKqeKU3MUo9ZFa9LSif8wU1dnUGUT ipfs-aframe/blocks3klCCwls9MW.mtl<br> 421.80 KB / 427.75 KB [=================================================================================&gt;-]  98.61% 0sadded QmS6FANgSjVoRrCscBPwFKWTvpcT8Ae6B5tkjzTdHFR6mH ipfs-aframe/blocks3klCCwls9MW.obj<br> 423.75 KB / 427.75 KB [===================================================================================]  99.06% 0sadded QmSxqWJndRyjgoUyz4zxUkjibSwzfzpQh6i9JDGQ7TmtdS ipfs-aframe/index.html<br>added QmcyBWQqJ9R6xDJUEPXw45cnCMKgEVBHoJeBgShBHBNyka ipfs-aframe<br>added QmZj3a8tpdnTQMECrUkkiHtDGTJbKxJij9bJk5K3YBrEcS</pre><h3>#5 Try your scene from the browser.</h3><p>Fire up your favorite browser let’s see this in action. Your project’s IPFS path looks something like this:</p><pre>protocol / localhost:port / ipfs / hash / project directory / file</pre><p>Here was the actual path for my local machine (remember the IPFS Daemon is still running in another command prompt window):</p><pre>h<a href="http://127.0.0.1:8080/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/">ttp://127.0.0.1:8080/ipfs/</a>QmZj3a8tpdnTQMECrUkkiHtDGTJbKxJij9bJk5K3YBrEcS<a href="http://127.0.0.1:8080/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/">/ipfs-aframe/</a></pre><p>But, when I loaded my scene it didn’t work! After some quick debugging I realized I had made a mistake, using an uppercase instead of lowercase character in referencing filename of the Google Blocks object. (Oddly enough, when I used Node’s http-server the objects loaded okay as it must handle case mismatch silently, but when served from IPFS it wasn’t as accommodating to my butter fingers.)</p><h3>#5 How do I update my scene on IPFS?</h3><p>I was faced with a question of how can I update my scene on IPFS after I had fixed the error in the HTML?</p><p>The answer — you can’t! Well, you don’t really update or delete things in IPFS. There’s a <a href="https://github.com/ipfs/faq/issues/9">good conversation about this on their GitHub repo</a> including this helpful snippet:</p><blockquote>On the IPFS homepage, it is described as IPFS is The Permanent Web so deletion sounds like an anti-goal to me :)</blockquote><blockquote>To be clear, though: it is possible for data to be deleted from the network. For example, if you add a file and then immediately unpin it and then garbage collect it before anyone has a chance to get it from you, it will be effectively deleted.</blockquote><p>In case you mistakenly upload embarrassing photos to IPFS, here’s <a href="https://ipfs.io/ipfs/QmNZiPk974vDsPmQii3YbrMKfi12KTSNM7XMiYyiea4VYZ/example#/ipfs/QmP8WUPq2braGQ8iZjJ6w9di6mzgoTWyRLayrMRjjDoyGr/pinning/readme.md">info about using IPFS unpinning features on the command line</a>.</p><p>So instead of deleting or updating, <strong>you simply run </strong><strong>ipfs add . -r -w again in the same directory</strong>. Here’s the output of that command:</p><pre>C:\Users\kfarr\dev\ipfs-aframe&gt;ipfs add . -r -w<br> 286.17 KB / 428.79 KB [=======================================================&gt;---------------------------]  66.74% 0sadded QmNjDWSSobSUShu1cRxHwKgrEf1whDUb5uVzRTddGv3jJL ipfs-aframe/CGSkies_0343_free_ER.jpg<br> 287.73 KB / 428.79 KB [=======================================================&gt;---------------------------]  67.10% 0sadded QmVZDdnjEWipXLF3cBKqeKU3MUo9ZFa9LSif8wU1dnUGUT ipfs-aframe/blocks3klCCwls9MW.mtl<br> 421.80 KB / 428.79 KB [=================================================================================&gt;-]  98.37% 0sadded QmS6FANgSjVoRrCscBPwFKWTvpcT8Ae6B5tkjzTdHFR6mH ipfs-aframe/blocks3klCCwls9MW.obj<br> 423.75 KB / 428.79 KB [===================================================================================]  98.82% 0sadded QmSmZoRS9GAXAYwe584E7tt4veHoTSASP9bWe9Zcr3WSgV ipfs-aframe/index.html<br> 424.79 KB / 428.79 KB [===================================================================================]  99.07% 0sadded QmVfYKLJ2DsbViUAMUJ7TV67XEpUDYB6nCwXx9FGquAskc ipfs-aframe/notes.md<br>added QmTuVzCUKs1w5Mgn9BjamhDf57uUnKhVdxsPMVVENH9TUg ipfs-aframe<br>added QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6</pre><p>Here is some IPFS magic, notice the hashes for jpg, mtl, obj files did not change from the previous ipfs add command from earlier, but the hashes for index, notes (new file), ipfs-aframe dir and the parent ipfs object (I think that what it’s called?) have new hashes.</p><p>Now when I load the scene on my local machine at <a href="http://127.0.0.1:8080/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/">http://127.0.0.1:8080/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/</a> it works!</p><h3>#6 How to share with the “normal” Internet?</h3><p>What if I want to share this with my friends or favorite A-Frame slack group and those users don’t have the IPFS daemon installed or running? Luckily the IPFS group runs a regular HTTP gateway at gateway.ipfs.io. So you can transpose any IPFS link into a publicly accessible URL. Here is the public URL for this example A-Frame deserted island scene:</p><pre><a href="https://gateway.ipfs.io/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/">https://gateway.ipfs.io/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/</a></pre><p>Looks like you can drop the gateway subdomain, so the final project URL is: <a href="https://ipfs.io/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/"><strong>https://ipfs.io/ipfs/QmXw1LKDhMe2HYz2pMzfEwgpc6ddPfySo3M63mhvvtiUJ6/ipfs-aframe/</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4vS6KokuOvw-C2oMpRhTw.png" /></figure><p><strong>UPDATE 10/9/17:</strong> About 2 months after posting this a user reported that the IPFS.io link was not resolving. Here is a writeup of the issue: <a href="https://medium.com/@kfarr/okay-a-helpful-twitter-liooil-mentioned-that-the-scene-was-no-longer-resolving-on-the-ipfs-http-eadf00e443f8">https://medium.com/@kfarr/okay-a-helpful-twitter-liooil-mentioned-that-the-scene-was-no-longer-resolving-on-the-ipfs-http-eadf00e443f8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18a50853c5a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a VR user interface for A-Frame City Builder]]></title>
            <link>https://medium.com/@kfarr/building-a-vr-user-interface-for-a-frame-city-builder-38b0c86ed7b7?source=rss-d2d11c1aa5d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/38b0c86ed7b7</guid>
            <category><![CDATA[webvr]]></category>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[a-frame]]></category>
            <dc:creator><![CDATA[Kieran Lee Farr]]></dc:creator>
            <pubDate>Wed, 17 May 2017 06:06:34 GMT</pubDate>
            <atom:updated>2017-05-17T08:52:27.689Z</atom:updated>
            <content:encoded><![CDATA[<p>As early as I can remember I have loved playing with toy cars and trucks. Whether Hot Wheels, LEGO, or Micro Machines, if it had wheels I could use it for my elaborate imaginary city scenes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*fo0o3xOssXZEADeN." /><figcaption>A few screenshots from an early version of A-Frame City Builder</figcaption></figure><p>This idea of a toy city is what inspired me to create <a href="https://github.com/kfarr/aframe-city-builder/">A-Frame City Builder</a>, a basic “city builder” style WebVR app as a side project starting late 2016.</p><p>Using the <a href="http://webvr.info/">WebVR</a> framework <a href="https://aframe.io/">A-Frame</a> I was able to quickly combine the whimsical artistry of Mike Judge’s <a href="https://github.com/mikelovesrobots/mmmm">city voxel models</a> into an early proof of concept app that let the user place voxel cars and trucks using the HTC Vive controller in VR.</p><h3>Making the “MVP” of City Builder</h3><p>The code was not overly complex at first: the app simply consisted of a child entity on the controller which spawned a clone when the trigger was pressed. I quickly added a simple object switching feature which cycled to the next object from an array of models each time the trackpad was pressed.</p><p>At this point, I hadn’t thought about a user interface so the controls were minimal and utilitarian: the current place-able object was just “stuck” to the Vive controller model. Pressing the trackpad instantly switched to the next object in the array with no animation or fanfare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/0*7rNGrgvhjbyb3zNj." /><figcaption>City Builder controls MVP: Attach the model to the controller, done!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/0*YvjeER896bll5WVL." /><figcaption>For a second pass, object brought closer and rotated to match top alignment of Vive wand.</figcaption></figure><p>I quickly found it felt more natural to have the object’s horizontal plane lined up to be parallel with the top of the Vive controller model.</p><p>It was nice to be able to see the object close to where my hands were holding the controller, like a master jeweler peering at a precise placement of a gemstone — now with voxels!</p><p>At this point the app was plenty usable. I was amazed with what scenes could be created given these two simple tools: clone and switch object.</p><p>I had only imported a few dozen models from Mike Judge’s collection, but already it was plenty sufficient to allow my friends and coworkers who tried out the app to construct fun scenes and tell unique stories with a few movements and presses of a VR controller. (<a href="https://github.com/kfarr/aframe-city-builder/tree/6720e3e6e1a4b7cbd37cce4e551d2df9ac38b440">Repo snapshot</a> of this point.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36aRJDtE_07d6-TsB-1H_A.png" /><figcaption>Car crash! Traffic jam!</figcaption></figure><h3>Finding a Better Solution to Scale</h3><p>It was clear that using one button to iterate blindly through an array of objects would not scale well. Mike’s collection has over 400 models and I’d love to eventually allow people to upload their own voxel creations. So, I began brainstorming a more effective interface starting with some my own expectations:</p><blockquote>As a kid building a VR city with voxel objects…</blockquote><ul><li>I want to focus on my primary object that I’m placing. I want that front and center.</li><li>I want to always be able to switch objects easily, but that’s not as important as placing the currently selected object so don’t get in my way!</li><li>I want to be able to switch objects very quickly without having to move both hands. I want an interface that can use one-hand movement and not require a 2-hand gesture.</li><li>I want to see many objects quickly. I want an interface that shows multiple objects at a time.</li><li>I don’t want to “get stuck” at the end of a list. I want an interface that loops at the end of a list.</li><li>I want to know something about each object, at least a name.</li><li>I’d like to be able to figure out what button maps to the UI without having to read instructions.</li></ul><p>I started sketching out some ideas on paper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yqvCYJ4XzCGRu3PJ." /><figcaption>Ugly sketches but they start the conversation.</figcaption></figure><p>I tried using Tilt Brush and found it helpful for experimenting with 3D placement and sizing, but only after having started a creative direction. My initial ideas were most easily brainstormed and iterated with paper and pencil first.</p><p>However, after having a basic ideas on paper I found the <a href="https://github.com/aframevr/aframe-inspector">A-Frame inspector</a> was an excellent tool for rapid prototyping and iteration. I would very often tab back and forth between my prototype project, A-Frame inspector mode, and my codebase. A-Frame inspector was a tremendous time saver to make quick tweaks to positioning and rotation without needing additional round-trips of code changes and browser reloading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*Laqtyn_-85OXdY4M." /><figcaption>My fine voxel art skills at work.</figcaption></figure><p>I next tried building out a metaphor of a “watch” which is out of the way but still accessible with a twist of the hand — even going so far as to build a quick watch voxel model. (I had an idealistic image of a futuristic sci-fi hand like a portal gun mixed with Buzz Lightyear’s arm controls.)</p><p>The watch concept didn’t work very well. I found myself wanting to be able to see both the currently selected object and the menu at the same time. Moving my head back and forth to see the watch and the object was not a great experience.</p><p>So then I went simpler and literally placed object preview images directly adjacent to the controller and the currently selected object:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*9LEKwHRprNzq6Whn." /><figcaption>The first cut of what became the final horizontal “select bar” design.</figcaption></figure><p>Once I threw out the need to match a real life metaphor, like a watch, it became much easier to directly address the design challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/0*n7dFpzMJJZd78hHR." /><figcaption>Adding borders and “selected” state.</figcaption></figure><p>I started refining the design to add some borders to the preview images and added styling to clearly indicate a “selected” state. The controls were really coming together!</p><p>One of my user goals was to be able to quickly and easily be able to see upcoming objects, and if I was really in a hurry to make a cool city scene it’d be nice to see ahead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*2dW-FaLEhfiOsV_C." /><figcaption>Adding a total of five menu options and a semi-transparent background frame.</figcaption></figure><p>So I added 2 next and 2 previous object previews sandwiched around the currently selected object.</p><p>A 50% opaque background frame provided nice separation from other elements in my field of view, and at certain angles it has a nice specular sheen.</p><p>If I wanted to return to a skeuomorphic design concept I suppose at this point I could have experimented with designs that resembled a tablet (old style or the iPad variety), but I didn’t see any value in trying to cram that in.</p><p>In order to support hundreds and eventually thousands of objects, I wanted to introduce the concept of grouping objects together. You could browse objects of the same group by going forward and back within a group, or switch groups by going up and down.</p><p>I added some arrows to experiment with this concept:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mRbSCYLeyI_bGgZe." /></figure><p>I really liked this — seeing the arrows gave me some additional inspiration, wouldn’t it be great to be able to see where your trackpad is hovering before selecting an option? It turns out that the Gamepad API provides the raw axis position which can be interpreted into hover position, allowing me to put that together into a nice hover state:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgifs.com%2Fiembed%2FZ4DLXJ&amp;url=https%3A%2F%2Fgifs.com%2Fgif%2Fa-frame-select-bar-component-Z4DLXJ&amp;image=https%3A%2F%2Fj.gifs.com%2FZ4DLXJ.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=gifs" width="480" height="270" frameborder="0" scrolling="no"><a href="https://medium.com/media/3744399c3d2d4f9b87ae8cdbdfa72083/href">https://medium.com/media/3744399c3d2d4f9b87ae8cdbdfa72083/href</a></iframe><p>Another fun thing about this design is that it can lend itself to at least 2 different methods of use to accomplish the same thing — one-handed quick via touch pad, or a “laser pointer” style like that used in Tilt Brush and other palette UI concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lv1DEwunMacDnpht." /></figure><p>I continued to add polish including quick animation when switching objects within the same group. I added labels for each object and the group name using the A-Frame <a href="https://github.com/bryik/aframe-bmfont-text-component">bmfont text component</a> (now part of A-Frame core).</p><h3>Technical Challenges of VR User Interfaces</h3><p>I have kept this article focused on the design decisions and steered clear of the technical side of implementation, but I must point out that by this point the vast majority of the development complexity of A-Frame City Builder was in fact building the user interface, not building of the logic of the game itself. An entirely separate blog post could be dedicated to the process of separating this select menu UI out of the base game code and into a standalone A-Frame component.</p><p>Another fun topic worthy of a separate thread was the process for making this component compatible with both the HTC Vive and the Oculus Touch controllers. Componentization was a key catalyst for being able to support both control schemes as it forced separation between gamepad events interpretation, user interface state management, and core game logic.</p><p>Once I had finished the separation of components, I was stunned to see the size of the select menu UI component— 40kb vs 11kb for the City Builder game logic!</p><p>As a result it’s absolutely clear that in order to enable developers to create the content we imagine necessary for VR to be successful, we need many more of these basic UI components available out-of-the-box.</p><h3>The Finished Product</h3><p>I have shared a repo for theselect-bar component including a bit of documentation and an example project. The API is inspired by the HTML5 select element: <a href="https://github.com/kfarr/aframe-select-bar-component">https://github.com/kfarr/aframe-select-bar-component</a></p><p>Here is the finished product in shiny YouTube glory:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJlfMPgNpm3o%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJlfMPgNpm3o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJlfMPgNpm3o%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/57d011f317e68d556e4b7f459be12875/href">https://medium.com/media/57d011f317e68d556e4b7f459be12875/href</a></iframe><p>You can take a look at the current <a href="https://github.com/kfarr/aframe-city-builder">A-Frame City Builder repo</a>, including a link to a live online demo if you have a WebVR compatible browser with the HTC Vive or Oculus Rift: <a href="https://github.com/kfarr/aframe-city-builder">https://github.com/kfarr/aframe-city-builder</a></p><h3>Closing Thoughts: Design Lessons Learned</h3><p>Most VR applications seem to have a <strong>PRIMARY</strong> action and <strong>SECONDARY</strong> action.</p><h4>Primary Action:</h4><ul><li>What is your primary action? It usually relates to the core value statement of your application.</li><li>Ideally a good primary action has minimal if any traditional “user interface”.</li><li>The UI and is intuitive and/or explained clearly and immediately in interface.</li><li>In VR, often the Primary action can be literal: painting, bow and arrow, shooting gun, placing object</li></ul><h4>Secondary Action:</h4><ul><li>Often a secondary action is a modification of the primary action (change the brush, reload arrow, switch weapon, switch object) I find secondary action is actually more challenging to design than primary action! The secondary action design goals are tough to mix together:</li><li>It must feel natural and appropriately related to the primary action</li><li>It must be out of the way of the primary action</li><li>BUT it also must be immediately available at a moment’s notice</li><li>It likely involves choosing something from an array, or even an array of arrays</li></ul><h4>Putting it All Together:</h4><h3>Your user interface may be the most complex part of your VR app, so embrace it!</h3><p>To close this post out, here’s an additional gameplay video of A-Frame City Builder. <em>Please excuse the poor audio (using Vive mic) and poor frame rate (was having trouble with Firefox Nightly and WebVR and Chromium was out of commission).</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fni_AF6RYtZo%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dni_AF6RYtZo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fni_AF6RYtZo%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2bb072df6985d6d839e8a65d59c62fa/href">https://medium.com/media/f2bb072df6985d6d839e8a65d59c62fa/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38b0c86ed7b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>