title: Optimizing SceneKit performance with high-res textures
body: <p>I'm a fairly experienced iOS developer but a total SceneKit newbie, trying to simulate some planets in a basic app.</p>
  
  <p>To that end, I'm using high-res normal and diffuse maps of Mars, Venus, etc, applied to basic spheres.  And they work!  They look awesome, exactly what I was going for.</p>
  
  <p><a href="https://i.stack.imgur.com/zz8Bv.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/zz8Bv.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/goQye.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/goQye.jpg" alt="enter image description here"></a></p>
  
  <p>The problem is, I'm getting <em>killed</em> by the quality/memory tradeoff.  </p>
  
  <p>I can scale down the dimensions of the textures to reduce the memory footprint, but below a certain resolution the results (especially the normal map) start to look really mushy and terrible.  The app needs to be able to zoom at least to where the planet is screen-width, but to maintain any crispness in the mountains and valleys I need to use a PNG normal map (above) at about 6000 x 3000.  I can scale the diffuse map way down to about 1000 x 500, but even so, <strong>I'm getting periodic memory crashes from a single sphere gently rotating, with a single light, no background, no physics, and no other geometry.</strong></p>
  
  <p>Now, <em>I know</em> that's a super-high-res normal map.  I get it.  But at the same time, it's just one sphere, doing nothing.  That's not even close to some of the complexity I've seen other apps execute flawlessly, even with some pretty detailed textures of their own.  It seems like there must be some way of getting high-detail surface textures for a single object, without crashing the app.</p>
  
  <p>So, being a total SceneKit newbie, I'm wondering: <strong>are there any tricks for getting good SceneKit texture quality without using ALL the memory in the world?</strong>  Maybe a way of handling the image textures, re-encoding the files, changing the scene/node settings, etc?  Any way at all to get crisp quality with smaller images, or lower memory usage with the same images?</p>
  
  <p>I'd happily quote some code, but right now there isn't much to show.  I apply the textures to the SceneKit node the standard way, and it works.  I'm just dying from either a lack of memory, or lack of image quality.</p>
  
  <p>Can anyone help me out?</p>