Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/TestShader" {
- Properties {
- _Color ("Color", Color) = (1,1,1,1)
- _Glossiness ("Smoothness", Range(0,1)) = 0.5
- _Metallic ("Metallic", Range(0,1)) = 0.0
- _EmissionTex ("Emission", 2D) = "white" {}
- [HDR] _EmissionColor ("Emission color", Color) = (0.5, 0.5, 0.5, 0.5)
- _FlickerPosX ("Flicker position X", float) = 0
- _FlickerPosY ("Flicker position Y", float) = 0
- _FlickerRad ("Flicker radius", float) = 1
- _FlickerIntensive ("Flicker additive multiplier", float) = 5
- }
- SubShader {
- LOD 200
- Tags { "RenderType" = "Opaque" }
- CGPROGRAM
- // Physically based Standard lighting model, and enable shadows on all light types
- #pragma surface surf Standard fullforwardshadows
- // Use shader model 3.0 target, to get nicer looking lighting
- #pragma target 3.0
- sampler2D _EmissionTex;
- struct Input {
- float2 uv_EmissionTex;
- };
- half _Glossiness;
- half _Metallic;
- fixed4 _Color;
- float4 _EmissionColor;
- float _FlickerPosX;
- float _FlickerPosY;
- float _FlickerRad;
- float _FlickerIntensive;
- void surf (Input input, inout SurfaceOutputStandard o)
- {
- o.Albedo = _Color;
- float2 flickerPos = (_FlickerPosX, _FlickerPosY);
- float dist = length (flickerPos - input.uv_EmissionTex);
- float emissionMultiplier = 1 + clamp (_FlickerRad - dist, 0, 1) * _FlickerIntensive;
- float4 emission = tex2D (_EmissionTex, input.uv_EmissionTex) * _EmissionColor * emissionMultiplier;
- o.Emission = emission;
- o.Metallic = _Metallic;
- o.Smoothness = _Glossiness;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Add Comment
Please, Sign In to add comment