Importing Textures

From ETC Public Wiki
Jump to: navigation, search

Note: For additional resources, visit http://unity3d.com/support/documentation/Manual/Textures.html

Textures

  1. Unity accepts the following file formats: PSD, TIFF, JPG, TGA, PNG, GIF, BMP, IFF, PICT. It is useful to note that files with multiple layers are acceptable, as Unity will automatically flatten the image when Unity uses them. However, the original file will maintain layers.
  2. Texture sizes should be in powers of 2, e.g. 128, 1024 or 2048. Non powers of 2 sizes are accepted but will be less efficient. The width and the height do not need to be the same, e.g. 512 x 1024 is acceptable.


Importing Textures

  1. First, import the textures into Unity by dragging the files from your folder into Unity's Project panel. For organization's sake, it is recommended that you first create a textures folder to hold all of these files (See Figure 1). File:Texturesfigure1.jpg
  2. You may click on the texture file in the Project panel to open it in the Inspector and mess with the settings (See Figure 2). Information on the settings can be found here: http://unity3d.com/support/documentation/Manual/Textures.html File:Texturesfigure2.jpg
  3. Find the Material associated with the Model. This is likely in the Materials folder in the Project panel that was created when the Model was imported into Unity. Click on that Material to open it in the Inspector.
  4. The Material is set to Shader: Diffuse by default. In most cases, this will be sufficient. You can learn more about Shaders here: http://unity3d.com/support/documentation/Manual/Shaders.html
  5. Click-and-Drag the texture file into the dark grey box in the section called "Main Color" (See Figure 3) to assign the texture to the Material. File:Texturesfigure3.jpg
  6. The Model should have the texture assigned to it now. Make sure to check the Model to make sure the texture is assigned (Click-and-Drag the Model file into the Scene View to see).
  7. A quick and dirty way to assign a texture is to simply Click-and-Drag the Texture file from the Project panel to the Mesh in the Scene View.
  8. You can also assign Materials to a Mesh by opening the Mesh in the Inspector and Click-and-Drag the Material into the inspector.


Shaders

Unity has its own set of Shaders which you can use. There are 40 that are included in Unity, as well as additional ability to write your own shaders.

For information on Built-in Shaders, go here: http://unity3d.com/support/documentation/Components/Built-in%20Shader%20Guide.html

For more information about Shaders in general, visit: http://unity3d.com/support/documentation/Manual/Shaders.html and http://unity3d.com/support/documentation/Components/SL-Reference.html.

For most purposes, the included Shaders should be sufficient. The Unity Standard Assets also has some additional Shaders included like Water and Glass. To import these (if you haven't already) go to the Project Panel, Right-click and go to Import Packages. From there, pick and choose whatever you want.


Normal Mapping

Similar to Bump Mapping, Normal Mapping is a way to make an object's surface seem to have depressions or protrusions (dips or bumps) without actually adding more geometry. Bump Maps use a grayscale map to achieve this. Normal Maps use a full-color map, but that map is generated from a higher-poly version of the model onto which you intend to apply the Normal Map. Learn how to do so here: http://unity3d.com/support/documentation/Manual/HOWTO-Normalmap.html


Alpha Textures

If you want to, say, put a texture on a plane to make it look like a leaf instead of a square, you will have to deal with the Alpha layer. This will make it so that only the leaf portion of the texture will show up and the empty part will be completely transparent, effectively turning a plane into a leaf.

Go here to learn how to do Alpha Textures: http://unity3d.com/support/documentation/Manual/HOWTO-alphamaps.html