Skip to content

Instantly share code, notes, and snippets.

@belzecue
Forked from nir1082/Hologram.shader
Created December 6, 2019 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save belzecue/ffb97a6f93290bfbdd90983110192a23 to your computer and use it in GitHub Desktop.
Save belzecue/ffb97a6f93290bfbdd90983110192a23 to your computer and use it in GitHub Desktop.
[Unity] シンプルなホログラムっぽいシェーダー
Shader "Custom/Hologram" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
[HDR]_Emission ("Emission", Color) = (0.0, 0.0, 0.0, 0.0)
_Speed ("Scroll Speed", float) = .5
_Space ("Space", Range(0,1)) = .1
_Division ("Division Count", float) = 150
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent" "IgnoreProjector"="True" }
LOD 200
CGPROGRAM
#pragma surface surf Standard alpha
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
fixed3 worldPos;
fixed3 viewDir;
};
fixed4 _Color;
fixed4 _Emission;
fixed _Speed;
fixed _Space;
fixed _Division;
void surf (Input IN, inout SurfaceOutputStandard o) {
clip (frac((IN.worldPos.y + _Time.r * _Speed) * _Division) - _Space);
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Emission = _Emission * (1.0 - saturate(dot (normalize(IN.viewDir), o.Normal)));
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment