Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.4 KiB

  1. /************************************************************************************
  2. Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  3. See SampleFramework license.txt for license terms. Unless required by applicable law
  4. or agreed to in writing, the sample code is provided “AS IS” WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied. See the license for specific
  6. language governing permissions and limitations under the license.
  7. ************************************************************************************/
  8. Shader "Oculus Sample/Train Smoke"
  9. {
  10. Properties
  11. {
  12. _MainTex ("Texture", 2D) = "white" {}
  13. _TintColor ("Tint Color", Color) = (0.5, 0.5, 0.5, 0.5)
  14. }
  15. SubShader
  16. {
  17. Tags{"Queue" = "Transparent" "RenderType" = "Transparent"
  18. "IgnoreProjector" = "True" "PreviewType" = "Plane"}
  19. LOD 100
  20. Blend SrcAlpha OneMinusSrcAlpha
  21. Cull Off
  22. Lighting Off
  23. ZWrite Off
  24. Pass
  25. {
  26. CGPROGRAM
  27. #pragma vertex vert
  28. #pragma fragment frag
  29. // In the future, we can play with particle instancing, see:
  30. // see https://docs.unity3d.com/Manual/PartSysInstancing.html
  31. // for now we cannot, because our minimum supported Unity version doesn't support it
  32. #include "UnityCG.cginc"
  33. struct vertIn
  34. {
  35. float2 uv : TEXCOORD0;
  36. float4 vertex : POSITION;
  37. fixed4 color : COLOR;
  38. UNITY_VERTEX_INPUT_INSTANCE_ID
  39. };
  40. struct vertOut
  41. {
  42. float2 uv : TEXCOORD0;
  43. float4 clipPos : SV_POSITION;
  44. fixed4 color : COLOR;
  45. UNITY_VERTEX_OUTPUT_STEREO
  46. };
  47. sampler2D _MainTex;
  48. float4 _MainTex_ST;
  49. fixed4 _TintColor;
  50. vertOut vert (vertIn vIn)
  51. {
  52. vertOut vOut;
  53. UNITY_SETUP_INSTANCE_ID(vIn);
  54. UNITY_INITIALIZE_OUTPUT(vertOut, vOut);
  55. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vOut);
  56. vOut.clipPos = UnityObjectToClipPos(vIn.vertex);
  57. vOut.uv = TRANSFORM_TEX(vIn.uv, _MainTex);
  58. vOut.color = vIn.color * _TintColor;
  59. return vOut;
  60. }
  61. fixed4 frag (vertOut vOut) : SV_Target
  62. {
  63. fixed4 fragColor = 2.0f * vOut.color * tex2D(_MainTex, vOut.uv);
  64. // don't amplify opacity
  65. fragColor.a = saturate(fragColor.a);
  66. return fragColor;
  67. }
  68. ENDCG
  69. }
  70. }
  71. }