Textures
版本检查: 4
-
难度: 新手
What are Textures? How does Unity use and import them?


Textures
新手 Graphics
脚本
- 00:01 - 00:02
Textures.
- 00:02 - 00:04
A texture is an image file.
- 00:04 - 00:07
Unity uses textures in a number of different ways.
- 00:07 - 00:09
The most common use of a texture is when
- 00:09 - 00:11
applied to a material in the base
- 00:11 - 00:13
texture property to give a mesh a
- 00:13 - 00:15
textured surface.
- 00:15 - 00:17
For more information on materials
- 00:17 - 00:19
see the appropriate lesson.
- 00:20 - 00:21
Textures can also be used for
- 00:21 - 00:23
GUI elements applied to additional
- 00:23 - 00:25
material properties to act as normal
- 00:25 - 00:27
maps, specular maps or height maps.
- 00:27 - 00:30
Used as custom cursors, icons,
- 00:30 - 00:32
splash screens and more.
- 00:32 - 00:34
Textures can be any image file
- 00:34 - 00:35
supported by Unity.
- 00:35 - 00:37
These can be photos straight from a
- 00:37 - 00:39
digital source, but textures are usually
- 00:39 - 00:42
images created or manipulated in an image
- 00:42 - 00:44
editor, like Photoshop or Gimp.
- 00:45 - 00:47
It is important to note that the layered
- 00:47 - 00:49
files will be flattened on import
- 00:49 - 00:51
but the layers are maintained in
- 00:51 - 00:53
Unity in the original file.
- 00:53 - 00:55
This means we can turn layers on and off
- 00:55 - 00:57
without loss when we're setting up our game
- 00:57 - 00:59
but when we're running our game we will not
- 00:59 - 01:01
have access to these layers individually.
- 01:01 - 01:03
Most of the image file formats used by
- 01:03 - 01:05
Unity support transparency.
- 01:06 - 01:07
The notable exception is JPEG,
- 01:07 - 01:09
which does not.
- 01:09 - 01:11
For more information on transparency
- 01:11 - 01:12
and how to use it, see the documentation on
- 01:12 - 01:14
materials and shaders.
- 01:15 - 01:18
Texture files should be saved in the assets folder.
- 01:18 - 01:20
Unity searches the assets folder
- 01:20 - 01:22
in a specific order when seeking materials.
- 01:23 - 01:25
For more information on searching for textures
- 01:25 - 01:27
and seeking materials see the lesson
- 01:27 - 01:28
on mesh importing.
- 01:30 - 01:32
A texture file should be assigned import
- 01:32 - 01:34
settings in the texture importer.
- 01:34 - 01:36
Texture Type property contains a
- 01:36 - 01:37
list of presets.
- 01:38 - 01:40
These limit the number of editable properties
- 01:40 - 01:42
available in the texture importer
- 01:42 - 01:44
based on the intended use for the image.
- 01:45 - 01:47
The default is Texture.
- 01:47 - 01:50
Advanced will expose all of the available
- 01:50 - 01:52
properties in the texture importer.
- 01:53 - 01:55
The other presets, including advanced,
- 01:55 - 01:57
will be covered in another lesson.
- 01:58 - 02:00
If we need to set the transparency
- 02:00 - 02:03
or alpha channel for the texture automatically
- 02:03 - 02:05
based on the light and dark parts of the image
- 02:05 - 02:08
we can check the Alpha From Greyscale field.
- 02:08 - 02:10
Black will be completely transparent,
- 02:10 - 02:12
white will be completely opaque.
- 02:13 - 02:15
Wrap Mode controls how the texture is mapped
- 02:15 - 02:17
on to a renderer when tiled.
- 02:17 - 02:19
This setting works for both 2D elements
- 02:19 - 02:21
and 3D meshes.
- 02:22 - 02:24
Repeat will repeat the texture and
- 02:24 - 02:27
and Clamp will stretch the edges of the texture.
- 02:27 - 02:29
Filter Mode controls how the graphics
- 02:29 - 02:31
card renders the texture,
- 02:31 - 02:33
when it is stretched by 3D transformations.
- 02:34 - 02:36
These are effectively quality settings,
- 02:36 - 02:38
trilinear being the best and
- 02:38 - 02:40
point being the most basic.
- 02:41 - 02:43
Aniso level controls the quality of
- 02:43 - 02:45
textures when rendered at steep angles.
- 02:46 - 02:48
Anisotropic Filtering increases the
- 02:48 - 02:50
texture quality when viewed at
- 02:50 - 02:51
a grazing angle.
- 02:51 - 02:53
This has an increased rendering cost when applied.
- 02:54 - 02:56
In quality settings, Anisotropic filtering
- 02:56 - 02:58
can be forced on for all textures
- 02:58 - 03:00
or disabled completely.
- 03:00 - 03:02
For more information on quality settings
- 03:02 - 03:04
see the appropriate lesson.
- 03:04 - 03:06
Because Unity supports building to
- 03:06 - 03:08
multiple target platforms from one project
- 03:08 - 03:11
the texture importer allows for a default
- 03:11 - 03:13
setting for max texture size
- 03:13 - 03:14
and compression format that can be
- 03:14 - 03:17
overridden on a per platform basis.
- 03:17 - 03:19
Max Size will set the maximum size for
- 03:19 - 03:21
for the imported texture.
- 03:21 - 03:23
If max size is set to a value larger
- 03:23 - 03:25
than that of the original image the size
- 03:25 - 03:26
of the imported texture
- 03:26 - 03:28
will be that of the original.
- 03:28 - 03:30
This setting will not make the texture
- 03:30 - 03:32
larger than the original image.
- 03:33 - 03:35
If max size is set to a value less
- 03:35 - 03:37
than the original image the texture will
- 03:37 - 03:39
be resized to that value on import.
- 03:39 - 03:41
Like layers, however, the original
- 03:41 - 03:43
file is unchanged.
- 03:43 - 03:45
Only the imported asset will be adjusted.
- 03:47 - 03:49
Format sets the compression technique.
- 03:49 - 03:51
The default settings are relatively simple
- 03:51 - 03:53
when using the Texture preset.
- 03:54 - 03:56
These are effectively quality settings of
- 03:56 - 03:57
low, medium and high.
- 03:58 - 04:00
More control can be set on a per
- 04:00 - 04:03
platform basis, or when using the Advanced setting.
- 04:04 - 04:06
Each target platform can have it's own settings
- 04:06 - 04:08
that override the default values.
- 04:09 - 04:11
Max size and compression can be adjusted
- 04:11 - 04:13
for each target platform.
- 04:13 - 04:15
This means we can set the target sizes
- 04:15 - 04:17
and compression appropriate for the
- 04:17 - 04:19
bandwidth and processing power
- 04:19 - 04:20
of the target platform.
- 04:21 - 04:23
When the build target is changed these
- 04:23 - 04:25
assets will be reimported using the
- 04:25 - 04:27
overridden values.
- 04:28 - 04:30
This section works in conjunction with Build Settings.
- 04:30 - 04:32
For more information on Build Settings
- 04:32 - 04:34
please see the appropriate lesson.
- 04:34 - 04:37
At the bottom of the importer is a preview window.
- 04:37 - 04:39
When the preview window is open we can
- 04:39 - 04:40
view the changes we have made.
- 04:41 - 04:43
We will need to apply our settings before
- 04:43 - 04:45
the preview window will update it's display.
- 04:46 - 04:48
The preview window will display the image
- 04:48 - 04:50
being imported and report basic information
- 04:50 - 04:52
about the imported texture, including
- 04:52 - 04:53
the size of the imported texture,
- 04:53 - 04:55
the compression setting and the footprint
- 04:55 - 04:57
of the texture in our game.
相关教程
- Materials (课程)
相关文档
- Texture 2D (手册)
- Material (手册)
- Texture (脚本参考)

Graphics
- Introduction to Lighting and Rendering
- Choosing a Lighting Technique
- The Precompute Process
- Choosing a Rendering Path
- Choosing a Color Space
- High Dynamic Range (HDR)
- Reflections
- Ambient Lighting
- Light Types
- Emissive Materials
- Light Probes
- Introduction to Precomputed Realtime GI
- Realtime Resolution
- Understanding Charts
- Starting the precompute process
- Probe lighting
- Unwrapping and Chart reduction
- Optimizing Unity's auto unwrapping
- Understanding Clusters
- Fine tuning with Lightmap Parameters
- Summary - Precomputed Realtime GI
- Lighting Overview
- Lights
- Materials
- The Standard Shader
- Textures
- Using Skyboxes
- A Gentle Introduction to Shaders
- Using detail textures for extra realism close-up
- Frame Debugger
- Where to Start?
- Preparing Unity Render Settings
- Lighting Strategy
- Modeling
- Standard Shader/Material PBS and texturing
- Lighting and Setup
- Understanding Post Process Features
- Dynamically Lit Objects
- Sample Project File
- Using Cameras
- Using Lights
- Fun with Lasers!
- The Particle System
- Cinematic Explosions - PIT
- Cinematic Composition - PIT
- Image Effects: Overview
- Fun with Explosions!
- Exploring the Blacksmith Environment
- Substance - Introduction
- Substance - Understanding PBR
- Substance - Working with PBR in Unity
- Substance - Using Substance materials in Unity
- Substance - Optimization for Substance materials
- Substance - Creating rock shapes
- Substance - Creating rock material, Pt 1
- Substance - Creating rock material, Pt 2
- Substance - Creating the dirt ground material
- Substance - Creating the rock ground material, Pt 1
- Substance - Creating the rock ground material, Pt 2
- Substance - Publishing the Substance
- Substance - Creating a blocking scene
- Substance - Creating the ground model
- Substance - Modelling the rock assets
- Substance - Texturing the upper body
- Substance - Exporting textures from Substance Painter
- Substance - Creating a scene in Unity, Pt 1
- Substance - Creating a scene in Unity, Pt 2
- Introduction and Goals
- Flame Particles Overview
- Particle Emission and Color
- Adding Movement To Particles With Noise
- Creating The Ember Particles
- Adding Lighting To Particles
- Creating Sparks With Particle Trails
- Particle Question and Answers
- Introduction and Goals
- Adding a Second Camera
- Adding Minimap Icons
- Render Textures and UI
- Adding A UI Mask and Border Image
- Questions and Answers
- Session Introduction
- Rendering In Unity
- Anatomy Of An Unlit Shader
- The Vertex Function
- The Fragment Function and Color Tint
- Making A Transparent Shader
- Displacing Vertices and Clipping Pixels
- Questions and Answers