您的位置:首页 > 移动开发 > Unity3D

unity如何设置fog,shader如何接收fog

2017-05-08 10:42 489 查看
设置fog,在WIndow->Lighting,Scene签页的Fog项勾选上,设置FogColor,Mode(The options are Linear, Exponential and Exponential Squared (these are in increasing order of fog accumulation with distance).

shader接收fog,需要添加以下几句:

pragma multi_compile_fog

a2v加:float2 texcoord1 : TEXCOORD1;

v2f加:#ifndef LIGHTMAP_OFF

half2 uvLM : TEXCOORD5;

#endif

UNITY_FOG_COORDS(6)

vert加:

UNITY_TRANSFER_FOG(o,o.pos);

frag加:

UNITY_APPLY_FOG(i.fogCoord, finalRGB);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: