2024-07-12 13:33:52 +02:00
|
|
|
import MaterialParameter;
|
|
|
|
|
|
2024-07-08 13:46:49 +02:00
|
|
|
struct RayTracingParams
|
|
|
|
|
{
|
|
|
|
|
RaytracingAccelerationStructure scene;
|
2024-12-25 14:59:08 +01:00
|
|
|
RWTexture2D<float4> radianceAccumulator;
|
2024-07-10 21:07:10 +02:00
|
|
|
RWTexture2D<float4> image;
|
2024-07-08 13:46:49 +02:00
|
|
|
StructuredBuffer<uint> indexBuffer;
|
2024-12-25 14:59:08 +01:00
|
|
|
TextureCube<float4> skyBox;
|
|
|
|
|
SamplerState skyBoxSampler;
|
2024-07-08 13:46:49 +02:00
|
|
|
};
|
2024-07-12 13:33:52 +02:00
|
|
|
layout(set=5)
|
2024-07-08 13:46:49 +02:00
|
|
|
ParameterBlock<RayTracingParams> pRayTracingParams;
|
2024-07-12 13:33:52 +02:00
|
|
|
|
|
|
|
|
struct RayPayload
|
|
|
|
|
{
|
2025-01-30 23:25:41 +01:00
|
|
|
LightingParameter params;
|
|
|
|
|
MaterialParameter materialParams;
|
2024-12-31 10:40:03 +01:00
|
|
|
float3 light;
|
2025-01-30 23:36:48 +01:00
|
|
|
float t;
|
2024-12-31 10:40:03 +01:00
|
|
|
float emissive;
|
|
|
|
|
uint depth;
|
|
|
|
|
bool hit;
|
|
|
|
|
bool anyHit;
|
2025-01-29 16:15:48 +01:00
|
|
|
uint3 rndSeed;
|
2024-12-31 10:40:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
float3 rand01(uint3 x){ // pseudo-random number generator
|
|
|
|
|
for (int i=3; i-->0;) x = ((x>>8U)^x.yzx)*1103515245U;
|
|
|
|
|
return float3(x)*(1.0/float(0xffffffffU));
|
|
|
|
|
}
|