查看: 2424|回复: 0
打印 上一主题 下一主题

[Unity 组件参考手册]着色器参考之着色器语法:Pass

[复制链接]
.    

3797

主题

11

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
32328
精华
41

活跃会员 优秀版主 荣誉管理 论坛元老

跳转到指定楼层
楼主
发表于 2013-2-24 09:53:23 |只看该作者 |倒序浏览
The Pass block causes the geometry of an object to be rendered once.
Pass通道块控制被渲染的对象的几何体。



【Syntax 语法】
Pass { [Name and Tags] [RenderSetup] [TextureSetup] }

    The basic pass command contains an optional list of render setup commands, optionally followed by a list of textures to use.

    基本通道命令包含一个可选的渲染设置命令的列表,和可选的被使用的纹理的列表。
【Name and tags 名称和标签】
A Pass can define its Name and arbitrary number of Tags - name/value strings that communicate Pass' intent to the rendering engine.
一个通道能定义它的Name 和任意数量的Tags (用于向渲染引擎传递通道的意图的名称/值的字符串)。



【Render Setup 渲染设置】
A pass sets up various states of the graphics hardware, for example should alpha blending be turned on, should fog be used, and so on. The commands are these:
通道设定显示硬件的各种状态,例如能打开alpha混合,能使用雾,等等。这些命令如下:
Material { Material Block }

    Defines a material to use in a vertex lighting pipeline. See material page for details.

    定义一个使用顶点光照管线的材质,参考material页面。

Lighting On | Off

    Turn vertex lighting on or off. See material page for details.

    开启或关闭顶点光照,参考material页面。

Cull Back | Front | Off

    Set polygon culling mode. 设置多边形剔除模式

ZTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always)

    Set depth testing mode. 设置深度测试模式

ZWrite On | Off

    Set depth writing mode. 设置深度写模式

Fog { Fog Block }

    Set fog parameters. 设置雾参数

AlphaTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always) CutoffValue

    Turns on alpha testing. 开启alpha测试

Blend SourceBlendMode DestBlendMode

    Sets alpha blending mode. 设置alpha混合模式

Color Color value

    Sets color to use if vertex lighting is turned off.

    设置当顶点光照关闭时所使用的颜色

ColorMask RGB | A | 0 | any combination of R, G, B, A

    Set color writing mask. Writing ColorMask 0 turns off rendering to all color channels.

    设置颜色写遮罩。设置为0将关闭所有颜色通道的渲染

Offset OffsetFactor , OffsetUnits

    Set depth offset. 设置深度偏移

SeparateSpecular On | Off

    Turns separate specular color for vertex lighting on or off. See material page for details.

    开启或关闭顶点光照相关的平行高光颜色, 参考material页面。

ColorMaterial AmbientAndDiffuse | Emission

    Uses per-vertex color when computing vertex lighting. See material page for details.

    当计算顶点光照时使用每顶点颜色, 参考material页面。
【Texture Setup 纹理设置】
After the render state setup, you can specify a number of textures and their combining modes to apply using SetTexture commands:
在完成渲染设定后,你能指定一定数量的纹理和当使用 SetTexture 命令时所采用的混合模式:
SetTexture texture property { [Combine options] }
The texture setup configures fixed function multitexturing pipeline, and is ignored if custom fragment shaders are used.
纹理设置 配置了 固定函数多纹理管线,当自定义fragment shaders 被使用时,将忽略这个设置。



【Details 细节】

Per-pixel Lighting 每像素光照
The per-pixel lighting pipeline works by rendering objects in multiple passes. Unity renders the object once to get ambient and any vertex lights in. Then it renders each pixel light affecting the object in a separate additive pass. See Render Pipeline for details.
每像素光照管线通过多次通道渲染对象来完成。Unity渲染对象一次来获取阴影色和任何顶点光照。然后再在额外的并行通道中渲染出每像素光照的效果。参考Render Pipeline。

Per-vertex Lighting 每顶点光照
Per-vertex lighting is the standard Direct3D/OpenGL lighting model that is computed for each vertex. Lighting on turns it on. Lighting is affected by Material block, ColorMaterial and SeparateSpecular commands. See material page for details.
每顶点光照是标准的Direct3D/OpenGL光照模式,通过计算每个顶点的光照来完成。Lighting on命令开启光照。光照被材质块,颜色材质和平行高光命令所影响,参考material页面。



【See Also】
There are several special passes available for reusing common functionality or implementing various high-end effects:
有几个特殊的通道能用于反复利用普通功能或是实现几种高端的特效:
    UsePass includes named passes from another shader.

    UsePass包含来自其他着色器的通道

    GrabPass grabs the contents of the screen into a texture, for use in a later pass.

    GrabPass 捕获屏幕到一个纹理,通常使用在靠后的通道中
【Subsections 子章节】
    ShaderLab syntax: Color, Material, Lighting

    ShaderLab syntax: Culling & Depth Testing

    ShaderLab syntax: Texturing

    ShaderLab syntax: Fog

    ShaderLab syntax: Alpha testing

    ShaderLab syntax: Blending

    ShaderLab syntax: Pass Tags

    ShaderLab syntax: Name

    ShaderLab syntax: BindChannels


【来源:互联网】

更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-11-13 09:33 , Processed in 0.107492 second(s), 33 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部