x


How to load a large texture at runtime without blocking the pipeline?

I understand that Apply() is not currently yieldable and I work in visualization where I need to load large textures (1k or 2k) at runtime. The loading is not a problem because WWW will do the job nicely in the background but making a Texture2D out of the data requires to go through Apply() at some point and that will block everything until it's done.

Is there a workaround for this? Can't this process of uploading to the graphics card be yielded/interrupted/fragmented/threaded/anything ?

more ▼

asked Dec 30 '09 at 05:21 AM

extragotcha gravatar image

extragotcha
48 1 1 6

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can do this with assetbundles. They have a LoadAsync() method, which takes care of all the processor intensive stuff in a background thread, so it won't produce any hickups.

that does require your downloaded data to already be in the assetbundle format though.

more ▼

answered Dec 30 '09 at 04:59 PM

Lucas Meijer 1 gravatar image

Lucas Meijer 1 ♦♦
8k 19 43 85

Lucas, thank you very much for your reply. I wish Texture2D.LoadImage() was "aSyncable"... they obviously can do it so hopefully it's a matter of time. At the moment my only option is to have a Unity editor running and making asset bundles after downloading the large images.

Is there any way to make assetBundles outside the Editor ?

Thanks again.

Dec 31 '09 at 05:19 AM extragotcha

A further note: this bottleneck happens regardless of whether you use Apply(), www.texture (which creates a Texture2D from the bytes), or www.LoadImageIntoTexture(). Alas, it appears we're two years down the road and no real improvement in this regard. The freeze on my fairly high-end machine is around 40-50 ms per megapixel loaded. We're trying to do a progressive disclosure / map tiling and it's definitely noticeable. Has anyone found any workarounds other than assetBundles in the Unity 3 series?

Dec 21 '11 at 06:15 PM Julien.Lynge
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2199
x491
x472
x354
x42

asked: Dec 30 '09 at 05:21 AM

Seen: 3135 times

Last Updated: Dec 21 '11 at 06:15 PM