Unity3D & amp; TexturePacker, unity3d Official Website

Source: Internet
Author: User

Unity3D & TexturePacker, unity3d Official Website

What is TexturePacker? Those who have used cocos2d should have a better understanding of this (I can ignore the explanation below ~), It doesn't matter if you don't understand it. TexturePacker can be said to be a large image that can be made up of many small Atlas images and saved as a file, what you need to do is to parse the image location information file and display a small cut graph in combination with the big picture set. This is what we need to do below.
In this way, the benefit of merging a large image is that it can reduce the memory used by the program to load resources, because each texture in OpenGL ES needs to be set to the n of 2 for use. For example, if you have an image with a width and height of X and a width and height of 10x10, you need to use two images of x and 16x16 (7 times of 2 and 4 power of 2), but if you use a large image, you can put 100x100 and 10x10 images in a large graph of x128 to use an image.
 

A large texture similar to this is synthesized by many small images. In actual use, only one of the textures is displayed.

The following describes how to use TexturePacker:

After the software is opened, the interface is like that. Drag and Drop the image you want to synthesize to the Sprites panel on the right to automatically sort and display the effect in the middle.
Here is a brief description of the properties circled in red on the left.
Data Format here is the Data Format to be exported, the drop-down box is cocos2d, libgdx, Unity3d and so on..., this article chooses JSON-ARRAY;
Data file: This is the directory where the information file of the exported image set is stored, and the file needs to be parsed later. You can select the directory on the right of this option, after the directory is set, the Texture file option will automatically fill in the corresponding directory file.
Image format: sets the encoding format of the Image set for exporting large textures. You can set the encoding format according to your specific requirements;
The second red box
Border padding is used to set the spacing between images. This is useful if it is set to 0. However, the edges of the cropped images may be switched to other images, therefore, you must set a value.
The Allow rotation check box is used to set whether your textures can be rotated and stored in a large set of textures. Generally, you can use some space. The Trim check box is used to automatically remove unnecessary parts from the thumbnail. For example, if it is hooked up, it is the effect from the left to the right, and the transparency of the edge is removed, which can greatly save resources.

1353868973_8697.png (15.2 KB, downloads: 0)

Download the attachment and save it to the album.

Upload 1 minute ago


After setting, press the Publish button on the toolbar to export the file. The exported directory is the directory of the Data file. If the exported big image in the free version has a watermark, this is normal. After the image is exported, a large texture set and a file format are found in the corresponding directory. The exported format is as follows:
 

Because we intend to use the LitJson library for parsing, we naturally export the Json data structure.

Some other attributes are also set to export some attributes of the big image. You can play with them if you like;
Disclaimer: This document is from the "Dog Learning Network" community. It is an Unity3D learning article published by netizens. If any content infringes on your rights and interests, please contact the official website, it will be processed in real time.
More highlights: www.gopedu.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.