Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct FMaterialClosestHitPayload : FMinimalPayload
- {
- // Unpacked Packed
- // offset bytes
- // float FMinimalPayload::HitT // 0 4 32bits
- FRayCone RayCone; // 4 8 64bits
- float3 Radiance; // 8 6 48bits
- float3 WorldNormal; // 24 6 48bits
- float3 BaseColor; // 36 6 48bits
- float3 DiffuseColor; // 48 0 (derived)
- float3 SpecularColor; // 60 0 (derived)
- float Opacity; // 72 2 16bits
- float Metallic; // 76 1 8bits
- float Specular; // 80 1 8bits
- float Roughness; // 84 2 16bits
- float Ior; // 88 2 16bits
- uint ShadingModelID; // 92 1 4bits
- uint BlendingMode; // 96 0 3bits (packed with ShadingModelID)
- uint PrimitiveLightingChannelMask; // 100 0 3bits (packed with ShadingModelID)
- float4 CustomData; // 104 4 32bits
- float GBufferAO; // 120 0 (removed)
- float3 IndirectIrradiance; // 124 0 48bits -- gbuffer only has float payload and there are truncation HLSL warnings
- // Quite some code assume FRayHitInfo has a WorldPos
- // So keep it here and force to re-construct it in Unpack call using ray information.
- // It is not packed in FRayHitInfoPacked
- float3 TranslatedWorldPos; // 136 0 (derived)
- uint Flags; // 148 0 6bits (packed with ShadingModelID)
- float3 WorldTangent; // 152 6 48bits
- float Anisotropy; // 164 2 16bits (packed with WorldTangent)
- // 166 total
- void SetFrontFace() { Flags |= RAY_TRACING_PAYLOAD_OUTPUT_FLAG_FRONT_FACE; }
- bool IsFrontFace() { return (Flags & RAY_TRACING_PAYLOAD_OUTPUT_FLAG_FRONT_FACE) != 0; }
- void SetTwoSided() { Flags |= RAY_TRACING_PAYLOAD_OUTPUT_FLAG_TWO_SIDED; }
- bool IsTwoSided() { return (Flags & RAY_TRACING_PAYLOAD_OUTPUT_FLAG_TWO_SIDED) != 0; }
- FRayCone GetRayCone() { return RayCone; }
- void SetRayCone(FRayCone NewRayCone) { RayCone = NewRayCone; }
- bool HasAnisotropy() { return abs(Anisotropy) >= 0.001f; }
- float3 GetRayDirection() { return IndirectIrradiance; /* Alias IndirectIrradiance/RayDirection */ }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement