Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by rudolfwm · Feb 17, 2011 at 10:12 AM · textureiphonegraphicswwwformat

Converting downloaded texture into PVRTC on iPhone

I download a series of textures on the iPhone, using the WWW class.

When I download them they are RGBA format.

To conserve memory I want to change them into PVRTC.

How can I do this?

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Eric5h5 · Feb 17, 2011 at 11:31 AM

It's not going to happen, there is no functionality to compress to PVRTC at runtime, and it would take an extremely long time to do it anyway. (It's time-consuming enough on a desktop CPU, never mind mobile.)

Comment
Add comment · Show 5 · 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 rudolfwm · Feb 17, 2011 at 11:33 AM 0
Share

Wow...then how am I going to deal with memory issues?

avatar image Eric5h5 · Feb 17, 2011 at 09:54 PM 1
Share

Use smaller textures?

avatar image rudolfwm · Feb 18, 2011 at 07:37 AM 0
Share

Yes, Im doing that. However the quality of the texture is such that I cant go any lower.

avatar image rudolfwm · Feb 18, 2011 at 07:38 AM 0
Share

I have an idea: can I not save those textures (theyre on my webserver) in the PVRTC format?

avatar image Eric5h5 · Feb 18, 2011 at 08:01 AM 0
Share

No, they can only be JPG or PNG. See the WWW.texture docs.

avatar image
1

Answer by codehead · Oct 21, 2012 at 10:21 PM

I have managed to solve this for Android. I think the same method can be applied for iOS as "the beef of the code" is relying upon standard OpenGL API.

I've uploaded a functional demo of my solution to this problem:

There are two projects:

  1. DynamicCompressedTextureTest - Unity project

  2. CompressedTextureLoader - Eclipse/Android project which contains the sources for "Assets/Plugins/Android/fi.jar"

One thing I'd like to ask from you: When one (or some) of you guys port this to iOS (I haven't yet taken the time), please send me a copy of the code (or post here)!

The idea:

  • Let Unity allocate and do the initial uploading of the compressed texture, the "TexturePlaceholder"

  • When new textures are needed, the placeholder is duplicated (GameObject.Instantiate()) and thus Unity allocates and manages the new copy of the compressed placeholder texture

  • Then, the Android code downloads a new compressed texture data in the background and once it's done, it simply overwrites the Unity managed texture - by uploading the downloaded data using Unity assigned texture ID.

At the time of writing, I didn't have a PowerVR equipped Android at my hands but I've made it working with PVRTC4 the same way some time ago. It's just about making sure that ...

  1. the TexturePlaceholder is compressed with the same method as the ones that are downloaded

  2. the Android code's texture format identifier is set correct

  3. the expected data lengths are set correct (bytes per pixel)

All in all, I think the code is fairly straight-forward, easy to read (not that elegant, though) and shows the common pitfalls to avoid.

I hope this helped, please let me know!

Comment
Add comment · Show 1 · 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 Bunny83 · Oct 21, 2012 at 11:10 PM 0
Share

Wow, that's great. Thanks for sharing.

+1

avatar image
0

Answer by rudolfwm · Feb 17, 2011 at 10:32 AM

I found the answer in the documentation (of course):

Texture2D lTexture = new Texture2D(lWidth, lHeight, TextureFormat. your format here, false);

// assign the downloaded image to the main texture of the object www.LoadImageIntoTexture(lTexture );

Comment
Add comment · Show 3 · 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 rudolfwm · Feb 17, 2011 at 11:15 AM 0
Share

Actually, this results in lTexture converting to ARGB32!!!!!!

any ideas???

avatar image codehead · Feb 14, 2012 at 08:10 AM 0
Share

I'm facing the same issue here. Please look at http://answers.unity3d.com/questions/184840/download-and-use-pvrtc-texture-ios.html#answer-217133

avatar image luisanton · Oct 21, 2012 at 03:34 PM 0
Share

Still no answer? Is it impossible? LoadImageIntoTexture does work with DXT1/5 on desktop, but not with PVRTC on iOS (and DTX1/5 are not supported)...

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Wait for texture to be loaded before starting game 0 Answers

Large memory footprint increase when assigning a GUITexture from a WWW Object on iPad 1 Answer

Parse an online text file 1 Answer

2D car track method 1 Answer

Tutorial on adding texture and images to 3d objects? 2 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