Page 1 of 1

GPU style shaders in raytracing

Posted: Tue Oct 13, 2015 9:37 am
by mrluzeiro
Hello all,
I was wondering if there are any experiences or discussions on using 'GPU style shaders' in raytracing.
I was thinking to try to use SSAO (screen space ambient occlusion) in my CPU raytracing.

Also, couldn't that technics be used in GPU raytracers as well?

Re: GPU style shaders in raytracing

Posted: Tue Oct 13, 2015 10:28 am
by szellmann
SSAO is computed in a fragment shader. You will have to pass a depth buffer texture to the shader. A depth buffer is fairly simple to generate as a ray tracing result, you basically just store first hit positions in world/object space and later transform them to OpenGL window coordinates.

I wouldn't consider such a rendering pass part of the ray tracing pipeline, but rather a post processing step, similar to the compositing step you perform when you render geometry e.g. from both ray tracing and OpenGL in a single frame.

If you treat it as such - a post processing step that is independent from ray tracing and implemented with shaders - yes, this is applicable to a GPU ray tracer. Say you do direct rendering, you will unmap/unbind the rendering PBO in your compute context, and pass it over to the OpenGL/DirectX realm for further processing.

Shaders in general are entry points to a fixed function pipeline. The ray tracing pipeline differs from the rasterization pipeline, thus I would expect other types of "shaders", e.g. ones that determine how a ray is treated that just left the scene (a "miss" program/shader). Have a look at Nvidia Optix for such an approach.