Shader "Custom/Standard-HueShift" { Properties { _Color ("Color", Color) = (1,1,1,1) _MainTex ("Albedo (RGB)", 2D) = "white" {} _Cutoff ("Cutoff", Range(0,1)) = 0 _SpecGlossMap ("Specular", 2D) = "black" {} [Toggle(USE_EMIT_UV)] _UseEmitUv("Use Emission UV Offsets", Float) = 0 _EmissionMap ("Emission", 2D) = "white" {} _EmissionColor ("Emission Color", Color) = (0,0,0,1) _EmissionIntensity("Emission Intensity", Range(0,1)) = 1 _BumpMap ("Bumpmap", 2D) = "bump" {} _Hue ("Hue", Range(0,6.28)) = 0 _EmissionHue ("Emission Hue", Range(0,6.28)) = 0 _NoiseMap ("Noise Texture",2D) = "white" {} _Dissolve ("Dissolve Progress", Range(0,1)) = 0 _OcclusionMap("AO", 2D) = "white" {} _OcclusionIntensity("Occlusion Intensity",Range(0,1)) = 1 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 Cull Off CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf StandardSpecular fullforwardshadows addshadow nodirlightmap // Use shader model 3.0 target, to get nicer looking lighting #pragma target 3.0 #pragma shader_feature USE_EMIT_UV sampler2D _MainTex; sampler2D _SpecGlossMap; sampler2D _EmissionMap; sampler2D _BumpMap; sampler2D _NoiseMap; sampler2D _OcclusionMap; struct Input { float2 uv_MainTex; float2 uv_NoiseMap; float2 uv_EmissionMap; }; half _Glossiness; half _Metallic; fixed4 _Color; fixed4 _EmissionColor; fixed _Hue; fixed _EmissionHue; fixed _EmissionIntensity; fixed _Dissolve; fixed _OcclusionIntensity; // #pragma instancing_options assumeuniformscaling UNITY_INSTANCING_BUFFER_START(Props) // put more per-instance properties here UNITY_INSTANCING_BUFFER_END(Props) float4 ApplyHue(float4 col, float hueAdjust) { const float3 k = float3(0.57735, 0.57735, 0.57735); half cosAngle = cos(hueAdjust); return float4(col.rgb * cosAngle + cross(k, col.rgb) * sin(hueAdjust) + k * dot(k, col.rgb) * (1.0 - cosAngle),col.a); } float _Cutoff; void surf (Input IN, inout SurfaceOutputStandardSpecular o) { #ifdef USE_EMIT_UV float2 uv = IN.uv_EmissionMap; #else float2 uv = IN.uv_MainTex; #endif _Dissolve = (_Dissolve - 0.02) * 1.04; float noise = tex2D(_NoiseMap, IN.uv_NoiseMap).r; // Albedo comes from a texture tinted by color float4 c = ApplyHue(tex2D (_MainTex, uv) * _Color,_Hue); if (noise < _Dissolve || c.a < _Cutoff) { discard; } fixed4 specMap = tex2D (_SpecGlossMap, uv); o.Normal = UnpackNormal (tex2D (_BumpMap, uv)); o.Emission = ApplyHue(tex2D(_EmissionMap,uv) * _EmissionColor,_EmissionHue)* _EmissionIntensity; if (noise < _Dissolve + 0.02) o.Emission = _EmissionColor; o.Albedo = c.rgb* lerp(1,tex2D(_OcclusionMap, uv).rgb, _OcclusionIntensity); // Metallic and smoothness come from slider variables o.Specular = specMap.r; o.Smoothness = specMap.a; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }