Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Shader "I_Jemin/Burnout Dissolve" {
  2. Properties {
  3. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  4. _NormalMap("Normal Map",2D) = "black" {}
  5. _NoiseMap("Noise Map",2D) = "black" {}
  6. _Cutoff("Cutoff Value",Range(0,1.1))=0.5
  7.  
  8. _Cutout("Cut out",Range(0,1)) = 0.2
  9.  
  10. [HDR]_BurnColor("Burn edge Color",Color) = (1,0,0,1)
  11.  
  12. }
  13. SubShader {
  14. Tags {"Queue" = "AlphaTest" "RenderType"="TransparentCutout" }
  15.  
  16. cull off
  17. CGPROGRAM
  18. // Physically based Standard lighting model, and enable shadows on all light types
  19. #pragma surface surf Standard alphatest:_Cutoff
  20. #pragma target 3.0
  21.  
  22. sampler2D _MainTex;
  23. sampler2D _NormalMap;
  24. sampler2D _NoiseMap;
  25.  
  26. float4 _BurnColor;
  27.  
  28. float _Cutout;
  29.  
  30.  
  31. struct Input {
  32. float2 uv_MainTex;
  33. float2 uv_NormalMap;
  34. float2 uv_NoiseMap;
  35. };
  36.  
  37. void surf (Input IN, inout SurfaceOutputStandard o) {
  38.  
  39. // basic albedo settings
  40. o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_NormalMap));
  41. fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
  42. o.Albedo = c.rgb;
  43.  
  44.  
  45. // get burn opacity percentage
  46. float opacity = tex2D(_NoiseMap,IN.uv_NoiseMap).r;
  47.  
  48. _Cutout = pow(_Cutout,2);
  49.  
  50. if(opacity < _Cutout * 1.2)
  51. {
  52. o.Emission = _BurnColor;
  53. }
  54.  
  55. if(opacity < _Cutout)
  56. {
  57. o.Alpha = 0;
  58. }
  59. else
  60. {
  61. o.Alpha = c.a;
  62. }
  63. }
  64. ENDCG
  65. }
  66. FallBack "Diffuse"
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement