使用高分辨率纹理优化SceneKit性能 [英] Optimizing SceneKit performance with high-res textures

查看:166
本文介绍了使用高分辨率纹理优化SceneKit性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一位经验丰富的iOS开发人员,但是是一个总的SceneKit新手,试图在基本应用程序中模拟一些行星.

I'm a fairly experienced iOS developer but a total SceneKit newbie, trying to simulate some planets in a basic app.

为此,我使用火星,金星等的高分辨率法线和漫反射贴图,并将其应用于基本球体.他们工作!他们看起来很棒,正好是我想要的.

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.

问题是,我因质量/内存折衷而被杀死.

The problem is, I'm getting killed by the quality/memory tradeoff.

我可以按比例缩小纹理的尺寸以减少内存占用,但是低于一定分辨率时,结果(尤其是法线贴图)开始显得非常糊状和可怕.该应用程序必须至少能够缩放到星球的屏幕宽度,但是要保持山脉和山谷的清晰度,我需要使用6000到3000左右的PNG法线贴图(上方).我可以缩放漫反射贴图的大小降低到大约1000 x 500,但即使如此,我还是会从单个球体,没有光源,没有背景,没有物理场以及没有其他几何体的情况下轻轻旋转的周期性球体崩溃中.

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, I'm getting periodic memory crashes from a single sphere gently rotating, with a single light, no background, no physics, and no other geometry.

现在,我知道,这是一个超高分辨率法线贴图.我得到它.但同时,这只是一个领域,什么也没做.这甚至与我见过的其他应用程序完美无缺地执行的某些复杂度甚至还很接近,即使它们本身具有一些非常详细的纹理.似乎必须有某种方法可以在不使应用程序崩溃的情况下为单个对象获取高细节的表面纹理.

Now, I know 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.

所以,作为一个总的SceneKit新手,我想知道:是否有任何技巧可以在不使用世界上所有内存的情况下获得良好的SceneKit纹理质量? ,重新编码文件,更改场景/节点设置等?可以通过任何方法在较小的图像上获得清晰的图像质量,还是在相同的图像上降低内存使用量?

So, being a total SceneKit newbie, I'm wondering: are there any tricks for getting good SceneKit texture quality without using ALL the memory in the world? 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?

我很乐意引用一些代码,但是现在没有什么可显示的了.我以标准方式将纹理应用于SceneKit节点,并且可以正常工作.我只是因为内存不足或图像质量不足而死.

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.

有人可以帮我吗?

推荐答案

我的想法是明智地分割球体纹理,因此在任何时候它都只能显示60度的纹理,类似于您在高分辨率时显示图片的方式缩放.我不确定该怎么做,但这是我的猜测.

I think the idea is to segment the sphere texture wise so it's only displaying perhaps 60degrees of texture at anyone time, similar to how you display pictures at high resolutions when zooming. I'm not sure how to go about doing that, but that is my guess.

这篇关于使用高分辨率纹理优化SceneKit性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆