Advertisement
Guest User

Untitled

a guest
Dec 24th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1.  
  2. Shader "Erosion/Atmosphere"
  3. {
  4. Properties
  5. {
  6. _VaporField("Base (RGB)", 2D) = "white" {}
  7. _MaxVaporForBlackColor("MaxVaporForBlackColor", Float) = 0.1
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType" = "Opaque" }
  12. LOD 200
  13.  
  14. CGPROGRAM
  15. #pragma exclude_renderers gles
  16. #pragma surface surf Lambert vertex:vert
  17. #pragma target 3.0
  18. #pragma glsl
  19.  
  20. sampler2D _VaporField;
  21. uniform float _AtmoHeight, _ScaleY, _MaxVaporForBlackColor;
  22.  
  23. struct Input
  24. {
  25. float2 uv_MainTex;
  26. };
  27.  
  28.  
  29.  
  30. void vert(inout appdata_full v)
  31. {
  32. v.tangent = float4(1,0,0,1);
  33.  
  34. v.vertex.y += _AtmoHeight * _ScaleY;
  35. }
  36.  
  37. /*float3 FindNormal(float2 uv, float u)
  38. {
  39.  
  40. float ht0 = GetTotalHeight(tex2D(_MainTex, uv + float2(-u, 0)));
  41. float ht1 = GetTotalHeight(tex2D(_MainTex, uv + float2(u, 0)));
  42. float ht2 = GetTotalHeight(tex2D(_MainTex, uv + float2(0, -u)));
  43. float ht3 = GetTotalHeight(tex2D(_MainTex, uv + float2(0, u)));
  44.  
  45. float2 _step = float2(1.0, 0.0);
  46.  
  47. float3 va = normalize(float3(_step.xy, ht1-ht0));
  48. float3 vb = normalize(float3(_step.yx, ht2-ht3));
  49.  
  50. return cross(va,vb);
  51. }*/
  52.  
  53. void surf(Input IN, inout SurfaceOutput o)
  54. {
  55. float vapor = tex2D(_VaporField, IN.uv_MainTex).x;
  56. //o.Albedo.r = clamp( vapor / _MaxVaporForBlackColor, 0.0, 1.0);
  57. o.Albedo.r = vapor / _MaxVaporForBlackColor;
  58. //o.Albedo.r = 1+ IN.uv_MainTex.x*100;
  59. o.Alpha = 1.0;
  60. //float3 n = FindNormal(IN.uv_MainTex, 1.0 / _TexSize);
  61. o.Normal = fixed3(0,0,0);
  62.  
  63. }
  64. ENDCG
  65. }
  66. FallBack "Diffuse"
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement