OculusMotionVectors.hlsl 705 B

12345678910111213141516171819202122232425
  1. #ifndef SG_MOTION_VECTORS_INCLUDED
  2. #define SG_MOTION_VECTORS_INCLUDED
  3. PackedVaryings vert(Attributes input)
  4. {
  5. Varyings output = (Varyings)0;
  6. output = BuildVaryings(input);
  7. PackedVaryings packedOutput = (PackedVaryings)0;
  8. packedOutput = PackVaryings(output);
  9. return packedOutput;
  10. }
  11. half4 frag(PackedVaryings packedInput) : SV_TARGET
  12. {
  13. Varyings unpacked = UnpackVaryings(packedInput);
  14. UNITY_SETUP_INSTANCE_ID(unpacked);
  15. float3 screenPos = unpacked.curPositionCS.xyz / unpacked.curPositionCS.w;
  16. float3 screenPosPrev = unpacked.prevPositionCS.xyz / unpacked.prevPositionCS.w;
  17. half4 color = (1);
  18. color.xyz = screenPos - screenPosPrev;
  19. return color;
  20. }
  21. #endif