SHARE
TWEET

Untitled

a guest Feb 7th, 2018 34 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/TestShader" {
  2.     Properties {
  3.         _Color ("Color", Color) = (1,1,1,1)
  4.         _Glossiness ("Smoothness", Range(0,1)) = 0.5
  5.         _Metallic ("Metallic", Range(0,1)) = 0.0
  6.  
  7.         _EmissionTex ("Emission", 2D) = "white" {}
  8.         [HDR] _EmissionColor ("Emission color", Color) = (0.5, 0.5, 0.5, 0.5)
  9.  
  10.         _FlickerPosX ("Flicker position X", float) = 0
  11.         _FlickerPosY ("Flicker position Y", float) = 0
  12.         _FlickerRad ("Flicker radius", float) = 1
  13.         _FlickerIntensive ("Flicker additive multiplier", float) = 5
  14.     }
  15.     SubShader {
  16.         LOD 200
  17.         Tags { "RenderType" = "Opaque" }
  18.  
  19.         CGPROGRAM
  20.         // Physically based Standard lighting model, and enable shadows on all light types
  21.         #pragma surface surf Standard fullforwardshadows
  22.  
  23.         // Use shader model 3.0 target, to get nicer looking lighting
  24.         #pragma target 3.0
  25.  
  26.         sampler2D _EmissionTex;
  27.  
  28.         struct Input {
  29.             float2 uv_EmissionTex;
  30.         };
  31.  
  32.         half _Glossiness;
  33.         half _Metallic;
  34.         fixed4 _Color;
  35.         float4 _EmissionColor;
  36.        
  37.         float _FlickerPosX;
  38.         float _FlickerPosY;
  39.         float _FlickerRad;
  40.         float _FlickerIntensive;
  41.  
  42.         void surf (Input input, inout SurfaceOutputStandard o)
  43.         {
  44.             o.Albedo = _Color;
  45.             float2 flickerPos = (_FlickerPosX, _FlickerPosY);
  46.             float dist = length (flickerPos - input.uv_EmissionTex);
  47.             float emissionMultiplier = 1 + clamp (_FlickerRad - dist, 0, 1) * _FlickerIntensive;
  48.            
  49.             float4 emission = tex2D (_EmissionTex, input.uv_EmissionTex) * _EmissionColor * emissionMultiplier;
  50.             o.Emission = emission;
  51.  
  52.             o.Metallic = _Metallic;
  53.             o.Smoothness = _Glossiness;
  54.         }
  55.         ENDCG
  56.     }
  57.     FallBack "Diffuse"
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top