unity rendertextureonly pot texture can be compressed怎么办

Unity3d&Shader(三)&Pass(Texturing)混合纹理(同时显示2张图),自发光
After the basic vertex lighting has been calculated, textures
are applied. In ShaderLab this is done using
SetTexture command.
纹理在基本的顶点光照被计算后被应用。在着色器中通过SetTexture 命令来完成。
SetTexture commands have no e as in that case pixel
operations are completely described in the shader.
SetTexture 命令在片面程序被使用时不会生效;这种模式下像素操作被完全描述在着色器中。
<img ALT="" src="/blog7style/images/common/sg_trans.gif" real_src ="/Components/Images/SL-SetTexture-0.jpg" NAME="image_operate_97762"
TITLE="Unity3d&Shader(三)&Pass(Texturing)混合纹理(同时显示2张图),自发光" />
Texturing is the place to do old-style combiner effects. You can
have multiple SetTexture commands inside a pass - all textures are
applied in sequence, like layers in a painting program. SetTexture
commands must be placed at the end of a .
材质贴图可以用来做老风格的混合器效果。你能在一个通道中使用多个SetTexture 命令 -
所有纹理被顺序的应用,如同绘画程序中的层一样。SetTexture 命令必须放置在通道的末尾。
Syntax 语法
SetTexture [TexturePropertyName]
{ Texture Block }
Assigns a texture. TextureName must be defined as a
texture property. How to apply the texture is defined inside the
TextureBlock.
分配一个纹理,TextureName必须定义为一个纹理属性。如何应用纹理被定义在TextrueBlock中
The texture block controls how the texture is applied. Inside
the texture block can be up to three commands: combine, matrix and
constantColor.
纹理块控制纹理如何被应用。在纹理块中能执行3种命令:合并,矩阵和不变色。
Texture block combine command 纹理块合并命令
combine src1 * src2
Multiplies src1 and src2 together. The result will be darker
than either input.
将源1和源2的元素相乘。结果会比单独输出任何一个都要暗
combine src1 + src2
Adds src1 and src2 together. The result will be lighter than
either input.
将将源1和源2的元素相加。结果会比单独输出任何一个都要亮
combine src1 - src2
Subtracts src2 from src1.
源1 减去源2
combine src1 +- src2
Adds src1 to src2, then subtracts 0.5 (a signed add).
先相加,然后减去0.5(添加了一个符号)
combine src1 lerp (src2) src3
Interpolates between src3 and src1, using the alpha of src2.
Note that the interpolation is opposite direction: src1 is used
when alpha is one, and src3 is used when alpha is zero.
使用源2的透明度通道值在源3和源1中进行差值,注意差值是反向的:当透明度值是1是使用源1,透明度为0时使用源3
combine src1 * src2 + src3
Multiplies src1 with the alpha component of src2, then adds
源1和源2的透明度相乘,然后加上源3
combine src1 * src2 +- src3
Multiplies src1 with the alpha component of src2, then does a
signed add with src3.
源1和源2的透明度相乘,然后和源3做符号加
combine src1 * src2 - src3
Multiplies src1 with the alpha component of src2, then
subtracts src3.
源1和源2的透明度相乘,然后和源3相减
All the src properties can be either one of
previous, constant, primary or
所有源属性都可以是previous, constant, primary or texture其中的一个。
Previous is the the result of the previous
SetTexture.
上一次SetTexture的结果
Primary is the color from the
or the vertex color if it
来自光照计算的颜色或是当它绑定时的顶点颜色
Texture is the color of the texture specified
by [_TextureName] in the SetTexture (see above).
在SetTexture中被定义的纹理的颜色
Constant is the color specified in
ConstantColor.
被ConstantColor定义的颜色
Modifiers 解释:
The formulas specified above can optionally be followed by the
keywords Double or Quad to make
the resulting color 2x or 4x as bright.
上述的公式都均能通过关键字 Double 或是 Quad
将最终颜色调高亮度2倍或4倍。
All the src properties, except lerp argument,
can optionally be preceded by one - to make the
resulting color negated.
所有的src属性,除了差值参数都能被标记一个-符号来使最终颜色反相。
All the src properties can be followed by
alpha to take only the alpha channel.
所有src属性能通过跟随 alpha
标签来表示只取用alpha通道。
Texture block constantColor command (纹理块constantColor 命令)
ConstantColor color
Defines a constant color that can be used in the combine
定义在combine命令中能被使用的不变颜色
Texture block matrix command (纹理块matrix命令)
matrix [MatrixPropertyName]
Transforms texture coordinates used in this command with the
given matrix.
使用给定矩阵变换纹理坐标
Details 细节
Older graphics cards use a layered approach to textures. The
textures are applied one after each other, modifying the color that
will be written to the screen. For each texture, the texture is
typically combined with the result of the previous operation.
较老的显卡对纹理使用分层的方案。纹理在每一层后被应用一次颜色的修改。对每一个纹理,一般来说纹理都是和上一次操作的结果混合。
<img ALT="" src="/blog7style/images/common/sg_trans.gif" real_src ="/Components/Images/SL-SetTexture-1.jpg" NAME="image_operate_86150"
TITLE="Unity3d&Shader(三)&Pass(Texturing)混合纹理(同时显示2张图),自发光" />
Note that on "true fixed function" devices (OpenGL, OpenGL ES
1.1, Wii) the value of each SetTexture stage is clamped to 0..1
range. Everywhere else (Direct3D, OpenGL ES 2.0) the range may or
may not be higher. This might affect SetTexture stages that can
produce values higher than 1.0.
注意,在“真正的固定功能”设备(OpenGL, OpenGL ES 1.1,
Wii),每个SetTexture阶段的值被限制为0..1范围。其他地方(Direct3D, OpenGL ES
2.0)该范围可能或不可能更高。这可能会影响SetTexture阶段,可能产生的值高于1.0。
Separate Alpha & Color computation
分离的透明度和颜色混合
By default, the combiner formula is used for calculating both
the RGB and alpha component of the color. Optionally, you can
specify a separate formula for the alpha calculation. This looks
like this:
缺省情况下,混合公式被同时用于计算纹理的RGB通道和透明度。同时,你也能指定只针对透明度进行计算,如下:
SetTexture [_MainTex] { combine previous * texture, previous + texture }
Here, we multiply the RGB colors and add the alpha.
如上所述,我们对RGB的颜色做乘然后对透明度相加
Specular highlights 反射高光
By default the primary color is the sum of the
diffuse, ambient and specular colors (as defined in the ). If you specify
SeparateSpecular On in the pass options, the
specular color will be added in after the combiner
calculation, rather than before. This is the default behavior of
the built-in VertexLit shader.
默认情况下primary颜色是漫反射,阴影色和高光颜色(在光线计算中定义)的加和。如果你将通道设置中的SeparateSpecular
打开,高光色会在混合计算后被加入,而不是之前。这是内置顶点着色器的默认行为。
Graphics hardware support 图形硬件支持
Some old graphics cards might not support some texture combine
modes, and different cards have different number of SetTexture
stages available. The shader author should write separate
for the cards he or she wants to
一些旧的显示卡不能支持某些纹理混合模式,不同的卡有不同数目的SetTexture阶段可用。着色器作者应该为他们想支持的卡分开写
Graphics cards with pixel shader 1.1 support (NVIDIA GeForce 3
and up, ATI Radeon 8500 and up, Intel 9xx) support all combiner
modes and have at least 4 texture stages available. The following
table summarizes the hardware support:
支持像素着色器1.1版本的图形卡(...)支持所有的混合器模式并且可以拥有至少4级渲染阶段。下表简述了硬件支持。
Stage count
Combiner modes not
NVIDIA GeForce 3/4Ti and up
In OpenGL on Windows, src1*src2-src3 is not
NVIDIA TNT2, GeForce 256, GeForce 2, GeForce
In OpenGL on Windows, src1*src2-src3 is not
ATI Radeon 9500 and up
8 in OpenGL, 4 in D3D9
ATI Radeon
6 in OpenGL, 4 in D3D9
ATI Radeon 7500
src1*src2+src3
src1*src2+-src3
src1*src2-src3
Examples 示例
Alpha Blending Two Textures (Alpha混合两个纹理)
This small examples takes two textures. First it sets the first
combiner to just take the _MainTex, then is uses
the alpha channel of _BlendTex to fade in the RGB
colors of _BlendTex
这个小例子使用了两张纹理。首先设置第一个混合器只使用_MainTex,然后使用_BlendTex的Alpha通道来淡出_BlendTex的RGB颜色。
Shader "Examples/2 Alpha Blended Textures" {
&&& Properties {
&&&&&&& _MainTex ("Base (RGB)", 2D) = "white" {}
&&&&&&& _BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
&&& SubShader {
&&&&&&& Pass {
&&&&&&&&&&& // Apply base texture
&&&&&&&&&&&&&&&&&&&&&&& // 应用主纹理
&&&&&&&&&&& SetTexture [_MainTex] {
&&&&&&&&&&&&&&& combine texture
&&&&&&&&&&& }
&&&&&&&&&&& // Blend in the alpha texture using the lerp operator
&&&&&&&&&&&&&&&&&&&&&&& // 使用差值操作混合Alpha纹理
&&&&&&&&&&& SetTexture [_BlendTex] {
&&&&&&&&&&&&&&& combine texture lerp (texture) previous&&&&&&&&&&& }
Alpha Controlled Self-illumination (Alpha控制自发光)
This shader uses the alpha component of the
_MainTex to decide where to apply lighting. It
does this by applying the t In the first
stage, the alpha value of the texture is used to blend between the
vertex color and solid white. In the second stage, the RGB values
of the texture are multiplied in.
这个着色器使用_MainTex的Alpha来描述什么地方应用光照。它通过分两个阶段应用纹理来实现;第一个阶段,纹理的Alpha值被用来在顶点颜色和纯白色之间混合。第二阶段,纹理的RGB值被乘入。
Shader "Examples/Self-Illumination" {
&&& Properties {
&&&&&&& _MainTex ("Base (RGB) Self-Illumination (A)", 2D) = "white" {}
&&& SubShader {
&&&&&&& Pass {
&&&&&&&&&&& // Set up basic white vertex lighting
&&&&&&&&&&&&&&&&&&&&&&& //设置白色顶点光照
&&&&&&&&&&& Material {
&&&&&&&&&&&&&&& Diffuse (1,1,1,1)
&&&&&&&&&&&&&&& Ambient (1,1,1,1)
&&&&&&&&&&& }
&&&&&&&&&&& Lighting On
&&&&&&&&&&& // Use texture alpha to blend up to white (= full illumination)
&&&&&&&&&&&&&&&&&&&&&&& // 使用纹理Alpha来混合白色(完全发光)
&&&&&&&&&&& SetTexture [_MainTex] {
&&&&&&&&&&&&&&& constantColor (1,1,1,1)
&&&&&&&&&&&&&&& combine constant lerp(texture) previous
&&&&&&&&&&& }
&&&&&&&&&&& // Multiply in texture
&&&&&&&&&&&&&&&&&&&&&&& // 和纹理相乘
&&&&&&&&&&& SetTexture [_MainTex] {
&&&&&&&&&&&&&&& combine previous * texture
&&&&&&&&&&& }
We can do something else for free here, instead of
blending to solid white, we can add a self-illumination color and
blend to that. Note the use of ConstantColor to
get a _SolidColor from the properties into the texture
我们能在这里尽可能自由的做些事,除了混合纯白色,我们还能添加一个自发光颜色然后和它混合和。注意ConstantColor的使用能从属性中获取一个纯色并应用到纹理混合中去。
Shader "Examples/Self-Illumination 2" {
&&& Properties {
&&&&&&& _IlluminCol ("Self-Illumination color (RGB)", Color) = (1,1,1,1)
&&&&&&& _MainTex ("Base (RGB) Self-Illumination (A)", 2D) = "white" {}
&&& SubShader {
&&&&&&& Pass {
&&&&&&&&&&& // Set up basic white vertex lighting
&&&&&&&&&&& Material {
&&&&&&&&&&&&&&& Diffuse (1,1,1,1)
&&&&&&&&&&&&&&& Ambient (1,1,1,1)
&&&&&&&&&&& }
&&&&&&&&&&& Lighting On
&&&&&&&&&&& // Use texture alpha to blend up to white (= full illumination)
&&&&&&&&&&& SetTexture [_MainTex] {
&&&&&&&&&&&&&&& // Pull the color property into this blender
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // 使颜色属性进入混合器
&&&&&&&&&&&&&&& constantColor [_IlluminCol]
&&&&&&&&&&&&&&& // And use the texture's alpha to blend between it and
&&&&&&&&&&&&&&& // vertex color
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // 使用纹理的alpha通道混合顶点颜色
&&&&&&&&&&&&&&& combine constant lerp(texture) previous
&&&&&&&&&&& }
&&&&&&&&&&& // Multiply in texture
&&&&&&&&&&& SetTexture [_MainTex] {
&&&&&&&&&&&&&&& combine previous * texture
&&&&&&&&&&& }
And finally, we take all the lighting properties of the
vertexlit shader and pull that in:
最后,我们把顶点光照着色器的所有的光照属性放入:
Shader "Examples/Self-Illumination 3" {
&&& Properties
_IlluminCol ("Self-Illumination color (RGB)", Color) =
_Color ("Main Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
&&& SubShader
&&&&&&&&&&&
// Set up basic vertex lighting
&&&&&&&&&&&
Material {
&&&&&&&&&&&&&&&
Diffuse [_Color]
&&&&&&&&&&&&&&&
Ambient [_Color]
&&&&&&&&&&&&&&&
Shininess [_Shininess]
&&&&&&&&&&&&&&&
Specular [_SpecColor]
&&&&&&&&&&&&&&&
Emission [_Emission]
&&&&&&&&&&&
&&&&&&&&&&&
Lighting On
&&&&&&&&&&&
// Use texture alpha to blend up to white (= full
illumination)
&&&&&&&&&&&
SetTexture [_MainTex] {
&&&&&&&&&&&&&&&
constantColor [_IlluminCol]
&&&&&&&&&&&&&&&
combine constant lerp(texture) previous
&&&&&&&&&&&
&&&&&&&&&&&
// Multiply in texture
&&&&&&&&&&&
SetTexture [_MainTex] {
&&&&&&&&&&&&&&&
combine previous * texture
&&&&&&&&&&&
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。Unity3D基础教程3-4:2D纹理(Texture 2D)
Unity 手册-&用户指南-&与资产合作-&纹理2D
Textures bring your Meshes, Particles, and interfaces to life! They are image or movie files that you lay over or wrap around your objects. As they are so important, they have a lot of properties. If reading this for the first time, jump down to , and return to the actual settings when you need a reference.
纹理带给你的网格、粒子及界面生命力。它们是图像或电影你覆盖或环绕你的对象。当它们引入时,它们有许多属性。如果在第一时间渲染,跳至(详细资料处),并返回动作设置在你需要一个引用时。
The shaders you use for your objects put specific requirements on which textures you need, but the basic principle is that you can put any image file inside your project. If it meets the size requirements (specified below), it will get imported and optimized for game use. This extends to multi-layer Photoshop or TIFF files - they are flattened on import, so there is no size penalty for your game.
为你的对象使用阴影放置指定的需求在你需要的纹理上,但是基本原则是你可以放置任何图像文件在你的项目里。如果它满足需求大小(在下面指定),它将获得引入并为游戏使用组织。这个扩展到多层Photoshop或TIFF文件它们是在引入上变平,因此没有大小损失你的游戏。
Properties 属性
The Texture Inspector looks a bit different from most others: 纹理检视器面板看起来与其它大多数的有点不同
The top section contains a few settings, and the bottom part contains import settings and a texture preview.
顶部部分包含几个设置,底部部分包含引入设置和纹理预览
Aniso Level
Increases texture quality when viewing the texture at a steep angle. Good for floor and ground textures, see .
当子一个陡峭角度观看纹理时,增长纹理质量。能担当地板与地面纹理,见下面。
Filter Mode
Selects how the Texture is filtered when it gets stretched by 3D transformations:
选取当纹理通过3D转换获得伸展时纹理如何被过滤
No Filtering
The Texture becomes blocky up close
纹理变为斑驳向上接近
The Texture becomes blurry up close
纹理变为模糊向上接近
Like Bilinear, but the Texture also blurs between the different mip levels
像双线性,但纹理也在不同人工处理级别之间模糊
Selects how the Texture behaves when tiled:
选取当纹理平铺时,纹理如何运转
The Texture repeats (tiles) itself
纹理它自己重复
The Texture&#39;s edges get stretched
纹理的边缘获得伸展
Import Settings 引入设置
Textures all come from image files in your Project Folder. How they are imported is specified by the texture&#39;s Import Settings. You change these by selecting the file texture in the Project View and modifying the Import Settings in the Inspector.
纹理全部来自图象文件在你的项目文件夹里。它们如何被引入是通过纹理的引入设置指定的。你更改它们通过选择纹理文件在项目视图里并修改引入设置在检视器面板。
The Texture Import Settings dialog 纹理引入设置对话框
Max Texture Size
最大纹理大小
The maximum imported texture size. A lot of artists prefer to work with huge textures - scale the texture down to a suitable size with this.
最大值引入纹理大小。许多艺术家更愿意与巨大纹理一起工作&伸展纹理到合适的大小
Texture Format
What internal representation is used for the texture. This is a tradeoff between size and quality. In the examples below we show the final size of a in-game texture of 256 by 256 pixels:什么内部表示应用与纹理。这是大小与质量之间的折衷。在下面的例子里,我们显示最终规模由256像素的游戏内部纹理:
RGB Compressed
RGB压缩DXT1
Compressed RGB texture. This is the most common format for diffuse textures. 4 bits per pixel (32 KB for a 256x256 texture).
压缩RGB纹理。这是常见的漫射纹理格式。4位每像素(32KB的256*256纹理)
RGBA Compressed
RGBA 压缩DXT5
Compressed RGBA texture. This is the main format used for diffuse & specular control textures. 1 byte/pixel (64 KB for a 256x256 texture).
压缩RGB纹理。这是主要的漫射与反射控制纹应用的主要理格式。每像素1位(64KB的256*256纹理)
RGB 16 bit
65 thousand colors with no alpha. Compressed DXT formats use less memory and usually look better. 128 KB for a 256x256 texture.
65000没有alpha的颜色。压缩DXT格式用于减少内存以及通常好看。128K的256*256纹理。
RGB 24 bit
Truecolor but without alpha. 192 KB for a 256x256 texture.
没有alpha的真彩。192K的256*256纹理
Alpha 8 bit
8位的Alpha
High quality alpha channel but without any color. 64 KB for a 256x256 texture.
无任何颜色的高质量alpha通道。64K的256*256纹理。
RGBA 16 bit
16位的RGBA
Low-quality truecolor. Has 16 levels of red, green, blue and alpha. Compressed DXT5 format use less memory and usually look better. 128 KB for a 256x256 texture.
低质量真彩。有16位级别的红、绿、蓝以及alpha。压缩DXT5格式的使用少的内存并通产好看。128k的256*256纹理。
RGBA 32 bit
32位的RGBA
Truecolor with alpha - this is the highest quality. At 256 KB for a 256x256 texture, this one is expensive. Most of the time, DXT5 offers sufficient quality at a much smaller size. The main place this is used is for bump maps, as DXT compression there often carries a visible quality loss.
有alpha的真彩&这是最高的质量。在256K的256*256纹理,据此之一是昂贵的。在多数情况下,DXT5提供了一个更小的大小足够的质量。主要地方是用于凹凸图,DXT压缩经常带有明显的质量损失。
Build Alpha From Grayscale
从灰度级建立Alpha
If enabled, an alpha transparency channel will be generated by the image&#39;s existing values of light & dark.
如果启用,一个alpha透明性通道将通过图象的存在明暗的值产生
Non Power of 2 sizes
非2的幂的大小
If texture has non-power-of-two size, this will define a scaling behavior at import time (for more info see
section below):
如果纹理有两个幂的大小,这将定义一个在引入时的伸展行为(更多信息看下面的纹理大小节)。
Keep original
Texture will be padded to the larger power-of-two size for use with GUITexture component.
纹理将填补大的两个幂的大小与GUI纹理组件一起使用。
Scale to nearest
最近的规模
Texture will be scaled to the nearest power-of-two size at import time. For instance 257x511 texture will become 256x512. Note that PVRTC formats require textures to be square (width equal to height), therefore final size will be upscaled to 512x512.
在引入时,纹理将被伸缩到最近两个幂的大小。对于257*511纹理实例将变为256*512.注意PVRTC格式需要纹理是正方形(宽高相等),因此最终规模将扩大到512*512.
Scale to larger
Texture will be scaled to the larger power-of-two size at import time. For instance 257x511 texture will become 512x512.
在引入时,纹理将缩放到大的两个幂尺寸。对于257*511纹理实例将变为512*512.
Scale to smaller
Texture will be scaled to the smaller power-of-two size at import time. For instance 257x511 texture will become 256x256.
在引入时,纹理将缩放到小的两个幂尺寸。对于257*511纹理实例将变为256*256.
Generate Cube Map
产生立方体映射
Generates a cubemap from the texture using different generation methods.
产生一个立方体映射从纹理使用不同方式产生。
Is Readable
Select this to enable access to the texture data from the scripts (GetPixels, SetPixels and other
functions). Note however that a copy of the texture data will be made doubling the amount of memory required for texture asset. Use only if absolutely necessary. Disabled by default.
选取它启用访问纹理数据从脚本(GetPixels, SetPixels以及其它纹理2D函数)。不过注意,纹理数据的副本将使用双倍内存需要的纹理资产。使用只读绝对必要。默认禁用。
Generate Mip Maps
产生Mip映射
Select this to enable mip-map generation. Mip maps are smaller versions of the texture that gets used when the texture is very small on screen. For more info, see
选取启用mip映射生成。Mip映射是当纹理非常小的显示在屏幕上时获得使用的小的纹理版本。更多信息,查看下面的mip映射
Correct Gamma
Select this to enable per-mip-level gamma correction.
选取启用每mip级别纠正
Border Mip Maps
边界Mip映射
Select this to avoid colors seeping out to the edge of the lower Mip levels. Used for light cookies (see below).
选取是为了避免颜色渗漏到低mip级别边缘外部。光波烹调使用(看下面)
Mip Map Filtering
Mip映射过滤
Two ways of mip map filtering is available to optimize image quality:
Mip映射过滤的两种方法是可用的优化图形质量。
The simplest way to fade out the mipmaps - the mip levels become smoother and smoother as they go down in size.
简单的方法淡出mip映射&mip级别变为平滑及平滑作为它们下降的尺寸。
A sharpening Kaiser algorithm is run on the mip maps as they go down in size. If your textures are too blurry in the distance, try this option.
Kaiser钝化算法是运行在mip映射上作为它们下降的尺寸。如果你的纹理是在远处太模糊,尝试这个选项。
Fade Out Mips
Enable this to make the mipmaps fade to gray the mip levels progress. This is used for detail maps.启用它使mip映射淡出到灰色mip级别处理。这被用于详细映射。
Fade Out start
The first mip level to begin fading out at.
第一mip级别开始淡出。
Fade Out End
The mip level where the texture is completely grayed out.
纹理完成的灰色输出那里的mip级别。
Generate Bump Map
产生凹凸映射
Enable this to turn the color channels into a format suitable for real-time bumpmapping. For more info, see , below.
启用它去更改颜色通道对到一个适合格式的实时凹凸。更多信息,查看凹凸映射,在下面。
Bumpiness崎岖不平
Control the amount of bumpiness. 控制崎岖不平的数量
Filtering 过滤
Determine how the bumpiness is calculated: 确认崎岖不平如何计算的。
Standard 标准
This generates normal maps that are quite smooth. 这样生成的正常映射十分平滑。
Sobel 索贝尔
The Sobel filter generates normal maps that are sharper than Standard.
Sobel过滤器产生比正常标准清晰的映射。Details 详细资料
欢迎与本站!
QQ交流群1:
QQ交流群2:

我要回帖

更多关于 pot texture 的文章

 

随机推荐