81 lines
3.1 KiB
Plaintext
81 lines
3.1 KiB
Plaintext
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
|
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
|
|
|
Shader "Custom/BlinkC" {
|
|
Properties {
|
|
_LightColor ("LightColor", Color) = (1,1,1,1)
|
|
__LightFreq ("_LightFreq", Range(2, 10)) = 2
|
|
_StartShift ("StartShift", Range(0, 10)) = 0
|
|
_LightTexture ("LightTexture", 2D) = "white" {}
|
|
}
|
|
SubShader {
|
|
Tags {
|
|
"RenderType"="Opaque"
|
|
}
|
|
LOD 200
|
|
Pass {
|
|
Name "FORWARD"
|
|
Tags {
|
|
"LightMode"="ForwardBase"
|
|
}
|
|
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#define UNITY_PASS_FORWARDBASE
|
|
#include "UnityCG.cginc"
|
|
#include "UnityPBSLighting.cginc"
|
|
#include "UnityStandardBRDF.cginc"
|
|
#pragma multi_compile_fwdbase_fullshadows
|
|
#pragma multi_compile_fog
|
|
#pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2
|
|
#pragma target 3.0
|
|
uniform float4 _TimeEditor;
|
|
uniform float4 _LightColor;
|
|
uniform float __LightFreq;
|
|
uniform float _StartShift;
|
|
uniform sampler2D _LightTexture; uniform float4 _LightTexture_ST;
|
|
struct VertexInput {
|
|
float4 vertex : POSITION;
|
|
float3 normal : NORMAL;
|
|
float2 texcoord0 : TEXCOORD0;
|
|
};
|
|
struct VertexOutput {
|
|
float4 pos : SV_POSITION;
|
|
float2 uv0 : TEXCOORD0;
|
|
float4 posWorld : TEXCOORD1;
|
|
float3 normalDir : TEXCOORD2;
|
|
UNITY_FOG_COORDS(3)
|
|
};
|
|
VertexOutput vert (VertexInput v) {
|
|
VertexOutput o = (VertexOutput)0;
|
|
o.uv0 = v.texcoord0;
|
|
o.normalDir = UnityObjectToWorldNormal(v.normal);
|
|
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
|
o.pos = UnityObjectToClipPos(v.vertex );
|
|
UNITY_TRANSFER_FOG(o,o.pos);
|
|
return o;
|
|
}
|
|
float4 frag(VertexOutput i) : COLOR {
|
|
i.normalDir = normalize(i.normalDir);
|
|
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
|
float3 normalDirection = i.normalDir;
|
|
float3 viewReflectDirection = reflect( -viewDirection, normalDirection );
|
|
|
|
float4 _LightTexture_var = tex2D(_LightTexture,TRANSFORM_TEX(i.uv0, _LightTexture));
|
|
float4 timeStamp = _Time + _TimeEditor;
|
|
float3 emissive = ((_LightTexture_var.rgb*_LightColor.rgb)*abs(sin(((_StartShift+timeStamp.g)*__LightFreq))));
|
|
float3 finalColor = emissive;
|
|
fixed4 finalRGBA = fixed4(finalColor,1);
|
|
UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
|
|
return finalRGBA;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
FallBack "Diffuse"
|
|
CustomEditor "ShaderForgeMaterialInspector"
|
|
}
|