R1
This commit is contained in:
parent
37252a4edc
commit
19ab6f65e3
258 changed files with 406592 additions and 0 deletions
28
Assets/Shaders/Fear.shader
Normal file
28
Assets/Shaders/Fear.shader
Normal file
|
@ -0,0 +1,28 @@
|
|||
Shader "Custom/PostProcess" {
|
||||
Properties {
|
||||
_MainTex("Texture", 2D) = "white" {}
|
||||
_Fear ("Fear", Float) = 100
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Pass {
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
// Properties
|
||||
sampler2D _MainTex;
|
||||
float _Fear;
|
||||
|
||||
float4 frag(v2f_img input) : COLOR {
|
||||
float4 baseCol = tex2D(_MainTex, input.uv);
|
||||
float ratio = _Fear/100.f;
|
||||
float inverseRatio = 1 - ratio;
|
||||
float fearBaseColor = (baseCol.x + baseCol.y + baseCol.z) / 3;
|
||||
baseCol = float4(baseCol.x * inverseRatio + fearBaseColor * ratio, baseCol.y * inverseRatio + fearBaseColor * ratio, baseCol.z * inverseRatio + fearBaseColor * ratio, 1.0);
|
||||
float distFromCenter = distance(input.uv.xy, float2(0.5, 0.5)) * 4 * ratio;
|
||||
return float4(1 - distFromCenter, 1 - distFromCenter, 1 - distFromCenter, 1.0) * baseCol;
|
||||
}
|
||||
ENDCG
|
||||
}}}
|
Reference in a new issue