Unity 之 Texture

Textures

Unity 将3D工程目录下的Asset文件夹下的任何图片和 image or movie file 识别为Texture (2D projects工程中,它们被当作 Sprites). 只要图像符合下列尺寸要求, ).

Properties

Texture Type

Property:Function:
Texture Type使用这个来定义你的纹理是用来做什么的。纹理导入器中的其他属性根据您的选择而改变。
    Default这是所有纹理最常用的设置.
    Normal Map选择此选项可将颜色通道转换为适合实时法线贴图的格式
    Editor GUI把Texture 用在 HUD or GUI controls.上
    Sprite (2D and UI)精灵贴图
.
    Cursor如果您使用纹理作为自定义光标,请选择此选项。
    Cookie作为灯光的 Cookies  Lights.
    Lightmap作为 Lightmap 此选项允许将编码转换为特定格式(RGBM或dLDR,取决于平台)
    Single Channel如果你只需要纹理中的一个通道,选择这个。

Texture Shape

Property:Function:
Texture Shape使用这个来定义纹理的形状。默认设置为2D。
    2D这是所有纹理最常见的设置;它将图像文件定义为2D纹理. 这些用于将纹理映射到3D网格和GUI元素,以及其他项目元素。
    Cube这将纹理定义为 cubemap,你可以用这个 Skyboxes or Reflection Probes
Mapping只有 Cube时才可用, 使用Mapping来指定纹理如何投射到GameObject(游戏物体)上。这是默认设置Auto
    AutoUnity试图根据纹理信息自动做出布局。
    6 Frames Layout (Cubic Environment)The Texture contains six images arranged in one of the standard cubemap layouts: cross, or sequence (+x -x +y -y +z -z). The images can be orientated either horizontally or vertically.
    Latitude Longitude (Cylindrical)Maps the Texture to a 2D Latitude-Longitude representation.
    Mirrored Ball (Sphere Mapped)Maps the Texture to a sphere-like cubemap.
Convolution TypeChoose the type of pre-convolution (that is, filtering) that you want to use for this texture. The result of pre-convolution is stored in mips. This is set to None by default.
    NoneThe Texture has no pre-convolution (no filtering).
    Specular (Glossy Reflection)Select this to use cubemaps as Reflection Probes. The Texture mip maps are pre-convoluted (filtered) with the engine BRDF. (See Wikipedia’s page on Bidirectional reflectance distribution function for more information.)
    Diffuse (Irradiance)The Texture is convoluted (filtered) to represent irradiance. This is useful if you use the cubemap as a Light Probe
.
Fixup Edge SeamsThis option is only available with the None or Diffuse convolution (filter). Use this on low-end platforms as a work-around for filtering limitations, such as cubemaps incorrectly filtered between faces.

 

Advanced settings

Property:Description:
Non Power of 2如果纹理的非幂次尺寸为2 (NPOT),这定义了导入时的缩放行为. None by default.
    NoneTexture 尺寸保持不变
    To nearest纹理在导入时缩放到最接近的二维幂次大小. F 257x511 缩放为 256x512 px. 请注意,PVRTC格式要求纹理为正方形 (即宽度等于高度),因此最后的维度大小被放大到512x512像素。
    To larger纹理在导入时缩放到最大尺寸值的二维幂次大小。例如,一个257x511像素的纹理被缩放到512x512像素。
    To smaller纹理在导入时缩放到最小尺寸值的二维幂次大小。例如,一个257x511像素的纹理被缩放到256x256像素。
Read/Write Enabled选中此框可从脚本函数访问纹理数据 (such as Texture2D.SetPixels, Texture2D.GetPixels and other Texture2D functions). 这个修改的时材质的副本, 所以需要两倍的内存, 所以只有在绝对必要时才使用这个属性。这只适用于未压缩和DXT压缩纹理; 其他类型的压缩纹理无法读取。默认情况下禁用此属性。.
Streaming Mip Maps启用此复选框使用Texture Streaming . Diffuse Textures, normal maps and light maps are all valid for Texture Streaming.
    Mip Map Priority使用它来设置mipmap的优先级. 配资源时,Unity使用它来确定哪个mipmap优先级. Higher values represent a higher 更高的值表示更高的优先级(例如,3的优先级高于1).  Streaming Mip Maps勾选是这个才可用

 Mip Map Priority是Memory Budget中的 的mipmap偏移量 Memory Budget (set in the Quality Settings when Texture Streaming is enabled). 例如,优先级为2时,Texture Streaming system尝试使用比优先级为0的纹理高两个mip级别的mipmap. 每个轴上高一级是2x,每个轴上高两级是4x,所以高两级的mip会导致纹理大16倍. 如果不能做到这一点,则使用较低的mip级别来满足内存预算。负值也是有效的. See Texture Streaming API for more details.
Generate Mip Maps选中此复选框以启用mipmap生成.Mipmaps是屏幕上纹理非常小时使用的纹理的小版本. See documentation on Importing Textures for more information on mipmaps.
    Border Mip Maps选中此复选框以避免颜色溢出到较低的MIP级别边缘. Used for light cookies (see below). This box is unchecked by default.
    Mip Map Filtering为了优化图像质量,有两种可用的mipmap滤波方法. The default option is Box.
        Box这是使mipmaps淡出最简单的方法. The MIP levels become smoother as they go down in dimension size.
        KaiserA sharpening algorithm runs on the mipmaps as they go down in dimension size. Try this option if your Textures are too blurry in the distance. (The algorothm is of a Kaiser Window type - see Wikipedia for further information.)
    Mip Maps Preserve Coverage如果您想要生成的mipmaps的alpha通道在alpha测试期间保持覆盖率,请启用此复选框。 See TextureImporterSettings.mipMapsPreserveCoverage for more information.
    Fadeout Mip Maps使之能够使mipmaps随着MIP级别的进展而淡入灰色。这是用于详细地图。最左边的滚动条是开始淡出的第一个MIP级别。最右边的滚动条定义了MIP级别,其中纹理完全变灰。.
Wrap Mode选择纹理在平铺时的行为方式。 The default option is Clamp.
    RepeatRepeats the Texture in tiles.
    ClampStretches the Texture’s edges.
    MirrorMirrors the Texture at every integer boundary to create a repeating pattern.
    Mirror OnceMirrors The texture once, then clamps it to edge pixels
.
    Per-axisChoose this to individually control how Unity wraps Textures at the U axis and V axis.
Filter Mode选择如何过滤纹理时,它被拉伸的3D变换. The default option is Point (no filter).
    Point (no filter)近距离看,纹理呈块状
    Bilinear纹理近距离看起来很模糊
    TrilinearLike Bilinear, but the Texture also blurs between the different MIP levels.
Aniso LevelIncreases Texture quality when viewing the Texture at a steep angle. Good for floor and ground Textures. See documentation on Importing Textures for more information on Anisotropic filtering.

Platform-specific overrides

The Texture Inspector window has a Platform-specific overrides panel.

Platform-specific overrides panel

 

Property:Function:
Max SizeThe maximum imported Texture dimensions in pixels. Artists often prefer to work with huge dimension-size Textures; use Max Size to scale the Texture down to a suitable dimension-size.
CompressionChoose the compression type for the Texture. This parameter helps the system choose the right compression format for a Texture. Depending on the platform and the availability of compression formats, different settings might end up with the same internal format (for example, Low Quality Compression has an effect on mobile platforms, but not on desktop platforms).
    NoneThe Texture is not compressed.
    Low QualityThe Texture is compressed in a low-quality format. This results in a lower memory usage compared with Normal Quality.
    Normal QualityThe Texture is compressed with a standard format.
    High QualityThe Texture is compressed in a high-quality format. This results in a higher memory usage compared with Normal Quality.
FormatThis bypasses the automatic system to specify what internal representation is used for the Texture. The list of available formats depends on the platform and Texture type. See documentation on Texture formats for platform-specific overrides for more information.
Note: Even when a platform is not overridden, this option shows the format chosen by the automatic system. The Format property is only available when overriding for a specific platform, and not as a default setting.
Use crunch compressionUse crunch compression, if applicable. Crunch is a lossy compression format on top of DXT or ETC Texture compression
. Textures are decompressed to DXT or ETC on the CPU and then uploaded on the GPU at runtime. Crunch compression helps the Texture use the lowest possible amount of space on disk and for downloads. Crunch Textures can take a long time to compress, but decompression at runtime is very fast.
Compressor QualityWhen using Crunch Texture compression, use the slider to adjust the quality. A higher compression quality means larger Textures and longer compression times.

 

Render Texture

Render Textures 是一个特殊的材质,它可以在运行时实时更新,你把它赋给一个材质球,或者直接赋给摄像机,能够实时更新它们的变化. The Water prefabs的折射和反射就是运用 Render Textures来实现的

Properties

 

Property:Function:
DimensionThe dimensionality (type) of the render texture.
 2DThe render texture is two-dimensional.
 CubeThe render texture is a cube map.
 3DThe render texture is three-dimensional.
SizeTrender texture 的像素大小
. 必须是2的幂次方 such as 128 and 256.
Anti-Aliasing抗锯齿采样. You can select None, 2 samples, 4 samples, or 8 samples. If you select None, Unity does not apply anti-aliasing.
Enable Compatible Color Format勾选上Unity 会应用一个复杂的模式给render texture 如果平台不支持 Color Format
Color FormatThe color format of the render texture.
Depth Buffer深度缓冲区的格式. You can select No depth buffer, At least 16 bits depth (no stencil), or At least 24 bits depth (with stencil). T模板缓冲区是一个通用缓冲区,它允许您为绘制到屏幕上的每个像素存储一个额外的无符号8位整数(0-255)。
Enable Mip MapsCheck this box to make the render texture generate mipmaps.
Auto generate Mip MapsCheck this box to automatically fill the generated mipmaps with relevant data. If you don’t enable this, you’ll have to use the GenerateMips function to fill those mipmaps manually. Alternatively, choose which mip to render into when you call the various SetRenderTarget functions. For more information about the SetRenderTarget functions, see Graphics.SetRenderTarget and Rendering.CommandBuffer.SetRenderTarget.
Dynamic Scaling选中此框可让动态分辨率缩放调整渲染纹理的大小。如果你不启用这个,渲染纹理保持相同的大小,不管动态分辨率设置。
Wrap ModeControls how the texture is wrapped:
 RepeatTiles the texture to create a repeating pattern.
 ClampStretches the edges of the texture. This is useful for preventing wrapping artifacts when you map an image onto an object and you don’t want the texture to tile.
 Mirror将纹理平铺以创建一个重复的图案,该图案在每个整数边界上镜像纹理。
 Mirror OnceMirrors the texture once, and then falls back to clamping.
 Per-axisLets you set different wrap modes for the U axis and the V axis. The available options are also Repeat, Clamp, Mirror and Mirror Once. For example, when you use latitude-longitude environment maps for reflection probes
, it is useful to have Clamp on the vertical coordinate (V axis), but Repeat on the horizontal coordinate (U axis).
Filter ModeControls how the sampling of the texture uses nearby pixels. The options are:
 PointUses the nearest pixel. This makes the texture appear pixelated.
 BilinearUses a weighted average of the four nearest texels. This makes the texture appear blurry when you magnify it.
 TrilinearUses a weighted average of the two nearest mips, which are bilinearly filtered. This creates a soft transition between mips, at the cost of a slightly more blurry appearance.
Aniso Level纹理的各向异性滤波水平。这增加了纹理质量,当你在一个陡峭的角度看纹理。适用于地板、地面或路面纹理。

Custom Render Textures

 

Custom Render TexturesRender Textures 的扩展,这使得用户可以很容易地用着色器更新纹理. 这对于实现各种复杂的模拟非常有用,比如焦散模拟、雨的波纹模拟、液体溅到墙上等等.它还提供了一个脚本和着色框架,以帮助更复杂的配置,如部分或多通道更新,变化的更新频率等

Properties

 

Custom Texture:

Custom Texture 的参数分为三种:

  • Material: 定义使用什么着色器来更新纹理。

  • Initialization: 控制在着色器进行任何更新之前如何初始化纹理

  • Update: 控制材质如何被着色器更新。

Property:Function:
Material用于更新自定义渲染纹理的材质
     Shader PassShader Pass 用于更新 Custom Texture. 组合框将显示您的素材中所有可用的通道。
Initialization Mode纹理更新的频率。
     OnLoad纹理在创建时初始化一次。
     Realtime每帧都初始化纹理。
     OnDemand通过脚本命令更新
Source更新的方式
     Texture and Color通过材质和颜色
         Initialization Color初始化自定义纹理的颜色。如果还提供了初始化纹理,则和第一项一样
         Initialization TextureTexture with which the custom texture is initialized. If an initialization color is provided as well, the custom texture will be initialized by the multiplication of the color and the texture.
     Material通过材质球更新
         Initialization MaterialMaterial with which the custom texture is initialized.
Update Mode更新的频率
     OnLoadThe texture is updated once upon creation.
     RealtimeThe texture is updated every frame.
     OnDemandThe texture is updated on demand from script.
Period更新的时间(Realtime only) Period in seconds at which real-time texture is updated (0.0 will update every frame).
Double Buffered双度缓存
Wrap Update Zones允许部分更新区域环绕纹理的边界。
Cubemap Faces(Cubemap only) Series of toggle allowing user to enable/disable update on each of the cubemap
faces.
Update Zone Space定义更新区域的坐标系统。
     Normalized所有坐标和大小都在0和1之间,左上角从(0,0)开始
     PixelAll coordinates and sizes are expressed in pixels limited by the width and height of the texture. Top-left corner starting at (0, 0)
Update Zone ListList of update zones for the texture (see below for more details)

Exporting Custom Render Texture to a file:

Custom Render Textures可以被导出成PNG or EXR file

 

Cubemap

 Cubemap 它是六种方形纹理的集合,代表了环境的反射. 六个正方形组成了一个围绕着一个物体的假想立方体的面;每个面代表沿世界轴方向的视图 (up, down, left, right, forward and back).

Cubemaps通常用于捕获物体的反射或“环境”; for example skyboxes and environment reflections often use cubemaps.

Creating Cubemaps from Textures

创建cubemaps的最快方法是从特殊布局的纹理中导入它们 Textures
. Select the Texture in the Project window, to see the Import Settings in the Inspector
 Texture Shape设置为Cube. Unity会把texture自动转换成 Cubemap.

Cubemap texture import type

cubemap有几种布局

 

垂直和水平交叉布局,以及cubemap面列和行的支持:

另一种常见的布局是 LatLong (经纬度,有时称为圆柱形). Panorama images are often in this layout:

SphereMap (spherical environment map) images can also be found:

默认情况下,Unity会查看导入纹理的长宽比来决定最合适的布局。当导入时,生成的cubemap可用于天空盒和反射:

 选择Glossy Reflection 选项对于将被使用的cubemap纹理非常有用 Reflection Probes
. 它以一种特殊的方式处理cubemap mip级别(specular convolution),可以用来模拟来自不同平滑度表面的反射:

 

Legacy Cubemap Assets

Assets > Create > Legacy > Cubemap

Legacy Cubemap Inspector

Legacy Cubemap Inspector

Property:Function:
Right..Back SlotsTextures for the corresponding cubemap face.
Face Size每个Cubemap面的宽度和高度(以像素为单位)
。纹理将自动缩放,以适应这个大小。
MipmapShould mipmaps be created?
Linearcubemap应该使用线性颜色吗?
ReadableShould the cubemap allow scripts
to access the pixel data?

注意在导入图片时,使用cube类型创建cubemap是首选的-这种方式 cubemap 可以被 compressed; 边缘修正 and 光反射; and HDR cubemaps are supported.

Other Techniques

通过脚本也能生成cubemap, Camera.RenderToCubemap function可以从任何想要的位置记录六个面部图像;函数的脚本参考页面上的代码示例添加了一个菜单命令,以简化此任务。

 

Occlusion Area

要将遮挡剔除应用于移动对象,您必须创建一个遮挡区域,然后修改其大小以适应移动对象所在的空间 ( 移动物体不能是static). 你可以通过在空物体上添加  Occlusion Area组件来创建遮挡区域(Component -> Rendering -> Occlusion Area in the menus).

 添加完Occlusion Area组件之后, 勾选上 Is View Volume

Property:Function:
SizeDefines the size of the Occlusion Area.
CenterSets the center of the Occlusion Area. By default this is 0,0,0 and is located in the center of the box.
Is View VolumeDefines where the camera
can be. Check this in order to occlude static objects that are inside this Occlusion Area.

添加完之后 Occlusion Area, 你需要看看它是如何把盒子分成单元格的,选择 EditOcclusion Culling Preview Panel的volume上打上勾

 

Occlusion Portals

和Occlusion Area一样,只不过这个可以在运行时打开或关闭遮挡区域

 

 

### 回答1: Unity Simple Texture Printer是一个Unity的插件,它可以用于将纹理图像以简单的方式打印到游戏对象上。 首先,要下载Unity Simple Texture Printer,可以打开Unity Asset Store网站,然后在搜索栏中输入"Unity Simple Texture Printer"。点击搜索按钮后,会显示相关的插件列表,找到合适的版本后点击下载按钮。 下载完成后,可以在Unity编辑器中打开插件。首先,需要将插件导入到项目中。在Unity编辑器的菜单栏中选择Assets,然后选择Import Package,再选择Custom Package。在弹出的文件浏览器中找到下载的插件文件,选择导入。 导入完成后,可以在Unity的Inspector面板中找到插件的相关设置。首先,选择需要打印纹理的游戏对象,然后在Inspector面板中找到插件的脚本组件。在该脚本组件中,可以设置需要打印的纹理图像。 可以通过点击Inspector面板中的"Select Texture"按钮,选择本地磁盘上的纹理图像文件。选择完毕后,将纹理图像打印到游戏对象上,可以点击Inspector面板中的"Print"按钮。 插件会将选择的纹理图像应用到游戏对象上,可以在场景中查看到效果。 总之,Unity Simple Texture Printer是一个方便的Unity插件,可以简单地将纹理图像打印到游戏对象上,为游戏开发者提供了更加灵活的纹理设置选项。 ### 回答2: Unity Simple Texture Printer是一个用于Unity游戏引擎的插件,用于打印纹理贴图。这个插件可以帮助开发者在游戏运行时将纹理贴图输出为图像文件,方便调试和开发。 要下载Unity Simple Texture Printer,首先需要在浏览器中搜索Unity Asset Store(Unity资源商店)。进入Unity Asset Store后,在搜索栏中输入“Unity Simple Texture Printer”即可找到这个插件的页面。 在Unity Simple Texture Printer页面上,可以看到该插件的详细介绍、功能特点、价格等信息。如果这个插件是付费的,就需要点击页面上的购买按钮,然后按照页面指示完成付款流程。 付款完成后,页面上会显示下载链接。点击下载链接,一个Unity Package文件将被下载到你的计算机上。这个Unity Package文件是一个打包好的插件文件,包含了Unity Simple Texture Printer的所有资源和脚本。 接下来,打开Unity游戏引擎。在Unity的项目视图中,点击“Assets”菜单,然后选择“Import Package”子菜单,再选择“Custom Package”。在弹出的文件选择对话框中,找到并选中刚刚下载的Unity Package文件,然后点击“打开”按钮。 Unity会自动导入插件文件,并将Unity Simple Texture Printer的相关资源和脚本添加到项目中。此时就可以在Unity编辑器的窗口中看到插件的图标和工具。 通过这些简单步骤,你就可以成功下载并安装Unity Simple Texture Printer插件,开始使用它进行纹理贴图的打印和调试工作了。 ### 回答3: Unity Simple Texture Printer 是一个Unity插件,用于在Unity编辑器中打印和编辑2D纹理。它可以帮助开发者在游戏开发过程中快速创建和修改纹理。 Unity Simple Texture Printer 是一个非常实用的工具,它提供了一些简单且易于使用的功能,可以帮助用户更加有效地处理纹理。首先,它可以让用户直接在Unity编辑器中创建和编辑纹理。用户可以使用该插件来绘制2D图像、添加文本、调整颜色和透明度等。 此外,Unity Simple Texture Printer 还具有一些方便的工具,例如画笔工具和橡皮擦工具,可以让用户精确地绘制和擦除纹理。用户可以根据需要选择不同的笔刷类型和大小,并随时更改绘制属性。 除了创建和编辑纹理,Unity Simple Texture Printer 还提供了一些其他功能。例如,它允许用户将纹理导出为PNG或其他常见的图像格式,以便在游戏中使用。用户还可以使用该插件导入其他纹理文件,并在编辑器中进行修改。 总之,Unity Simple Texture Printer 是一个非常易于使用且功能丰富的Unity插件,可以帮助开发者在游戏开发中处理和编辑2D纹理。无论是创建新的纹理还是修改现有的纹理,该插件都能够提供便捷和高效的工作流程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TO_ZRG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值