Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping extremely high resolution to sphere in SceneKit

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?

like image 817
Timestretch Avatar asked Oct 30 '22 17:10

Timestretch


1 Answers

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.

like image 89
Hal Mueller Avatar answered Nov 15 '22 05:11

Hal Mueller