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

    Inspiring
    May 23, 2013
    Just caught wind of this thread. Very nice work, TeraBit.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    TeraBitAuthor
    Up and Coming
    May 23, 2013
    "cybereality" wrote:
    Just caught wind of this thread. Very nice work, TeraBit.

    Thanks Cyber.

    I've tried to calibrate it according to the World Demo, moving the images 56 Pixels inward.
    Regards, Lee Page TeraBit Software
    Up and Coming
    May 23, 2013
    "TeraBit" wrote:
    "cybereality" wrote:
    Just caught wind of this thread. Very nice work, TeraBit.

    Thanks Cyber.

    I've tried to calibrate it according to the World Demo, moving the images 56 Pixels inward.
    ...

    That image shows a HUGE improvement. The radial distortion needs to be reduced a little, because in the Rift, the wall appears to be bulged toward the viewer a bit.

    Perhaps we could do this like an eye exam, where you post a pair of images and I (or other Rift owners) say which one is better, and you replace the bad one and republish (binary search). Or somebody with a Rift could apply pincushion distortion to the published image above so it looks good in the Rift, then publish it to be used as an "out of Rift" reference for adjusting the ray-trace lens model. Or perhaps you can adjust your model by inverting the Rift distortion coefficients...

    Also, I can see the outer horizontal black borders when I look in the other direction, so you could widen your ellipses a bit into true circles. They look narrower than they should be.

    But it is easy to view now, and that shows great progress!
    This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
    TeraBitAuthor
    Up and Coming
    May 23, 2013
    Ok, updated the image in the post above with a larger circle and lower distortion...
    Regards, Lee Page TeraBit Software
    Up and Coming
    May 23, 2013
    "TeraBit" wrote:
    Ok, updated the image in the post above with a larger circle and lower distortion...

    Much better. Still a little bulge in the center, so need to reduce distortion even more (for my Rift lens settings).

    And I can clearly see that clipped left edge as a black border, so you need to extend that so it is round again.

    But it is a big improvement over the previous image.
    This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
    TeraBitAuthor
    Up and Coming
    May 23, 2013
    Ok, left clipped edge sorted and lowered bulge.. 8-)
    Regards, Lee Page TeraBit Software
    Up and Coming
    May 23, 2013
    This is looking fantastic! Don't have my Rift with me atm so I can't comment on how it looks in 3D, but the images alone are compelling me to explore this room!

    I do have a general question, though. Why all this tweaking to get the image correct? Can you not use the shader provided by Oculus in the SDK as a base, and work through the distortion calculation from there? Seems like you have the information available to distort exactly like the Unreal or Unity SDK without needing to tweak bulges, overlap, etc. I haven't tried to implement Rift support manually, so I may be missing something! Are there gaps in the SDK that you have to fill in yourself when doing custom engine integration?
    TeraBitAuthor
    Up and Coming
    May 23, 2013
    Glad you like the image, it's only running basic RT at the moment. (I Don't have my Rift yet either (still processing :( , but anyone with one is welcome to give feedback on how the images look in VR).

    The way Ray Tracing and Rasterisation create images is very different. In this case, rather than warp a 2D texture (which I could do at display time), I am simulating the lenses of the rift in the Ray Projection code, so it's almost the opposite of the warping.

    The payoff is that you project less rays overall and even do cool stuff like only anti alias in the middle or reduce detail as it gets to the periphery. (I've not done any of that yet.)
    Regards, Lee Page TeraBit Software
    Up and Coming
    May 23, 2013
    That makes sense, thank you! Very cool -- I have a soft spot for ray tracing :) Will be watching this develop.
    TeraBitAuthor
    Up and Coming
    May 23, 2013
    Scratch that... The video got messed up... :(
    Regards, Lee Page TeraBit Software