In my iOS app, I have a set of planet maps as images, some as large as 14k resolution. I can apply downsized versions to spheres to create models of planets in SceneKit. However, I want users to be able to zoom in to see details on the full resolution images. I also want to be able to do this without my app running out of memory. Is there a way to automatically tile textures to a sphere like Google Maps does, and only load the parts and resolutions when they are needed?
Two optimization techniques that you can apply using very little programming effort are mipmaps and levels of detail.
If you set the mipFilter
property of the SCNMaterial
representing your planet map, you'll get an automatically generated mipmap.
If you supply some SCNLevelOfDetail
instances for your planet's SCNGeometry
, you'll get versions with highly reduced polygon counts that will save memory.
These are both mentioned in the 2013 WWDC SceneKit talk. SCNLevelOfDetail
is mentioned again in 2014. The 2014 sample code has examples of both: mipmap generation in the AAPLPresentationViewController, and LOD in slide 58.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With