Rt works now, no idea why
This commit is contained in:
@@ -4,28 +4,22 @@ import RayTracingData;
|
||||
[shader("raygeneration")]
|
||||
void raygen()
|
||||
{
|
||||
const float2 pixelCenter = float2(DispatchRaysIndex().xy) + float2(0.5);
|
||||
const float2 inUV = pixelCenter / float2(DispatchRaysDimensions().xy);
|
||||
float2 d = inUV * 2.0 - 1.0;
|
||||
uint3 LaunchID = DispatchRaysIndex();
|
||||
uint3 LaunchSize = DispatchRaysDimensions();
|
||||
|
||||
float4 origin = mul(pViewParams.inverseViewMatrix, float4(0, 0, 0, 1));
|
||||
const float2 pixelCenter = float2(LaunchID.xy) + float2(0.5, 0.5);
|
||||
const float2 inUV = pixelCenter / float2(LaunchSize.xy);
|
||||
float2 d = float2(inUV.x, 1 - inUV.y) * 2.0 - 1.0;
|
||||
float4 target = mul(pViewParams.inverseProjection, float4(d.x, d.y, 1, 1));
|
||||
float4 direction = mul(pViewParams.inverseViewMatrix, float4(target.xyz, 0));
|
||||
|
||||
float tmin = 0.0001;
|
||||
float tmax = 10000.0;
|
||||
|
||||
uint max_rays = 24;
|
||||
RayDesc rayDesc;
|
||||
rayDesc.Origin = mul(pViewParams.inverseViewMatrix, float4(0, 0, 0, 1)).xyz;
|
||||
rayDesc.Direction = mul(pViewParams.inverseViewMatrix, float4(normalize(target.xyz), 0)).xyz;
|
||||
rayDesc.TMin = 0.001;
|
||||
rayDesc.TMax = 10000.0;
|
||||
|
||||
RayPayload payload;
|
||||
TraceRay(pRayTracingParams.scene, RAY_FLAG_FORCE_OPAQUE, 0xff, 0, 0, 0, rayDesc, payload);
|
||||
|
||||
RayDesc desc;
|
||||
desc.Origin = origin.xyz;
|
||||
desc.Direction = direction.xyz;
|
||||
desc.TMin = tmin;
|
||||
desc.TMax = tmax;
|
||||
|
||||
TraceRay(pRayTracingParams.scene, 0, 0xff, 0, 0, 0, desc, payload);
|
||||
|
||||
pRayTracingParams.image[DispatchRaysIndex().xy] = float4(payload.color, 1.0f);
|
||||
pRayTracingParams.image[int2(LaunchID.xy)] = float4(payload.color, 0.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user