Unity3D Shader官方教程翻譯(四)----Shader語法:SubShader
ShaderLab syntax: SubShader
ShaderLab語法:SubShader
Each shader in Unity consists of a list of subshaders. When Unity has to display a mesh, it will find the shader to use, and pick the first subshader that runs on the user's graphics card.
每個在Unity3D的shader都是由一系列的的subshaders組成的。當Unity3D顯示一個網格的時候,它會使用第一個被使用者顯示卡支援的subshader。
Syntax
語法
Subshader { [Tags] [CommonState] Passdef [Passdef ...] }
Defines the subshader as optional tags, common state and a list of pass definitions.
定義subshade包含了可選的標籤,常見的狀態和通道定義列表。
Details
詳情
A subshader defines a list of rendering passes and optionally setup any state that is common to all passes. Additionally, subshader specific Tags can be set up.
一個subshader定義了1個渲染通道列表,並有選擇地設定了這些通道的通常狀態。此外,subshade也可以設定特定的標籤。
When Unity chooses which subshader to render with, it renders an object once for each Pass defined (and possibly more due to light interactions). As each render of the object is an expensive operation, you want to define the shader in minimum amount of passes possible. Of course, sometimes on some graphics hardware the needed effect can't be done in a single pass; then you have no choice but to use multiple passes.
當Unity3D選擇1個subshader進行渲染的時候,他將優先渲染1個被每個通道所定義的物件(這個物件很可能是由光線互動決定的)。由於渲染每1個物體是個十分昂貴的操作,你得定義Shader可能操作的渲染通道數目儘可能的少。當然有時候某些華麗的效果在顯示卡上不可能只使用單通道,你就必須得使用多通道了。
Each pass definition can be a regular Pass, a Use Pass or a Grab Pass.
每個通道的定義可以是1個regular Pass, 或 Use Pass 或 Grab Pass.
Any statements that are allowed in a Pass definition can also appear in Subshader block. This will make all passes use this "shared" state.
在一個通道定義中的任何宣告,也可以出現在Subshader塊。這樣做能使所有的通道都能共享這些宣告。
Example
// ...
SubShader {
Pass {
Lighting Off
SetTexture [_MainTex] {}
}
}
// ...
This subshader defines a single Pass that turns off any lighting and just displays a mesh with texture named _MainTex.
這個subshader定義了1個單通道,這個單通道關閉了所有的燈光然後顯示了1個名字叫_MainTex的紋理網格。
由www.J2meGame.com原創,轉載請說明。
ShaderLab語法:SubShader
Each shader in Unity consists of a list of subshaders. When Unity has to display a mesh, it will find the shader to use, and pick the first subshader that runs on the user's graphics card.
每個在Unity3D的shader都是由一系列的的subshaders組成的。當Unity3D顯示一個網格的時候,它會使用第一個被使用者顯示卡支援的subshader。
Syntax
語法
Subshader { [Tags] [CommonState] Passdef [Passdef ...] }
Defines the subshader as optional tags, common state and a list of pass definitions.
定義subshade包含了可選的標籤,常見的狀態和通道定義列表。
Details
詳情
A subshader defines a list of rendering passes and optionally setup any state that is common to all passes. Additionally, subshader specific Tags can be set up.
一個subshader定義了1個渲染通道列表,並有選擇地設定了這些通道的通常狀態。此外,subshade也可以設定特定的標籤。
When Unity chooses which subshader to render with, it renders an object once for each Pass defined (and possibly more due to light interactions). As each render of the object is an expensive operation, you want to define the shader in minimum amount of passes possible. Of course, sometimes on some graphics hardware the needed effect can't be done in a single pass; then you have no choice but to use multiple passes.
當Unity3D選擇1個subshader進行渲染的時候,他將優先渲染1個被每個通道所定義的物件(這個物件很可能是由光線互動決定的)。由於渲染每1個物體是個十分昂貴的操作,你得定義Shader可能操作的渲染通道數目儘可能的少。當然有時候某些華麗的效果在顯示卡上不可能只使用單通道,你就必須得使用多通道了。
Each pass definition can be a regular Pass, a Use Pass or a Grab Pass.
每個通道的定義可以是1個regular Pass, 或 Use Pass 或 Grab Pass.
Any statements that are allowed in a Pass definition can also appear in Subshader block. This will make all passes use this "shared" state.
在一個通道定義中的任何宣告,也可以出現在Subshader塊。這樣做能使所有的通道都能共享這些宣告。
Example
// ...
SubShader {
Pass {
Lighting Off
SetTexture [_MainTex] {}
}
}
// ...
This subshader defines a single Pass that turns off any lighting and just displays a mesh with texture named _MainTex.
這個subshader定義了1個單通道,這個單通道關閉了所有的燈光然後顯示了1個名字叫_MainTex的紋理網格。
由www.J2meGame.com原創,轉載請說明。
相關文章
- Unity3D Shader官方教程翻譯(三)----Shader語法:屬性Unity3D
- Unity3D Shader官方教程翻譯(一)Unity3D
- Unity3D Shader官方教程翻譯(二)Unity3D
- Unity3D 透明物體ShaderUnity3D
- ZooKeeper 官方教程[翻譯]
- [翻譯]CMAKE官方教程
- Unity3D中的shader基礎知識Unity3D
- 【Unity3D Shader程式設計】之二 雪山飛狐篇:Unity的基本Shader框架寫法&顏色、光照與材質Unity3D程式設計框架
- opengl 教程(5) shader(2) uniform變數ORM變數
- Unity Shader 00 - 梳理 Unity Shader 的基本結構Unity
- Compute Shader
- Pyplot tutorial,Pyplot官方教程自翻譯
- Unity3D學習筆記3——Unity Shader的初步使用Unity3D筆記
- D3D9 Shader例項教程3D
- Shader中的shader_feature與multi_compileCompile
- godot shader 升級Go
- 【Unity Shaders】Mobile Shader Adjustment—— 什麼是高效的ShaderUnity
- 組複製官方翻譯四、MonitoringGroupReplication
- [翻譯]ElasticSearch官方文件-查詢語言Elasticsearch
- UE4 Shader 編譯以及變種實現編譯
- Compute Shader 簡介
- WebGL Shader 環境搭建Web
- OpenGL shader 程式基礎
- Cesium渲染模組之Shader
- Shader:常用結構體結構體
- Android著色器——ShaderAndroid
- 【Shader】ComputeScreenPos 的使用
- 寫一個Geometry Shader
- Godot 字型邊框shaderGo
- 【GLSL教程】(三)在OpenGL中向shader傳遞資訊
- GPU精粹與Shader程式設計(四):真實感渲染GPU程式設計
- Max/MSP/Jitter 官方教程翻譯11 - 矩陣混合矩陣
- lxml官方入門教程(The lxml.etree Tutorial)翻譯XML
- Moya官方文件翻譯
- unity 統一替換shaderUnity
- Shader 函式視覺化函式視覺化
- 在 SwiftUI 中使用 Metal ShaderSwiftUI
- docker官方文件翻譯3Docker