BumpedSpecularSmooth.shader 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. Shader "Tessellation/Bumped Specular (smooth)" {
  2. Properties {
  3. _Color ("Main Color", Color) = (1,1,1,1)
  4. _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
  5. _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
  6. _MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
  7. _BumpMap ("Normalmap", 2D) = "bump" {}
  8. _EdgeLength ("Edge length", Range(3,50)) = 10
  9. _Smoothness ("Smoothness", Range(0,1)) = 0.5
  10. }
  11. SubShader {
  12. Tags { "RenderType"="Opaque" }
  13. LOD 700
  14. CGPROGRAM
  15. #pragma surface surf BlinnPhong addshadow vertex:disp tessellate:tessEdge tessphong:_Smoothness
  16. #include "Tessellation.cginc"
  17. struct appdata {
  18. float4 vertex : POSITION;
  19. float4 tangent : TANGENT;
  20. float3 normal : NORMAL;
  21. float2 texcoord : TEXCOORD0;
  22. float2 texcoord1 : TEXCOORD1;
  23. float2 texcoord2 : TEXCOORD2;
  24. };
  25. float _EdgeLength;
  26. float _Smoothness;
  27. float4 tessEdge (appdata v0, appdata v1, appdata v2)
  28. {
  29. return UnityEdgeLengthBasedTessCull (v0.vertex, v1.vertex, v2.vertex, _EdgeLength, 0.0);
  30. }
  31. void disp (inout appdata v)
  32. {
  33. // do nothing
  34. }
  35. sampler2D _MainTex;
  36. sampler2D _BumpMap;
  37. fixed4 _Color;
  38. half _Shininess;
  39. struct Input {
  40. float2 uv_MainTex;
  41. float2 uv_BumpMap;
  42. };
  43. void surf (Input IN, inout SurfaceOutput o) {
  44. fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
  45. o.Albedo = tex.rgb * _Color.rgb;
  46. o.Gloss = tex.a;
  47. o.Alpha = tex.a * _Color.a;
  48. o.Specular = _Shininess;
  49. o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
  50. }
  51. ENDCG
  52. }
  53. FallBack "Bumped Specular"
  54. }