<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>This Is Where I Write</title>
	<atom:link href="https://andrewgrant.org/feed/" rel="self" type="application/rss+xml" />
	<link>https://andrewgrant.org</link>
	<description></description>
	<lastBuildDate>Sun, 06 Dec 2020 22:59:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Building Unreal Engine &#8211; 2019 16” MacBook Pro vs 2020 M1 MacBook Pro.</title>
		<link>https://andrewgrant.org/2020/12/building-unreal-engine-on-a-2019-16-macbook-pro-vs-a-2020-m1-macbook-pro/</link>
		
		<dc:creator><![CDATA[Andrew Grant]]></dc:creator>
		<pubDate>Thu, 03 Dec 2020 16:39:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[UnrealEngine]]></category>
		<guid isPermaLink="false">https://andrewgrant.org/?p=782</guid>

					<description><![CDATA[2019 16" MacBook Pro (8-cores, 64GB RAM) - 17m:31s. 82% battery drain.

2020 13" M1 MacBook Pro (8-cores, 16GB RAM) - 16m:12s. 5% battery drain. ]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">2019 16&#8243; MacBook Pro (8-cores, 64GB RAM) &#8211; 17m:31s. 82% battery drain.</p>



<p class="wp-block-paragraph">2020 13&#8243; M1 MacBook Pro (8-cores, 16GB RAM) &#8211; 16m:12s. 5% battery drain. </p>



<p class="wp-block-paragraph">Details: </p>



<ul class="wp-block-list"><li>Compiling Unreal Engine 4.26 Mac client</li><li>Xcode 12.2</li><li>Clang using x86_64 on the Intel Mac and arm64 on the M1 Mac.</li></ul>



<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
https://youtu.be/CqIfHgHXcZo
</div></figure>



<p class="wp-block-paragraph">(For reference, ambient noise was around 36 db)</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Porting Unreal Engine to Apple Silicon (#2)</title>
		<link>https://andrewgrant.org/2020/07/porting-unreal-engine-to-apple-silicon-2/</link>
					<comments>https://andrewgrant.org/2020/07/porting-unreal-engine-to-apple-silicon-2/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Grant]]></dc:creator>
		<pubDate>Sat, 04 Jul 2020 21:39:00 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AppleSilicon]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[UnrealEngine]]></category>
		<guid isPermaLink="false">https://andrewgrant.org/?p=808</guid>

					<description><![CDATA[Turns out I won&#8217;t be writing much about this at all, other than perhaps generic stuff about the challenges and choices about moving a sizable codebase from one CPU architecture to another.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Turns out I won&#8217;t be writing much about this at all, other than perhaps generic stuff about the challenges and choices about moving a sizable codebase from one CPU architecture to another.</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewgrant.org/2020/07/porting-unreal-engine-to-apple-silicon-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Porting Unreal Engine to Apple Silicon (#1)</title>
		<link>https://andrewgrant.org/2020/07/porting-unreal-engine-to-apple-silicon-1/</link>
					<comments>https://andrewgrant.org/2020/07/porting-unreal-engine-to-apple-silicon-1/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Grant]]></dc:creator>
		<pubDate>Fri, 03 Jul 2020 15:38:00 +0000</pubDate>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[UnrealEngine]]></category>
		<category><![CDATA[AppleSilicon]]></category>
		<guid isPermaLink="false">https://andrewgrant.org/?p=549</guid>

					<description><![CDATA[It’s the Epic Summer shutdown next week and since I don’t have any vacation plans I’m going to spend some of the time trying to get some of Unreal Engine running on Apple Silicon. Apple kindly shipped us a number of DTK’s which arrived just in time &#x1f600;

I’m going to start with the ambitious goal of getting the whole Editor running on the DTK with as many features enabled as possible running.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">It&#8217;s the Epic Summer shutdown next week and since I don&#8217;t have any vacation plans I&#8217;m going to spend some of the time trying to get some of Unreal Engine running on Apple Silicon. Apple kindly shipped us a number of DTK&#8217;s which arrived just in time <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>



<p class="wp-block-paragraph">I&#8217;m going to start with the ambitious goal of getting the whole Editor running on the DTK with as many features enabled as possible running. If I run into issues that may take days of head-scratching to identify but minutes for someone more knowledgable (e.g. the editor immediately crashes with error Foo  deep in Metal&#8230;) I&#8217;ll probably try a simple project natively or just running under Rosetta 2. A lot of the engine has custom SSE / ISPC code which as I understand it may rule out emulation without changes.</p>



<p class="wp-block-paragraph">(Note &#8211; Epic hasn&#8217;t announced any plans with respect to Apple Silicon. Don&#8217;t take any of this as evidence of any sort of roadmap. It&#8217;s simply part curiosity and part research to understand what would be required if we ship support, or want to support licensees who want to add it themselves).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewgrant.org/2020/07/porting-unreal-engine-to-apple-silicon-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Using the 2020 iPad&#8217;s ARMeshAnchor with SceneKit</title>
		<link>https://andrewgrant.org/2020/04/using-the-2020-ipads-armeshanchor-with-scenekit/</link>
					<comments>https://andrewgrant.org/2020/04/using-the-2020-ipads-armeshanchor-with-scenekit/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Grant]]></dc:creator>
		<pubDate>Fri, 17 Apr 2020 20:41:52 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ARKit]]></category>
		<category><![CDATA[iOS]]></category>
		<guid isPermaLink="false">https://andrewgrant.org/?p=430</guid>

					<description><![CDATA[I’m sure this will change at WWDC, but at the moment there isn’t any support in SceneKit for the new ARMeshAnchor data generated by the 2020 iPad with Lidar.

This is unfortunate as SceneKit’s very handy for quick prototyping but it’s easy enough (even for a SceneKit rookie like myself) to generate some SCNGeometry from the raw data that ARKit provides.

Here’s a drop in file that adds a fromAnchor extension to SCNGeometry]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">I&#8217;m sure this will change at WWDC, but at the moment there isn&#8217;t any support in SceneKit for the new ARMeshAnchor data generated by the 2020 iPad with Lidar.</p>



<p class="wp-block-paragraph">This is unfortunate as SceneKit&#8217;s very handy for quick prototyping but it&#8217;s easy enough (even for a SceneKit rookie like myself) to generate some SCNGeometry from the raw data that ARKit provides.</p>



<p class="wp-block-paragraph">Here&#8217;s a drop in file that adds a fromAnchor extension to SCNGeometry</p>



<pre class="EnlighterJSRAW" data-enlighter-language="swift" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">//
//  SCNGeometry+ARMeshAnchor.swift
//
//  Created by Andrew Grant on 4/17/20.
//

import SceneKit
import ARKit

extension SCNGeometry {
    
    /**
     Constructs an SCNGeometry element from an ARMeshAnchor.
     
     Note, the underlying vertex data is owned by the ARMeshAnchor so this geometry becomes invalid when the
     anchor is updated or removed.
    */
    public static func fromAnchor(meshAnchor: ARMeshAnchor) -> SCNGeometry {
        let vertices = meshAnchor.geometry.vertices
        let faces = meshAnchor.geometry.faces
        
        // use the MTL buffer that ARKit gives us
        let vertexSource = SCNGeometrySource(buffer: vertices.buffer, vertexFormat: vertices.format, semantic: .vertex, vertexCount: vertices.count, dataOffset: vertices.offset, dataStride: vertices.stride)
        
        // but we need to create our own copy of the faces..
        let faceData = Data(bytesNoCopy: faces.buffer.contents(), count: faces.buffer.length, deallocator: .none)
        
        // create the geometry element
        let geometryElement = SCNGeometryElement(data: faceData, primitiveType: .triangles, primitiveCount: faces.count, bytesPerIndex: faces.bytesPerIndex)
        let geometry = SCNGeometry(sources: [vertexSource], elements: [geometryElement])
        
        // assign a material suitable for default visualization
        let defaultMaterial = SCNMaterial()
        defaultMaterial.fillMode = .lines
        defaultMaterial.diffuse.contents = UIColor(displayP3Red:1, green:1, blue:1, alpha:0.7)
        geometry.materials = [defaultMaterial]
        
        return geometry;
  }
}</pre>



<p class="wp-block-paragraph">And here&#8217;s an example of how to use it in your ARSessionDelegate handler (with a PlaneAnchor as a comparison)</p>



<pre class="EnlighterJSRAW" data-enlighter-language="swift" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    var knownAnchors = Dictionary&lt;UUID, SCNNode>()
    
    func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
                
        for anchor in anchors {
            var sceneNode : SCNNode?
            
            if let meshAnchor = anchor as? ARMeshAnchor {
                let meshGeo = SCNGeometry.fromAnchor(meshAnchor:meshAnchor)
                sceneNode = SCNNode(geometry:meshGeo)
            }
            else if let planeAnchor = anchor as? ARPlaneAnchor {
             
                let planeGeo = ARSCNPlaneGeometry(device: arScnView.device!)
                planeGeo?.update(from: planeAnchor.geometry)
                planeGeo?.firstMaterial?.fillMode = .lines
                sceneNode = SCNNode(geometry: planeGeo)
            }
            
            if let node = sceneNode {
                node.simdTransform = anchor.transform
                knownAnchors[anchor.identifier] = node
                arSceneView.scene.rootNode.addChildNode(node)
            }
        }
    }
    
    func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
        
        for anchor in anchors {
            
            // do we know about this anchor? If so update it
            if let node = knownAnchors[anchor.identifier] {
                if let planeAnchor = anchor as? ARPlaneAnchor {
                    let planeGeometry = node.geometry as! ARSCNPlaneGeometry
                    planeGeometry.update(from: planeAnchor.geometry)
                }
                else if let meshAnchor = anchor as? ARMeshAnchor {
                    // reconstruct it since we don't have an efficient way of updating the underlying data
                    node.geometry = SCNGeometry.fromAnchor(meshAnchor: meshAnchor)
                }
                node.simdTransform = anchor.transform
            }
        }
    }</pre>



<p class="wp-block-paragraph">(Note the geometry returned by fromMesh uses a *reference* to the data in ARMeshAnchor so you must implement didUpdate to reconstruct the geometry and didRemove to remove the node so it no longer renders.  If this isn&#8217;t done expect a crash or validation error of some type).</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="715" src="https://andrewgrant.org/wp/wp-content/uploads/2020/04/IMG_060A60769054-1-1024x715.jpeg" alt="" class="wp-image-431" srcset="https://andrewgrant.org/wp/wp-content/uploads/2020/04/IMG_060A60769054-1-1024x715.jpeg 1024w, https://andrewgrant.org/wp/wp-content/uploads/2020/04/IMG_060A60769054-1-300x210.jpeg 300w, https://andrewgrant.org/wp/wp-content/uploads/2020/04/IMG_060A60769054-1-768x536.jpeg 768w, https://andrewgrant.org/wp/wp-content/uploads/2020/04/IMG_060A60769054-1-1536x1073.jpeg 1536w, https://andrewgrant.org/wp/wp-content/uploads/2020/04/IMG_060A60769054-1-2048x1431.jpeg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>A scan of a cat and a mouse</figcaption></figure>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewgrant.org/2020/04/using-the-2020-ipads-armeshanchor-with-scenekit/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>First Post</title>
		<link>https://andrewgrant.org/2020/01/first-post-2/</link>
		
		<dc:creator><![CDATA[Andrew Grant]]></dc:creator>
		<pubDate>Thu, 02 Jan 2020 18:53:27 +0000</pubDate>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[misc]]></category>
		<guid isPermaLink="false">https://andrewgrant.org/?p=134</guid>

					<description><![CDATA[2020. 

A new year, a new decade....]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">2020</p>



<ul class="wp-block-list"><li>New year</li><li>New decade</li><li>New goals</li><li>New site. </li></ul>



<p class="wp-block-paragraph">Let&#8217;s do this <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
