Categories: Unity, C #, VS2015
Date Created: 2016-04-05 I. INTRODUCTION
Unity supports a number of image file formats, including TIF, PSD, TCA, JPC, PNG, GlF, BMP, IFF, PICT, DDS, and more.
In addition, unity supports images made in Photoshop with a PSD format that contains multiple layers. PSD format Picture This layer is automatically merged after it is imported into unity, and the operation does not break the structure of the PSD source file. Second, picture format and size requirements
In order to optimize the operation efficiency, in almost all of the game engine, the pixel size of the picture needs special attention, it is recommended that the image file size is 2 n power, such as 32, 64, 128, 256, 1024, and so on. The length and width of the picture is not required. such as 512*1024, 256*64 and so on are reasonable.
In addition, it is important to note that although unity also supports images that are not 2 power-sized, it is traded at the expense of "slow loading and larger image file sizes". If you convert this image to a power of 2 N, the image quality will be degraded by changing the original proportions of the image. Therefore, the production of image resources, must be in accordance with 2 of the size of an integer power to make, or else is asking for trouble. Third, the picture resource after the Import property settings
Unity is a platform for the launch of the game's engine, simply in terms of picture resources, in different platform hardware environment for the use of a certain difference. If you manually make or modify the corresponding size of the picture resources for different platforms, it will be very inconvenient and will bring a lot of work.
To address cross-platform issues, Unity provides users with a dedicated solution. The same picture texture can be directly related to different platforms in the project, the efficiency is very high.
This article mainly describes how to set up the image resources according to different platforms.
1. Import Picture Resources
In unity, there are two common ways to import picture resources into your project:
Method 1: Copy or cut the picture file directly into the assets folder or its subfolders under the project folder, which can import multiple picture resources at the same time.
Method 2: Import the picture resources through the Unity menu, which can only import one picture at a time.
2. Setting properties
Click to select an imported picture resource, and in the viewer, make the appropriate picture size settings based on the platform you are ready to publish. That is, unity automatically adjusts the size of the picture as it is set when it is finally released.
The relevant properties are as follows:
Default: Defaults (default settings for all platforms).
Maxsize: Maximum texture size. The maximum size of the selected texture can be adjusted. The range of values is 32, 64, 128, 256, 512, 1024, 2048, 4096, respectively.
Format: Formatting. The compression format that is used to not place the image, the options are:
- Compressed (compressed texture): This is the default option and is the most commonly used texture format. The compressed format is automatically selected based on the published platform.
- 16bit:rgb color, 16-bit color charts can have up to 2 of 16 power colors (Low-quality true color). Note This format is non-compressed and consumes a large amount of disk space.
- True Color: True colour, which is the highest-quality 32-bit True Color (256x256 's texture size occupies a space capacity of 256KB). Note This format is non-compressed and consumes more disk space.
- Advanced: Specifies a different format for the texture (it is seldom used).
- Compression Quality: Compression quality. This entry appears only under the override for Android and override for Flashplayer entries.
- Override for Android: Overwrite to Android platform. There are 3 options available in this mode: Fast, Normal, best, which in turn represents the compression quality from low to high.
- Override for Flashplayer: Overwrite to flash Player. This mode controls the compression quality by numerical value, the range of values is 0~100, or you can directly drag the slider to adjust.
Revert: Click this button to cancel.
Apply: Click this button to apply the settings. Iv. setting of the image resource type
In unity, depending on the purpose of the image resource, the type of image that needs to be fixed, such as normal textures, normal maps, GUI images, reflection maps, light maps, and other types of images should be formatted to achieve the best results.
For game making, the type setting of the picture is very important.
1, Texture
Texture type: Texture types. Includes texture (texture), NORMD map (normal map), GUl (graphical user interface), Cursor (icon file), Reflection (reflection), cookies (cookies for light sources), LIGHTMAP (Illumination map), Advanced (Premium) and other types.
Alpha from Crayscale: Produces an alpha channel based on grayscale. Tick to create an alpha transparency channel based on the grayscale value of the image itself.
WMP mode: Looping modes. There are two ways you can choose to control the style of texture tiling:
- Repeat: Repeat. This is the default option, and after you select the item, the texture is mapped to the game object in a repeating tile.
- Clamp: Clamp/truncate. Selecting the Xu will map the edge of the texture to the game object.
Filter Mode: Filter modes. Controls how the texture is computed (filtered) when stretched by a three-dimensional transformation, with the following options:
- Point: Dot mode. This is a simple way to manipulate the image interpolation of a material, using the map that contains the most part of the pixel. In short, the pixel that takes up the most pixels is mapped with this graph. This process is faster, but the quality of the material is poor, there may be "mosaic" phenomenon.
- Bilinear: bilinear filtering. This is a better way of processing the image interpolation, will first find the nearest pixel four pixels, and then do interpolation between them, the final result will be posted to the location of the pixel, so you do not see "mosaic." This method is suitable for static imagery with a certain depth of field, but does not provide the best quality and is not suitable for moving game objects.
- Trilinear: three linear filtration. This is a more complex texture image interpolation process, will use a lot of material maps, and each size is exactly the other-Zhang's four-percent. For example, if there is a 512x512 image of a material, then the second one will be a 256x256, and so on. With these multi-resolution material images, this approach provides the highest texture quality when encountering scenes with greater depth of field, removing the "flicker" effect of the material. This is the best option for scenarios where dynamic objects or depth of field are required.
Aniso level: anisotropic. When you look at a texture in a small way, the higher the value, the higher the quality of the texture that is observed, which is obvious for improving the appearance of textures such as ground.
2. Normal Map
The normal map type. Select this type to change the image color channel into a format appropriate for normal mapping.
Create from grayscale: Generates an alpha channel based on grayscale. Tick the item to calculate the bump value of the normal map based on the grayscale value of the image itself.
Bumpiness: Bump strength adjustment, which controls the amount of bump in the decal.
Filtering: Filter. Controls how the normal map's bumps are calculated by:
- Smooth: Smooth, the normal map produced in this way is smoother.
- Sharp: sharpening, the normal map produced in this way is clearer and sharper.
3. GUI
The graphical user interface type. Select this type to apply textures to the texture format used by the Hud/gui. Note that if the integer power of the texture is non-2, and the texture type is set to gui,unity, the texture is cast to true color format.
4. Cursor
Icon file. Select this type to apply textures to the texture format used by the cursor.
5, Relection
Reflection. Select this type, similar to cubemaps (cubic thoughtfulness), which applies to the texture format used for reflection.
Properties are:
Mapping: Map. This determines how the reflection map maps to the cube map. There are 5 kinds:
- Sphere Mapped: Spherical wrapping method. The image is mapped to the reflection map in a spherical way.
- Cylindrical: Cylindrical way. The texture is mapped to the reflection map in a cylindrical manner.
- Simple Sphere: simply spherical. The image is mapped to a simple sphere, and the reflection is deformed when rotated.
- Nice sphere: delicate spherical. The image is mapped to a spherical shape, and the reflection is deformed when rotated.
- 6 Frames layout:6 frame layout. This is the default setting. It can be understood that the six images contained in the picture are mapped to 6 faces of a cube, respectively.
Fixup edqe seams: fixed edges at seams. When the reflection map has a seam, you can try to check this option to control it.
6. Cookies
A cookie that acts on a light source, with the following attributes:
Light type: source types. The item is used to specify the type of light that the texture plan acts on, and the options are:
Spot light: Spotlight. If you select this type of light, it is recommended that the edges of the texture be guaranteed to be pure black, and wrap mode is set to clamp. This will get the right results.
Directional: Parallel light source. If you select this type of light source, it is recommended that wrap mode is set to repeat. This will get the right results.
Pont: Point Light.
7, Lightmap
Light map. Select this type to not set the image as the format for the lighting map.
8. Advanced
Senior. Select this type to have a high level of texture.
Non Power of 2: The image size is not an integer power of 2. This item is available only if you have imported and selected an integer power-size image of 2. The main function of this item is to scale the image size to an integer power of 2, with the following options:
- None: None. The image size is not processed.
- To Nearest: Adjusts to the nearest dimension. Zooms the image size to the size of the nearest 2 to the power of the whole number. For example, an image of 513x1013 pixels will be scaled to 512x1024 pixels.
- To larger: adjust to larger (size). Enlarges the size of the image to the power of the whole number of the nearest 2. For example, an image of 257x513 pixels will be magnified to 512 024 pixels.
- To Smaller: adjust to smaller (size). Reduces the size of the image to a smaller power size of the whole number nearest 2. For example, an image of 254x511 pixels will be reduced to 256x256 pixels.
Cenente cube map: Generates a cube map. Only non Power of 2 has been selected for a type other than none. Use different ways to generate a cube map for the image, with the options:
- None: The image is not generated as a cube map.
- Sphere Map: Spherical parcel map. The image is mapped to a cube map in a spherical way.
- Cylindridal: Cylindrical map. The image is mapped to a cube map in a cylindrical manner.
- Simple Sphere Map: Easy spherical map. The image is mapped to the cube map in a simple spherical way.
- Nice sphere map: delicate spherical map. The image is mapped to the cube map in a finely spherical manner.
Well, while this section looks boring, these basic concepts are important. If you don't know the basics, the game products you make may feel good, but it's hard to convince others to achieve the best results.
"Unity" 3.6 Importing picture resources