Spine-Skeleton-ForwardPass-URP.hlsl 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef SKELETON_FORWARD_PASS_URP_INCLUDED
  2. #define SKELETON_FORWARD_PASS_URP_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  4. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
  5. struct appdata {
  6. float3 pos : POSITION;
  7. half4 color : COLOR;
  8. float2 uv0 : TEXCOORD0;
  9. UNITY_VERTEX_INPUT_INSTANCE_ID
  10. };
  11. struct VertexOutput {
  12. half4 color : COLOR0;
  13. float2 uv0 : TEXCOORD0;
  14. float4 pos : SV_POSITION;
  15. UNITY_VERTEX_OUTPUT_STEREO
  16. };
  17. VertexOutput vert(appdata v) {
  18. VertexOutput o;
  19. UNITY_SETUP_INSTANCE_ID(v);
  20. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  21. float3 positionWS = TransformObjectToWorld(v.pos);
  22. o.pos = TransformWorldToHClip(positionWS);
  23. o.uv0 = v.uv0;
  24. o.color = v.color;
  25. return o;
  26. }
  27. half4 frag(VertexOutput i) : SV_Target{
  28. float4 texColor = tex2D(_MainTex, i.uv0);
  29. #if defined(_STRAIGHT_ALPHA_INPUT)
  30. texColor.rgb *= texColor.a;
  31. #endif
  32. return (texColor * i.color);
  33. }
  34. #endif