看板 GameDesign 關於我們 聯絡資訊
最近有整理Unity Shader Forge Setting說明 大部份內容是我自己腦補(誤 給大家參考參考 有寫錯歡迎指正 也有分享在我的 blog http://riveragamer.blogspot.tw/2017/03/shader-forge.html 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版本 = 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: 任天堂裝置的支援 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光照 方案 - Per-pixel light probe sampling: Light probe環景光照偵測計算是否允許 在per-pixel階段 - Reflection probe support: 是否支援即時反光光照計算 - Receive Ambient Light: 是否能接收基本模糊光源顏色 - Mask directional light specular by shadows 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 - 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情況下的動作) 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 -- 愛打電動到愛上製作遊戲 Blog: http://riveragamer.blogspot.tw/ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.117.152.17 ※ 文章網址: https://www.ptt.cc/bbs/GameDesign/M.1489546555.A.E9C.html ※ 編輯: riveranb (122.117.152.17), 03/15/2017 10:58:06
laikyo: 官方範例的溶解真有趣 03/15 11:40
chargo: 推這個吱吱 03/15 12:11
gyd: 03/15 13:48
sakyer: 推 03/15 19:29
Bencrie: 503 大學長先拜一下 orz 03/15 19:35
riveranb: 咦,ntou ? XD 03/15 20:05