Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seamless async scene and textures loading - Unity & GearVR

I've got two major problems with Unity (5.3.4p1) on GearVR with Samsung S6:

1) Async scene loading. 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. 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.

2) Creating textures from images downloaded using WWW class. I use 360 4k image displayed on a dome in another scene. When I try to download a texture (4k, PNG or JPG) in runtime it's done asynchronously. But the Unity freezes for 2-3 seconds when I use:

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? The good example of smooth texture loading can be seen in Flickr VR app but I doubt they used Unity to create this app.

This two problems occurs also on Oculus Rift but are less noticable because of much better PC performance.

Generally, I want to achieve smooth loading experience in Gear VR using Unity. Is this somehow possible?

like image 305
jakub.sz Avatar asked Oct 19 '22 11:10

jakub.sz


1 Answers

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. Timewarp should still be working so head orientation changes will be visible.

AD 2: Android devices can't render jpeg or pngs. 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.

What you can do is have the textures in the native DXT or ETC format and load them them as a texture yourself. I had the same issue and this has sped up loading my textures almost 10 times. 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.

like image 58
Krzysztof Bociurko Avatar answered Oct 21 '22 06:10

Krzysztof Bociurko