Advertisement
Guest User

Untitled

a guest
Feb 10th, 2025
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. struct FMaterialClosestHitPayload : FMinimalPayload
  2. {
  3. // Unpacked Packed
  4. // offset bytes
  5. // float FMinimalPayload::HitT // 0 4 32bits
  6. FRayCone RayCone; // 4 8 64bits
  7. float3 Radiance; // 8 6 48bits
  8. float3 WorldNormal; // 24 6 48bits
  9. float3 BaseColor; // 36 6 48bits
  10. float3 DiffuseColor; // 48 0 (derived)
  11. float3 SpecularColor; // 60 0 (derived)
  12. float Opacity; // 72 2 16bits
  13. float Metallic; // 76 1 8bits
  14. float Specular; // 80 1 8bits
  15. float Roughness; // 84 2 16bits
  16. float Ior; // 88 2 16bits
  17. uint ShadingModelID; // 92 1 4bits
  18. uint BlendingMode; // 96 0 3bits (packed with ShadingModelID)
  19. uint PrimitiveLightingChannelMask; // 100 0 3bits (packed with ShadingModelID)
  20. float4 CustomData; // 104 4 32bits
  21. float GBufferAO; // 120 0 (removed)
  22. float3 IndirectIrradiance; // 124 0 48bits -- gbuffer only has float payload and there are truncation HLSL warnings
  23.  
  24. // Quite some code assume FRayHitInfo has a WorldPos
  25. // So keep it here and force to re-construct it in Unpack call using ray information.
  26. // It is not packed in FRayHitInfoPacked
  27. float3 TranslatedWorldPos; // 136 0 (derived)
  28. uint Flags; // 148 0 6bits (packed with ShadingModelID)
  29. float3 WorldTangent; // 152 6 48bits
  30. float Anisotropy; // 164 2 16bits (packed with WorldTangent)
  31. // 166 total
  32.  
  33. void SetFrontFace() { Flags |= RAY_TRACING_PAYLOAD_OUTPUT_FLAG_FRONT_FACE; }
  34. bool IsFrontFace() { return (Flags & RAY_TRACING_PAYLOAD_OUTPUT_FLAG_FRONT_FACE) != 0; }
  35.  
  36. void SetTwoSided() { Flags |= RAY_TRACING_PAYLOAD_OUTPUT_FLAG_TWO_SIDED; }
  37. bool IsTwoSided() { return (Flags & RAY_TRACING_PAYLOAD_OUTPUT_FLAG_TWO_SIDED) != 0; }
  38.  
  39. FRayCone GetRayCone() { return RayCone; }
  40. void SetRayCone(FRayCone NewRayCone) { RayCone = NewRayCone; }
  41.  
  42. bool HasAnisotropy() { return abs(Anisotropy) >= 0.001f; }
  43.  
  44. float3 GetRayDirection() { return IndirectIrradiance; /* Alias IndirectIrradiance/RayDirection */ }
  45. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement