SceneKit Performance Optimization with High Resolution Textures

I am a pretty experienced iOS developer, but new to SceneKit, trying to simulate some planets in the base application.

To this end, I use the usual and diffuse maps of Mars, Venus, etc., applied to the main spheres. And they work! They look amazing, exactly what I'm going to do.

enter image description here enter image description here

The problem is that the quality / memory tradeoff is killing me.

I can reduce the size of the textures to reduce the amount of memory, but below a certain resolution, the results (especially the normal map) begin to look very muddy and terrible. The application should be able to scale at least to the point where the planet is the width of the screen, but to maintain clarity in the mountains and valleys I need to use a regular PNG map (above) about 6000 x 3000. I can scale the diffuse path of the map to about 1000 x 500, but even in this case I get periodic memory failures from one sphere, gently rotating, with one light, without background, without physics and without any other geometry.

Now I know that a normal super-high resolution card. I understood. But at the same time, it’s just one area, doing nothing. This is not even close to the complexity that I saw, other applications run flawlessly, even with some fairly detailed textures. There seems to be some way to get high detail surface textures for a single object, without application crashes.

So, being a SceneKit newbie, I wonder: are there any tricks to get a good quality SceneKit texture without using ALL the memory in the world? Perhaps a way to process image textures, transcode files, change scene / node settings, etc.? Any way to get crisp quality with smaller images or reduce memory usage with the same images?

I would love to quote some code, but right now there is not much to show. I apply textures to the SceneKit node in a standard way, and it works. I'm just dying of a lack of memory or lack of image quality.

Can anyone help me out?

+5
source share
1 answer

I think the idea is to segment the texture of the sphere so that it only displays 60 degrees of the texture at any time, similar to how you display high resolution images when scaling. I'm not sure how to do this, but this is my hunch.

0
source

Source: https://habr.com/ru/post/1232135/


All Articles