Loading DDS, BMP, TGA and other textures via WWW class in Unity3d
Unity3D/Plugins / 2014. 4. 11. 21:28
WWW로 Texture를 다운받을 때, DDS, BMP,TGA는 다운이 안되길래 검색해보니..
WWW로는 PNG, JPG만 된다고 한다..
다른 포멧도 지원해주는 플러그인이 있길래 링크해놓는다.
Task #5: Loading DDS, BMP, TGA and other textures via WWW class in Unity3d
This article describes the task: Load images via WWW class. Current version of Unity3d allows you to download images via WWW class only in PNG or JPG format (read more here:http://docs.unity3d.com/Documentation/ScriptReference/WWW-texture.html). But we should implement image loading in such formats as DDS, BMP, GIF, PSD, TGA etc.
Demo of application is shown on fig. 1.
Figure 1. – Demo of application
All these image formats are supported by DevIL library (read more here:http://openil.sourceforge.net/features.php).
There is no need for full application description, because DevIL library is well documented and has a lot of examples. I will show only the short description of implementation:
- Load texture using WWW class;
- Get bytes data using «bytes» field of WWW class;
- Create DevIL texture from this data;
- Get Color32[] array from DevIL texture;
- Create Texture2D object based on this color array;
To illustrate implementation I created a demo application. I want to notice that this application loads also MipMaps data from the texture, and creates proper Texture2D.
If you need more detailed description, or implement image loading not supported by unity3d, please write it in comments.
Application demo you can download here:
Source code you can download from here:
출처 : http://denis-potapenko.blogspot.kr/2013/04/task-5-loading-dds-bmp-tga-and-other.html
반응형
'Unity3D > Plugins' 카테고리의 다른 글
Unity3D WebView (0) | 2015.01.21 |
---|---|
유니티 3D상에서 WebView 띄우기 (0) | 2015.01.20 |
Log Viewer (0) | 2014.01.09 |
Mobile Movie Texture (0) | 2013.12.03 |
원격 로그 플러그인 (0) | 2013.11.20 |