Advertisement
keawstudio

Woobling Jelly Unity Shader

Apr 30th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. //Created from Standard Surface Shader
  2.  
  3.  
  4. Shader "Shaders Test/Woobling Jelly" {
  5. Properties {
  6. _Color ("Color", Color) = (1,1,1,1)
  7. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  8. _Glossiness ("Smoothness", Range(0,1)) = 0.5
  9. _Metallic ("Metallic", Range(0,1)) = 0.0
  10. _Warp ("Warp Strenght", Range(25,100)) = 50 //How much woobly is the material?
  11.  
  12. }
  13.  
  14. SubShader {
  15. Tags {
  16. "Queue" = "Transparent"
  17. "IgnoreProjector" = "True"
  18. "RenderType" = "Transparent"
  19. }
  20. LOD 200
  21.  
  22. CGPROGRAM
  23. // Physically based Standard lighting model, and enable shadows on all light types
  24. #pragma surface surf Standard fullforwardshadows vertex:vert alpha
  25.  
  26. // Use shader model 3.0 target, to get nicer looking lighting
  27. #pragma target 3.0
  28.  
  29. sampler2D _MainTex;
  30. float _Warp;
  31.  
  32. struct Input {
  33. float2 uv_MainTex;
  34. float3 vertColor;
  35. float4 pos : SV_POSITION;
  36. float2 uv : TEXCOORD0;
  37. };
  38.  
  39. Input vert (inout appdata_full v)
  40. {
  41. Input o;
  42.  
  43. v.vertex.x += sign(v.vertex.x) * sin(_Time.w)/_Warp;
  44. v.vertex.y += sign(v.vertex.y) * cos(_Time.w)/_Warp;
  45.  
  46. o.vertColor = float3(v.vertex.x, v.vertex.y, v.vertex.z);
  47. o.pos = UnityObjectToClipPos(v.vertex);
  48. o.uv = v.texcoord;
  49.  
  50. return o;
  51. }
  52.  
  53. half _Glossiness;
  54. half _Metallic;
  55. fixed4 _Color;
  56.  
  57. // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  58. // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  59. // #pragma instancing_options assumeuniformscaling
  60. UNITY_INSTANCING_CBUFFER_START(Props)
  61. // put more per-instance properties here
  62. UNITY_INSTANCING_CBUFFER_END
  63.  
  64. void surf (Input IN, inout SurfaceOutputStandard o) {
  65. // Albedo comes from a texture tinted by color
  66. fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  67. o.Albedo = c.rgb;
  68. // Metallic and smoothness come from slider variables
  69. o.Metallic = _Metallic;
  70. o.Smoothness = _Glossiness;
  71. //o.Alpha = c.a;
  72. o.Alpha = _Color.a;
  73. }
  74. ENDCG
  75. }
  76. FallBack "Diffuse"
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement