Unity3D Shader官方教程翻譯(九)—-Shader文法:Pass的霧化處理

來源:互聯網
上載者:User
ShaderLab syntax: Fog

Fog parameters are controlled with Fog command.

Fog 命令控制霧化參數

Fogging blends the color of the generated pixels down towards a constant color based on distance from camera. Fogging does not modify a blended pixel's alpha value, only its RGB components.

霧化混合產生像素的顏色是依據於常量顏色(這個常量顏色是基於網路攝影機的距離的)。霧化不會改變像素的alpha值,僅僅是改變它的rgb分量。

指導:霧化是一種類比自然界中霧氣對情境物體視覺效果產生影響的圖形繪製技術。此技術從視點到物體逐漸將物體的繪製顏色淡化,直至背景色。通過霧化處理可較好的表現出物體到視點的距離感。(根據物體距離視點的遠近對其進行恰當的模糊處理)

Syntax
Fog {  Fog Commands  }
Specify fog commands inside curly braces. 
在大括弧內指定fog命令

  Mode Off | Global | Linear | Exp | Exp2 
Defines fog mode. Default is global, which translates to Off or Exp2 depending whether fog is turned on in Render Settings. 
定義個fog模式,預設的是全域,它轉換為關閉或EXP2取決於是否開啟渲染設定中的霧。

指導:Linear | Exp | Exp2 對應OpenGL中的GL_LINEAR(線性)、GL_EXP(指數)和GL_EXP2(指數平方)

 
Color  ColorValue
Sets fog color.
設定霧的顏色
 
Density  FloatValue
Sets density for exponential fog. 
設定霧的強度
 
Range  FloatValue  ,  FloatValue
Sets near & far range for linear fog. 
設定線性霧的最近和最遠值
Details詳情

Default fog settings are based on Render
Settings
: fog mode is either Exp2 or Off; density & color taken from settings as well.

預設的霧的設定時基於渲染設定:霧的模式是Exp2或者off;強度和顏色也是從設定中擷取

Note that if you use fragment programs,
Fog settings of the shader will still be applied. On platforms where there is no fixed function Fog functionality, Unity will patch shaders at runtime to support the requested Fog mode.

請注意,如果您使用片斷編程,著色器的霧設定將仍然適用。Unity3d的平台上,那裡是沒有固定功能霧的功能,Unity3d將在運行時修補著色器請求支援的霧模式。

 

由www.J2meGame.com原創,轉載請說明。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.