// Unlit shader. Simplest possible textured shader.
// - no lighting
// - no lightmap support
// - no per-material color Shader "Unlit/Texture" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
} SubShader {
Tags { "RenderType"="Opaque" }
LOD 100 Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog #include "UnityCG.cginc" struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
}; struct v2f {
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
}; sampler2D _MainTex;
float4 _MainTex_ST; v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
} fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.texcoord);
UNITY_APPLY_FOG(i.fogCoord, col);
UNITY_OPAQUE_ALPHA(col.a);
return col;
}
ENDCG
}
} }

SV_Target 与Color略有区别,大体相同,有可能是两者的位置前者是中心位置,后者不是,有0.5像素的偏移,这个以后确认下

Fog相关的几个函数

UnityCG.cginc中的解释

// multi_compile_fog Will compile fog variants.

// UNITY_FOG_COORDS(texcoordindex) Declares the fog data interpolator.

// UNITY_TRANSFER_FOG(outputStruct,clipspacePos) Outputs fog data from the vertex shader.

// UNITY_APPLY_FOG(fogData,col) Applies fog to color "col". Automatically applies black fog when in forward-additive pass.

// Can also use UNITY_APPLY_FOG_COLOR to supply your own fog color.

最新文章

  1. logback日志写入数据库(mysql)配置
  2. Spring学习笔记之五----Spring MVC
  3. C# Process执行bat
  4. Linux系统在嵌入式硬件上的移植
  5. Fixed theorems
  6. 【html】【11】函数名称约束规范
  7. UOJ#191. 【集训队互测2016】Unknown
  8. Mybatis上路_05-使用命令行自动生成
  9. 【转】Android Studio 的小小配置
  10. JS操作DOM元素属性和方法
  11. C++深层复制解决指针悬挂
  12. 解决pycharm无法导入本地包的问题(Unresolved reference 'tutorial')
  13. SERVLET API 中 forward() 与 redirect()的区别?
  14. 常用上网增强类Chrome扩展(转)
  15. 201521123117 《Java程序设计》第9周学习总结
  16. XML之XPath
  17. 阿里云安装配置mysql(centos版)
  18. CListCtrl颜色设置
  19. [HNOI2019]校园旅行
  20. jQuery-4.动画篇---jQuery核心

热门文章

  1. javascript和c#的深度拷贝的一种通用方法
  2. 2016/08/18 select
  3. 九度OJ 1135:字符串排序 (排序)
  4. Performance Tuning Using Linux Process Management Commands
  5. 阻止SSIS import excel时的默认行为
  6. UITextInputMode类的使用
  7. Oracle序列更新
  8. (C)struct结构体指针
  9. 配置composer代理
  10. POJ2115 C Looooops ——模线性方程(扩展gcd)