SurfaceData.bslinc 644 B

123456789101112131415161718192021222324252627282930
  1. mixin SurfaceData
  2. {
  3. code
  4. {
  5. struct SurfaceData
  6. {
  7. float4 albedo;
  8. float4 worldNormal;
  9. float depth;
  10. float roughness;
  11. float metalness;
  12. float2 velocity;
  13. uint mask;
  14. };
  15. // Encodes velocity into a format suitable for storing in a 16-bit SNORM texture.
  16. // Velocity range of [-2, 2] is supported (full NDC).
  17. float2 encodeVelocity16SNORM(float2 velocity)
  18. {
  19. return velocity * 0.5f;
  20. }
  21. // Decodes velocity from an encoded 16-bit SNORM format. See encodeVelocity16SNORM().
  22. // Velocity range of [-2, 2] is supported (full NDC).
  23. float2 decodeVelocity16SNORM(float2 val)
  24. {
  25. return val * 2.0f;
  26. }
  27. };
  28. };