More Related Content Similar to Shader forge設定說明文件
Similar to Shader forge設定說明文件 (8) More from River Wang (15) Shader forge設定說明文件1. Shader Forge
設定頁面說明:
O.S. Shader Forge 官方尚未找到詳細說明文件,所以說明內容大部份是我自己推測,需要實際
實作驗證。
1. Shader Settings
- Path: 對應 Shader 選單的名字路徑。
- FallBack: 預設取代 shader。由 Pick 按鈕選取。
- LOD: Level of details 設定,當物件佔螢幕面積超過設定數字(如 200)允許使用此 shader。
- Allow using atlased sprites: 允許使用合成大圖(packed atlas)。
- Draw call batching: 是否允許 batching。
- Inspector preview mode: Material inspector 檢視的預覽物體類型。
- Target renderers: 此 shader 指定支援的硬體環境對象。
Direct3D 9: 舊 windows DirectX 環境。
Direct3D 11: 新 windows DirectX 硬體環境,在 windows 環境使用 Unity Editor 編輯時
Direct3D 9 與 Direct3D 11 要選取才會正常顯示,不支援 PC game 環境時,最終版本
shader 不需要選取 Direct3D 9 與 Direct3D 11。
OpenGL Core: 泛指 OpenGL 1.x/2.x/3.x/4.x 環境。沒有支援 PC game 環境時最終版本
shader 不需要選取 OpenGL Core。
OpenGL ES 2.0: 移動裝置環境,OpenGL ES2 版本。
2. OpenGL ES 3.0: 移動裝置環境,OpenGL ES3 版本。
iOS Metal: 移動裝置環境,新的 iOS 繪圖環境(建議選取支援)。
Direct3D 11 for Windows RT/Phone: Windows Phone(移動裝置版本)支援的 Direct3D
11 環境。
Xbox One | PlayStation 4 | PlayStation Vita: 各類家用主機情況。
Nintendo 3DS | Nintendo Wii U: 任天堂裝置的支援。
2. Properties
列出 Shader 自訂的所有變數(properties)。
3. Lighting
- Render Path: Unity 光照繪圖流程方案(LightMode),Forward(預設,傳統直接進行繪圖流程))
與 Deferred(分離式繪圖流程)。
Forward 模式下可設定 Light Count。Single Directional(預設)只允許單一方向光;
Multi-light 允許場中多個光源(注意每多一個光源會多跑一次 ForwardAdd pass)。
- LightMode: 已支援的打光方案。Unlit/Custom(未打光);Blinn-Phone ; Phone ;
PBL(Physically Based Lighting)。
(PBL) Specular Mode 分為 Specular 與 Metallic 兩種反光方案實作。
- Gloss Mode: Gloss(光澤感)與 Roughness(粗糙感)。
Remap gloss from [0-1] to [1-2048]: 更精確地 gloss 彩度分布計算,效能代價較高。
- Transparency Mode: 透明打光實作方案。Fade(傳統漸透明效果);Reflective(保持有真實反光
表現)。
- Energy Consering: 數入與輸出結果的光能量是否守恆(對 PBL 很重要)。
- Lightmap & light probes: 允許支援 Unity5 內建的 global illumination 光照方案。
3. - Per-pixel light probe sampling: Light probe 環景光照偵測計算是否允許在 per-pixel 階段。
- Reflection probe support: 是否支援即時反光光照計算。
- Receive Ambient Light: 是否能接收基本模糊光源顏色。
- Mask directional light specular by shadows: 由方向光產生的影子資訊來當作反光(specular)
之遮罩資訊。
4. Geometry
- Face Culling: 排除正面或背面或雙面繪圖選項。
- Normal Quality: Interpolated(直接使用內插結果,較省效能但較不準);Normalized(精確計
算)。
- Vertex Positioning: 頂點位置座標計算模式。World space(一般幾何頂點);Clip space(螢幕空
間頂點,應用在全螢幕後處理時);Billboard(視為面向鏡頭的 Billboard 對象)。
- Normal space: 實做 normal mapping(bump mapping)時,normal 計算要採用哪種空間。
Tangent(幾何表面空間);Object(物體空間);World(世界空間)。
- Vertex offset mode: 頂點位移方式。Relative(相對偏移);Absolute(頂點座標直接被新的輸入
值取代)。
- Tessellation Mode: 三角形 tessellate 方法。分為 Regular 與 Edge length based。
- Outline Extrude Direction: 邊緣幾何突出方向選擇。有 From origin(由原點向頂點座標分量展
開);Vertex normals(延著頂點法向量延伸);Vertex colors(由頂點顏色決定偏移量)。
- Per-pixel screen coordinates: 是否在每個 pixel 上計算螢幕對應座標。
- Show 2D sprite pixel snap option in material: 精確計算 2D sprite 對應螢幕座標,實現精準的
sprite based game 繪圖結果。
5. Blending
4. - Blend Mode: 透明混合方式。Opaque(不透明);Alpha Blended(透明,由 alpha 決定不透明
度);Alpha Blended Premultipied(透明,自身 RGBA 不變累加上去);Additive(透明,新舊顏
色 RGBA 相加);Screen(透明,舊顏色依新顏色比例衰減);Multiplicative(透明;新顏色與舊顏
色相乘做合成)。
透明混合公式係數: Source(fragment shader 產生顏色);Destination(目標 frame buffer
已存在顏色)。
- Color Mask: shader 寫入 color buffer 時的顏色通道 mask
- Dithered alpha clip: 使用 Opacity Clip 功能時,可支援的 dithered alpha clip matrix(2x2;3x3;
4x4)。
- Offset Factor, Offset Units: Polygon offset 偏移設定。
- Per-object refraction/scene color(expensive): 每個物件使用此 shader 時都重新更新
refractive texture 內容(截取當前螢幕),效能代價很高。
Texture name/group: 共用的 refractive texture 名字。
- Receive Fog: 是否支援 Fog 運算。
- Auto Sort: 自動設定 rendering sort 相關參數。
Order: Shader tag 中 Queue 設定值。
Render Type: Shader tag 中 RenderType 設定值。
Depth Test: Depth buffer 的深度值比較規則。
Ignore Projectors: 是否呼略 projector 運算效果。
Write to Depth buffer: 此 shader 的深度結果是否要寫入 depth buffer。
- Stencil Buffer: 此 shader 是否進行 stencil buffer 操作。
可設定 Reference Value,Comparison 比較規則,Masks for Read Mask 和 Write Mask。
Pass(stencil buffer pass 情空下的動作);Fail(stencil buffer fail to pass 情況下的動作);
Fail Z(depth buffer fail to pass 情況下的動作)。
5. 6. Experimental
- Force Shader Model 2.0: 強迫此 shader 支援 shader model 2(#pragma target 2.0)。
- Force no custom shadow pass: 關閉自動產生的 shadow pass。
- Force no fallback: 強迫在 shader 中不設定 fallback shader。
7. 建議
- 手機開發環境(mobile device)下,target renderers 選取 OpenGL ES2,OpenGL ES3,iOS
Metal。
- Forward for forward rendering path 與 Deferred for deferrend rendering path。
使用 Deferred 時,不應該再操作 stencil buffer,或要小心使用,Unity 本身已使用掉一
部份 stencil bits。
- 不考慮打光時就由 Unlit 選項開始設計。
- Light Count 保持為 Single Directional 的效能代價較低。
- 所有有用到 per-pixel 或 per-object 字眼的功能選項,效能代價一定較高。
- Normal Quality 使用 interpolated 選項較省效能。
- Show 2D sprite pixel snap option 對開發 2D sprite based game 很有幫助。
- 不使用 Unity 內建 fog 運算時必需取消 Receive Fog。
- 要支援低階 Android 裝置時可選取 Force Shader Model 2.0,但 shader 開發限制會變多。
- 不支援影子功能時要選取 Force no custom shadow pass。