keywords LightMode=Always
程序员文章站
2022-06-04 15:41:44
...
is there any shader that will executed always. that means we should not care about the camera’s rendering mode.
yep, unity support us the keyword Always to solve this problem.
next, we will give the shader code like this:
// Upgrade NOTE: replzaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Course/Always"
{
SubShader
{
pass
{
Tags{ "LightMode"="Always"}
Blend One Zero
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "Lighting.cginc"
struct vertOut
{
float4 pos:SV_POSITION;
float4 color:COLOR;
};
vertOut vert(appdata_base v)
{
vertOut o;
o.pos=UnityObjectToClipPos(v.vertex);
o.color=float4(1,0,0,1);
return o;
}
float4 frag(vertOut i):COLOR
{
return i.color;
}
ENDCG
}
}
}
you can change the camera’s rendering mode to any of this:
the object will be render to red in every circumstances.
the effect is :
推荐阅读
-
网站优化title,keywords,description标签
-
Google官方 keywords meta标签对GOOGLE排名
-
Win32Api -- 使应用Always on top的几种方法
-
去掉destoon资讯内容页keywords关键字自带的文章标题的方法
-
mongodb 启动 WARNING: soft rlimits too low, transparent_hugepage/enabled is 'always'. never
-
HTML中meta标签及Keywords
-
HDU-2222 Keywords Search 【题解】
-
三星老机型Always On Display功能也能播放GIF动画了
-
POJ 1476 Always On the Run G++ 动态规划dp 巧妙 没掌握
-
Verilog HDL always语句