Advertisement
Guest User

upgraded 2

a guest
Feb 20th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
  2.  
  3. Shader "Custom/Lightweight PBR Foliage Movement - Underwater"
  4. {
  5. Properties
  6. {
  7. _MainTex ("Base (RGB)", 2D) = "white" {}
  8. _MainColor ("Color", Color) = (1,1,1,1)
  9. _MinY("Minimum Y Value", float) = 0.0
  10.  
  11. _xScale ("X Amount", Range(-1,1)) = 0.5
  12. _yScale ("Z Amount", Range(-1,1)) = 0.5
  13.  
  14. _Scale("Effect Scale", float) = 1.0
  15. _Speed("Effect Speed", float) = 1.0
  16.  
  17. _WorldScale("World Scale", float) = 1.0
  18. }
  19.  
  20.  
  21. SubShader
  22. {
  23. Tags { "RenderType" = "Opaque" }
  24.  
  25. CGPROGRAM
  26. #pragma surface surf Standard vertex:vert fullforwardshadows addshadow
  27. #pragma target 3.0
  28. #include "UnityCG.cginc"
  29.  
  30. sampler2D _MainTex;
  31. float4 _MainColor;
  32. float _MinY;
  33. float _xScale;
  34. float _yScale;
  35. float _Scale;
  36. float _WorldScale;
  37. float _Speed;
  38. float _Amount;
  39.  
  40. struct Input
  41. {
  42. float2 uv_MainTex;
  43. };
  44.  
  45. void vert (inout appdata_full v)
  46. {
  47. float num = v.vertex.z;
  48.  
  49. if ((num-_MinY) > 0.0) {
  50. float3 worldPos = mul (unity_ObjectToWorld, v.vertex).xyz;
  51. float x = sin(worldPos.x/_WorldScale + (_Time.y*_Speed)) * (num-_MinY) * _Scale * 0.01;
  52. float y = sin(worldPos.y/_WorldScale + (_Time.y*_Speed)) * (num-_MinY) * _Scale * 0.01;
  53.  
  54. v.vertex.x += x * _xScale;
  55. v.vertex.y += y * _yScale;
  56. }
  57. }
  58.  
  59. void surf (Input IN, inout SurfaceOutputStandard o)
  60. {
  61. o.Albedo = _MainColor * tex2D(_MainTex, IN.uv_MainTex).rgb;
  62. }
  63.  
  64. ENDCG
  65.  
  66. }
  67. Fallback "Diffuse"
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement