Advertisement
Guest User

Unity3d skybox rotation shader

a guest
Mar 12th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Shader "RenderFX/Skybox-CustomRotation"
  2. {
  3. Properties
  4. {
  5. _Tint ("Tint Color", Color) = (.5, .5, .5, .5)
  6. _Tex ("Cubemap", Cube) = "white" {}
  7. }
  8.  
  9. SubShader
  10. {
  11. Tags { "Queue"="Background" "RenderType"="Background" }
  12. Cull Off ZWrite Off Fog { Mode Off }
  13.  
  14. Pass
  15. {
  16.  
  17. CGPROGRAM
  18. #pragma vertex vert
  19. #pragma fragment frag
  20. #pragma fragmentoption ARB_precision_hint_fastest
  21.  
  22. #include "UnityCG.cginc"
  23.  
  24. samplerCUBE _Tex;
  25. fixed4 _Tint;
  26. float4x4 _Rotation;
  27.  
  28. struct appdata_t
  29. {
  30. float4 vertex : POSITION;
  31. float3 texcoord : TEXCOORD0;
  32. };
  33.  
  34. struct v2f
  35. {
  36. float4 vertex : POSITION;
  37. float3 texcoord : TEXCOORD0;
  38. };
  39.  
  40. v2f vert(appdata_t v)
  41. {
  42. v2f o;
  43. o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
  44. o.texcoord = mul((float3x3)_Rotation, v.texcoord);
  45. return o;
  46. }
  47.  
  48. fixed4 frag (v2f i) : COLOR
  49. {
  50. fixed4 tex = texCUBE (_Tex, i.texcoord);
  51. fixed4 col;
  52. col.rgb = tex.rgb + _Tint.rgb - unity_ColorSpaceGrey;
  53. col.a = tex.a * _Tint.a;
  54. return col;
  55. }
  56. ENDCG
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement