Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/ReflexSight" {
- Properties {
- _Color ("Color", Color) = (1,1,1,1)
- [HideInInspector] _MainTex ("Albedo (RGB)", 2D) = "white" {}
- _Glossiness ("Smoothness", Range(0,1)) = 0.5
- _Metallic ("Metallic", Range(0,1)) = 0.0
- _Sharpness ("Dot Sharpness", Range(0,100000)) = 10000
- }
- SubShader {
- Tags {
- "RenderType"="Transparent"
- "Queue" = "Transparent"
- }
- LOD 200
- ZWrite On
- ZTest LEqual
- CGPROGRAM
- #pragma surface surf Standard fullforwardshadows alpha
- #pragma target 3.0
- sampler2D _MainTex;
- struct Input {
- float2 uv_MainTex;
- float3 viewDir;
- };
- half _Glossiness;
- half _Metallic;
- fixed4 _Color;
- int _Sharpness;
- UNITY_INSTANCING_BUFFER_START(Props)
- UNITY_INSTANCING_BUFFER_END(Props)
- void surf (Input IN, inout SurfaceOutputStandard o) {
- // red dot is at float3(0,0,-1) direction (forward Z in unity space), in model space
- float3 transformedForward =
- normalize(mul((float3x3)unity_ObjectToWorld, float3(0,0,-1)));
- float strength = pow(dot(IN.viewDir, transformedForward), _Sharpness);
- fixed4 c = fixed4(strength, 0, 0, strength);
- o.Albedo = _Color * strength;
- o.Emission = o.Albedo;
- o.Metallic = _Metallic;
- o.Smoothness = _Glossiness;
- o.Alpha = strength;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment