Skip to main content
Up and Coming
May 10, 2013

Rift Ray-tracing

[EDIT] This now has a demo, but I'll keep the link here up to date.

Download demo
(Updated to 12 Meg. Ver 0.50 on the Twentieth of June in the Year Twenty-Thirteen)).

Hi All,

I haven't got my Rift yet (UK near the end of the Kickstarter), but have been following the goings on with interest.

I've started to have a go at doing some CUDA based ray-tracing for VR and have managed to get some basic stuff going.

Rather than warping a resulting image I've made a start at modeling the lenses in the ray projection code.
(no texturing or shadows yet, just trying to get the distortion and stereo going.)

This is what I've got so far. It's probably waaaay out, but until I get my one, I'm flying blind. :D

Note: It's a bit wide to see in the post, you may need to open the image in another tab to see the entire screen.

    152 replies

    Participant
    May 18, 2014
    (Youngling when it comes to rendering etc, so please don't shoot me if I say something heretic)
    First of all: Badass stuff! This thread inspired me to make a simple raytracer as a practice project on our programming course.

    Has anybody tried using OpenCL instead of CUDA? To my understanding, opencl with AMD gpu beats NVidia gpus 6-1 in most of the scenarios, altho opencl seems to be harder to maintain and it can be buggy. Or is there something in CUDA that allows one to draw image fast directly from gpu memory without messing around with buffers cpu wise?
    Also, regarding that, how people usually draw pixels from CUDA/OpenCL so fast it doesn't bottleneck fps? Is it with shaders with some tricking around?
    One more thing: Now that I know the very basics of raytracing (made raytracer with secondary rays), where should I move next? Most of the paperas online are pretty old and things have changed during time, so that's why I am asking. I guess I could choose between photorealistic path (path tracing, GI etc) and real-time tracing path (lighter algorithms etc).
    TeraBitAuthor
    Up and Coming
    May 18, 2014
    "Miffyli" wrote:

    Has anybody tried using OpenCL instead of CUDA? To my understanding, opencl with AMD gpu beats NVidia gpus 6-1 in most of the scenarios, altho opencl seems to be harder to maintain and it can be buggy. Or is there something in CUDA that allows one to draw image fast directly from gpu memory without messing around with buffers cpu wise?


    One big advantage with CUDA is the Optix framework. It really does make it easy to get something good going. Also it has some very good Acceleration Structures built in, SBVH (Split Bounding Volume Hierarchy) seems particularly state of the art.

    I have two big beefs with Optix / CUDA:

    1) They are not cross GPU (i.e. they will not work with competing GPUs).
    2) They need an external compiler, so you have to pre-compile your shaders.

    OpenCL fixes these problems, but there is no Optix equivalent I am aware of for OpenCL, plus as you say, implementations of OpenCL are buggy. To be honest, if all the GPU manufacturers had thrown their weight behind OpenCL, or an Open Source CUDA that worked on all GPUs, then life would be simpler in the GPU programming arena.

    I had a go with OpenRL a while back (Caustic Graphics, now part of Imagination Tech.) and their implementation is even better than Optix, the only problem, it's not GPU accelerated (yet).

    The same scene I am getting 40 FPS with on Optix I get 0.4 FPS with on OpenRL (this is GPU vs CPU). I waited about two years from starting OpenRL before I moved to CUDA/Optix. Only recently have they announced that they are releasing consumer chip designs to allow OpenRL to fly. So another two years to go at least... :(

    GPUs could make themselves more RT friendly very easily, the hardware is good, but someone needs to nail down a standard. OpenRL was a good shot, but badly needs a good cross GPU implementation maintained by the respective GPU manufacturers.

    Where would rasterisation be if there was no OpenGL / DirectX? Where Ray Tracing is now.

    is there something in CUDA that allows one to draw image fast directly from gpu memory without messing around with buffers cpu wise?


    Yes, it has OpenGL / DirectX Texture Interop, which allows you to render your output buffer as a texture, so avoiding uploading it each frame.
    Regards, Lee Page TeraBit Software