Imposter_AlphaBlended.shader 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /************************************************************************************
  2. Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  3. Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
  4. https://developer.oculus.com/licenses/oculussdk/
  5. Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
  6. under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  7. ANY KIND, either express or implied. See the License for the specific language governing
  8. permissions and limitations under the License.
  9. ************************************************************************************/
  10. Shader "Hidden/Imposter_AlphaBlended"
  11. {
  12. Properties
  13. {
  14. _MainTex ("Texture", 2D) = "white" { }
  15. }
  16. SubShader
  17. {
  18. Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
  19. LOD 100
  20. Blend One OneMinusSrcAlpha
  21. ZWrite Off
  22. Pass
  23. {
  24. CGPROGRAM
  25. #pragma vertex vert
  26. #pragma fragment frag
  27. #include "UnityCG.cginc"
  28. struct appdata
  29. {
  30. float4 vertex: POSITION;
  31. float2 uv: TEXCOORD0;
  32. UNITY_VERTEX_INPUT_INSTANCE_ID
  33. };
  34. struct v2f
  35. {
  36. float2 uv: TEXCOORD0;
  37. float4 vertex: SV_POSITION;
  38. UNITY_VERTEX_OUTPUT_STEREO
  39. };
  40. sampler2D _MainTex;
  41. float4 _MainTex_ST;
  42. v2f vert(appdata v)
  43. {
  44. v2f o;
  45. UNITY_SETUP_INSTANCE_ID(v);
  46. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  47. o.vertex = UnityObjectToClipPos(v.vertex);
  48. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  49. return o;
  50. }
  51. fixed4 frag(v2f i): SV_Target
  52. {
  53. return tex2D(_MainTex, i.uv); // simply sample the texture
  54. }
  55. ENDCG
  56. }
  57. }
  58. }