Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by Adam-Mechtley · Apr 16, 2010 at 05:09 PM · texturewwwloadingcompression

How can I load pre-compressed textures at run-time (without using assetBundles)

I am wanting to download textures from the web onto the iPhone to use in-game. The textures are generated on a server (not in an assetBundle). I can retrieve the textures as .jpeg or as .pvr with a full mip-map chain. I would prefer the latter for better performance, but I noticed that Texture2D.LoadImage() only allows me to read a byte array of jpeg or png data. Is there either

  • A way to create a texture from the raw pvr data?
  • A way to (efficiently) compress the jpeg data as pvr at run-time and/or (ideally) to save the compressed result to retrieve it later without needing to re-compress it?
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Adam-Mechtley · Apr 16, 2010 at 05:10 PM 0
Share

I guess alternatively: are assetBundles the only way to get a pre-compressed texture into a game at run-time?

avatar image Ben 2 · Apr 26, 2010 at 07:54 PM 0
Share

I'm in a similar boat. I'd like to load pre-compressed textures from external sources. Right now I'm using .png files which are compressed at runtime. Another post mentioned unity support for .dds files. I can produce those externally but I'm not sure yet how to read them in using Unity's API.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by jonas-echterhoff · May 09, 2010 at 08:08 PM

At the moment, using AssetBundles is the only way to load compressed textures into Unity at runtime. The solution Lucas points out will of course work, but it won't let you directly upload compressed texture data to the gpu. You could set up a pipeline on the server, which automatically starts the Unity editor from the command line to create the asset bundles as needed.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
-1

Answer by Lucas Meijer 1 · May 09, 2010 at 08:46 AM

You can use Texture2D.GetPixels() and Texture2D.SetPixels(), each of which takes a mipmap parameter. So what you could do in this case is parse the data that comes from your server yourself, and manually create a new Texture2D, and then manually set all pixels for all mipmap levels. You could even make your server output a bunch of pngs. one for each mipmap level, and then use Unity's png importer to do the heavy lifting for you, and just move over the colors into your texture under construction.

Update: see Jonas' answer instead, as my approach indeed doesn't DXT compress the texture at runtime. Note to self: add feature.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ddt · Apr 16, 2012 at 03:51 AM

Is there a way to get raw images loaded all the way to the GPU (ARGB32 is fine) asynchronously?

I don't know any way to do this without AssetBundles, and it forces you to import the assets, which tends to swell up my awesomely tight PNG formats.

Thanks!

ddt@davetaylor.name

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Texture loading via www.texture not loading! 2 Answers

Tile loading issue 2 Answers

Load Texture at Run time from file 1 Answer

loading from disk, saving to database 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges