Standard-Specular-Blend.shader 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Shader "GLTFUtility/Standard Transparent (Specular)" {
  2. Properties {
  3. _Color ("Color", Color) = (1,1,1,1)
  4. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5. _SpecGlossMap ("Specular Map", 2D) = "white" {}
  6. _SpecColor ("Specular Color", Color) = (1,1,1,1)
  7. _GlossyReflections ("Glossiness", Range(0,1)) = 1
  8. [Normal] _BumpMap ("Normal", 2D) = "bump" {}
  9. _BumpScale("NormalScale", Float) = 1.0
  10. _OcclusionMap ("Occlusion", 2D) = "white" {}
  11. _EmissionMap ("Emission", 2D) = "black" {}
  12. _EmissionColor ("Emission Color", Color) = (0,0,0,0)
  13. }
  14. SubShader {
  15. Tags { "RenderType"="Transparent" "Queue"="Transparent" }
  16. LOD 200
  17. CGPROGRAM
  18. // Physically based StandardSpecular lighting model, and enable shadows on all light types
  19. #pragma surface surf StandardSpecular fullforwardshadows alpha:fade
  20. // Use shader model 3.0 target, to get nicer looking lighting
  21. #pragma target 3.0
  22. sampler2D _MainTex;
  23. sampler2D _SpecGlossMap;
  24. sampler2D _BumpMap;
  25. sampler2D _OcclusionMap;
  26. sampler2D _EmissionMap;
  27. struct Input {
  28. float2 uv_MainTex;
  29. float2 uv_BumpMap;
  30. float2 uv_SpecGlossMap;
  31. float2 uv_OcclusionMap;
  32. float2 uv_EmissionMap;
  33. float4 color : COLOR;
  34. };
  35. half _GlossyReflections;
  36. half _BumpScale;
  37. fixed4 _Color;
  38. fixed4 _EmissionColor;
  39. // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  40. // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  41. // #pragma instancing_options assumeuniformscaling
  42. UNITY_INSTANCING_BUFFER_START(Props)
  43. // put more per-instance properties here
  44. UNITY_INSTANCING_BUFFER_END(Props)
  45. void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
  46. // Albedo comes from a texture tinted by color
  47. fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  48. o.Albedo = c.rgb * IN.color;
  49. o.Alpha = c.a;
  50. // Specular / roughness
  51. fixed4 s = tex2D (_SpecGlossMap, IN.uv_SpecGlossMap);
  52. o.Specular = s.rgb * _SpecColor;
  53. o.Smoothness = s.a * _GlossyReflections;
  54. // Normal comes from a bump map
  55. o.Normal = UnpackScaleNormal (tex2D (_BumpMap, IN.uv_BumpMap), _BumpScale);
  56. // Ambient Occlusion comes from red channel
  57. o.Occlusion = tex2D (_OcclusionMap, IN.uv_OcclusionMap).r;
  58. // Emission comes from a texture tinted by color
  59. o.Emission = tex2D (_EmissionMap, IN.uv_EmissionMap) * _EmissionColor;
  60. }
  61. ENDCG
  62. }
  63. FallBack "Diffuse"
  64. }