简体   繁体   English

无缝异步场景和纹理加载 - Unity&GearVR

[英]Seamless async scene and textures loading - Unity & GearVR

I've got two major problems with Unity (5.3.4p1) on GearVR with Samsung S6: 我在使用三星S6的GearVR上的Unity(5.3.4p1)遇到两个主要问题:

1) Async scene loading. 1)异步场景加载。 Is there any change that I can load a new scene in background without seeing small freezes? 是否有任何变化我可以在背景中加载新场景而不会看到小的冻结? Scene has ~60k triangles and uses a couple of 4k textures and ~10 other 2k textures. 场景有~60k三角形,使用了几个4k纹理和~10个其他2k纹理。 When this scene is loading there are multiple short freezes. 当这个场景加载时,有多个短暂的冻结。 I know I can avoid this by fading out to black and then starting loading level. 我知道我可以通过淡出黑色然后开始加载级别来避免这种情况。 But it takes ~10 seconds and user might be confussed seeing black screen for such long time with VR headset on. 但是需要大约10秒钟,用户可能会因为看到黑色屏幕而长时间使用VR耳机而感到困惑。

2) Creating textures from images downloaded using WWW class. 2)使用WWW类下载的图像创建纹理。 I use 360 4k image displayed on a dome in another scene. 我在另一个场景中使用360 4k图像显示在圆顶上。 When I try to download a texture (4k, PNG or JPG) in runtime it's done asynchronously. 当我尝试在运行时下载纹理(4k,PNG或JPG)时,它是异步完成的。 But the Unity freezes for 2-3 seconds when I use: 但是当我使用时,Unity会冻结2-3秒:

Texture2D myTexture = www.texture;

Is there any option to avoid this other than use downloaded bytes and decompress JPG or PNG using non-Unity algorithm on background and then load created rgb values to a new texture? 除了使用下载的字节并在背景上使用非Unity算法解压缩JPG或PNG然后将创建的rgb值加载到新纹理之外,有没有其他选项可以避免这种情况吗? The good example of smooth texture loading can be seen in Flickr VR app but I doubt they used Unity to create this app. 在Flickr VR应用程序中可以看到平滑纹理加载的好例子,但我怀疑他们使用Unity来创建这个应用程序。

This two problems occurs also on Oculus Rift but are less noticable because of much better PC performance. 这两个问题也出现在Oculus Rift上,但由于PC性能要好得多,因此不太明显。

Generally, I want to achieve smooth loading experience in Gear VR using Unity. 通常,我希望使用Unity在Gear VR中实现平滑的加载体验。 Is this somehow possible? 这有点可能吗?

This question should have been posted as two separate questions, but still: 这个问题本应作为两个单独的问题发布,但仍然是:

AD 1: Add a small preloader scene, render that to the user and them load the main scene. AD 1:添加一个小的预加载器场景,将其呈现给用户并加载主场景。 Timewarp should still be working so head orientation changes will be visible. 时间扭曲应该仍然有效,因此可以看到头部方向的变化。

AD 2: Android devices can't render jpeg or pngs. AD 2:Android设备无法呈现jpeg或png。 They have to decompress them to very large uncompressed textures, load to memory again and only then render. 他们必须将它们解压缩到非常大的未压缩纹理,再次加载到内存然后才渲染。 This takes both lots of ram and time. 这需要大量的ram和时间。

What you can do is have the textures in the native DXT or ETC format and load them them as a texture yourself. 你可以做的是拥有原生DXT或ETC格式的纹理,并自己将它们加载为纹理。 I had the same issue and this has sped up loading my textures almost 10 times. 我有同样的问题,这加快了我的纹理加载几乎10倍。 They use less memory too. 他们也使用更少的内存。

Be warned that the download size will be bigger and depending on texture format you might have to have different files for different platforms. 请注意,下载大小会更大,并且根据纹理格式,您可能必须为不同平台提供不同的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM