Stating perhaps the obvious: It looks to me like the ray origins and directions are not being calculated correctly.
Here are code snippets from my voxel ray march compute shader that calculate ray origins and directions (format is a little "wonky" pasted here in a code block) :
vec3 invViewProjOrigin(mat4 matrix) { vec4 origin = matrix * vec4(0, 0, -1, 0); return origin.xyz / origin.w; } vec2 ndcFragCoord(ivec2 resolution, ivec2 fragCoord) { return vec2((((fragCoord.x + 0.5) / resolution.x) * 2) - 1, 1 - (((fragCoord.y + 0.5) / resolution.y) * 2)); } vec3 fragCoordRayDirection(ivec2 fragCoord, ivec2 resolution, float near, float far, mat4 invViewProjMatrix) { return normalize((invViewProjMatrix * vec4(ndcFragCoord(resolution, fragCoord), 1 + (near / far), 1)).xyz); } void main() { uint index = gl_GlobalInvocationID.x; if (index >= (resolution.x * resolution.y)) return; ivec2 fragCoord = ivec2(index % resolution.x, index / resolution.x); vec3 origin = invViewProjOrigin(invViewProjMatrix), direction = fragCoordRayDirection(fragCoord, resolution, settings.near, settings.far, invViewProjMatrix); ... }
P.S. I have my Vulkan pipeline's coordinates system y-flipped so positive y is up in world space. Hence the "1 - (((fragCoord.y + 0.5) / resolution.y) * 2)" in ndcFragCoord().