Unity3D Shader官方教程翻譯(一)

Shader Reference

著色參考

Shaders in Unity can be written in one of three different ways:

Unity3D著色器,可以寫在三種不同的方式之一:

assurface shaders,

asvertex and fragment shaders and

asfixed function shaders.

表面著色,

頂點和片段著色器和

作為固定功能著色

Theshader tutorial can guide you on choosing the right type for your needs.

著色教程可以指導您對您的需求選擇正確的類型

Regardless of which type you choose, the actual meat of the shader code will always be wrapped in a language called ShaderLab, which is used to organize the shader structure. It looks like this:

無論您選擇哪種類型,實際的shader代碼肉總是會被裹在被稱為ShaderLab一種語言,這是用來組織結構著色。它看起來像這樣:

Shader "MyShader" {

Properties { _MyTexture ("My Texture", 2D) = "white" { }

// other properties like colors or vectors go here as well //其他屬性如顏色或向量 }

SubShader {

// here goes the 'meat' of your

// - surface shader or

// - vertex and program shader or

// - fixed function shader

/ /這里寫內容

/ / - 表面著色 或

/ / - 頂點和程序著色 或

/ / - 固定功能著色

}

SubShader {

// here goes a simpler version of the SubShader above than can run on older graphics cards

/ /可以運行在舊的顯卡的著色器

}

}

We recommend that you start by reading about some basic concepts of the ShaderLab syntax in the sections listed below and then to move on to read about surface shaders or vertex and fragment shaders in other sections. Since fixed function shaders are written using ShaderLab only, you will find more information about them in the ShaderLab reference itself.

我們建議您閱讀ShaderLab在下面列出,然后轉移到其他章節中有關表面著色或頂點和片段著色器讀取的部分語法的一些基本概念開始。由于固定功能著色器編寫只能使用ShaderLab,你會發現更多的關于他們的信息在ShaderLab引用本身。

The reference below includes plenty of examples for the different types of shaders. For even more examples of surface shaders in particular, you can get the source of Unity's built-in shaders from theResources section. Unity'sImage Effects package contains a lot of interesting vertex and fragment shaders.

下面的參考,包括大量的著色不同類型的例子。更多的在粒子系統中使用的表面著色的例子,你可以查閱Unity3D內置的Shader獲得更多信息。Unity3D的圖像效果包中包含了很多有趣的頂點和片段著色器。

Read on for shader reference, and check out theshader tutorial as well!

ShaderLab syntax: Shader

ShaderLab syntax: Properties

ShaderLab syntax: SubShader

ShaderLab syntax: Pass

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

ShaderLab syntax: UsePass

ShaderLab syntax: GrabPass

ShaderLab syntax: SubShader Tags

ShaderLab syntax: Fallback

ShaderLab syntax: other commands

Writing Surface Shaders

Surface Shader Examples

Custom Lighting models in Surface Shaders

Surface Shader Lighting Examples

Writing vertex and fragment shaders

Accessing shader properties in Cg

Providing vertex data to vertex programs

Built-in state variables in shader programs

GLSL Shader Programs

Advanced ShaderLab topics

Unity's Rendering Pipeline

Performance Tips when Writing Shaders

Rendering with Replaced Shaders

Using Depth Textures

Camera's Depth Texture

Platform Specific Rendering Differences

Shader Level of Detail

ShaderLab builtin values

由www.J2meGame.com精心原創,轉載請說明。http://www.j2megame.com/html/xwzx/ty/3301.html

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 229,885評論 6 541
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,312評論 3 429
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 177,993評論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,667評論 1 317
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,410評論 6 411
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,778評論 1 328
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,775評論 3 446
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,955評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,521評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,266評論 3 358
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,468評論 1 374
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,998評論 5 363
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,696評論 3 348
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,095評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,385評論 1 294
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,193評論 3 398
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,431評論 2 378

推薦閱讀更多精彩內容

  • <轉>我也忘了轉自哪里,抱歉,感謝原作者 什么是Shader Shader(著色器)是一段能夠針對3D對象進行操作...
    星易乾川閱讀 5,624評論 1 16
  • 微信好友一共500人左右,但是我的朋友圈點贊數從來不超過60人,所以需要集贊的我都沒有轉發過,估計都成功不了。剛才...
    Juzid055閱讀 255評論 7 1
  • 此刻我坐在辦公室的座位上,本來我的計劃是在家收拾東西然后中午12點一刻左右帶暖小姐去火車站乘坐開往泉城的火車。...
    小豬天堂閱讀 143評論 2 0
  • 曾經看過一句話:“啞巴胃是喇叭,肝是啞巴”,讓我一直都記著。如果是胃出問題了,你會有明顯的感覺,會感覺到胃痛,這是...
    土豆蜜兒閱讀 2,034評論 0 1
  • 在我們每次發版的時候總需要自己寫個變量來手動的改,是否是debug模式,來更改某些配置,現在我們使用系統給我們提供...
    Lazy1閱讀 4,181評論 2 1