Forum Discussion
TeraBit
12 years agoHonored Guest
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.

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
- tlopesHonored GuestCool stuff!
- fschulzeHonored GuestI was thinking about raytracing as well. Do you have some pointers to examples? All I found so far uses fragment shaders instead of compute shaders. One could do some cool stuff with fractals and repeating geometry etc.
- TeraBitHonored GuestI'm just starting out with GPU based RT at the moment so don't have much to show just yet.
In terms of Ray tracing, I would say that the distortion is not as much of a problem as it is on the Raster side of things, since you only need to trace at normal resolution (for best quality when rasterizing you are pushing near 4x as many pixels before the distortion shader) as each ray can be aimed depending on where on the lens it will fall. In theory it should make it pin point accurate.
You also don't need to trace anything outside your view point, so any demos will likely have a view radius parameter that allows you to fine tune the size of the circle being rendered on each side. Also you can adjust the amount of Anti-Aliasing that the rays perform based on how close they are to the centre of your vision, so some savings to be made there.
Will see if anything comes of it... - drashHeroic ExplorerAll I have to say is, genius idea to model the lens inside the ray tracing logic.
Very interested to see the benefits that can be realized doing this!
Also, I assume that if there is performance to spare, the rays can bounce a couple more times a la path tracing? - TeraBitHonored Guest
All I have to say is, genius idea to model the lens inside the ray tracing logic.
Well, as far as I know, Ray Tracing is how they model real lenses before manufacture. So it's not really my idea. :)
As far as saving processing power, my tests so far have shown 185 FPS for stereo distortion vs 100 fps for normal stereo (both on 1280 x 800 on a GTX 470), so the savings can be substantial.Also, I assume that if there is performance to spare, the rays can bounce a couple more times a la path tracing?
Possibly, though Path Tracing is another level of processing intensive! 'Brigade' is very interesting in terms of path tracing and would likely be a good fit for this kind of thing. It would be interesting to see what it can do in the lower resolution of the Rift using the power saving things mentioned above. Of course all bets are off when the consumer resolution arrives. 8-) - SebbiHonored GuestHi there,
ray tracing is a cool idea. I tried your picture on my Rift and it worked. I had to zoom out a little bit before both views converged (poor man's IPD adjustment).
Can this form of ray tracing also work on AMD hardware (you mentioned CUDA)? - TeraBitHonored Guest
ray tracing is a cool idea. I tried your picture on my Rift and it worked
Thanks! Well I never expected that. 8-)Can this form of ray tracing also work on AMD hardware (you mentioned CUDA)?
CUDA is Nvidia specific and that's a pain. There will eventually be a CPU fallback mode, but that's going to be too slow on its' own (might boost speed a little if they do a CPU + GPU thing).
OpenCL would probably be a good way to do cross platform, but I don't think the drivers on each platform are up to the task yet. CUDA is pretty standard for GPU stuff (Brigade is based on CUDA I believe), the easiest way to approach it would be if ATI could write a driver that could support CUDA on their GPUs. - geekmasterProtegeVery nice to see somebody actually DOING this stuff instead of just talking about it:
http://www.mtbs3d.com/phpBB/viewtopic.php?f=140&t=17506&p=125433#p125411
Paul Bourke recommended in-game fisheye and/or mirrorball rendering back in 2004:
http://paulbourke.net/dome/mirrorrender/
with source code:
http://paulbourke.net/dome/mirrorrender/source/
I have been playing with it a bit myself (C+framebuffer and GLSL, but not CUDA), but nothing ready to publish. It seems far more efficient to avoid rendering pixels that will be discarded in pre-warp lens distortion correction...
There are some real-time GLSL ray tracers:
http://www.kamend.com/2012/02/writing-a-basic-raytracer-in-glsl/
And this:
But especially, this (and all the other AWESOME shadertoys that you can tweak and see immediate feedback):
https://www.shadertoy.com/view/4dsGRn
And of course, those shaders can add Rift pre-warp barrel distortion too, with a little tweaking (and the simpler ones even run on my Raspberry Pi):
https://www.shadertoy.com/view/lslGRN - TeraBitHonored GuestSome cool links! Thanks for that. I think this will be an area of much ongoing research for quite some time to come.
I still feel that I'm bumbling around in the dark with CUDA.
I was developing on Caustic Graphics OpenRL platform for a while and put together a reasonable engine on it, but OpenRL has thus far failed to live up to the promise of CPU+GPU RT.
Some of the stuff I rendered in real time are found on the Gallery: For example: https://developer.caustic.com/forums/showthread.php?130-Contrast-based-Tone-Mapping
So now I'm trying to port my engine over to CUDA. I was only getting 10 FPS on OpenRL with the size of image I posted earlier, but am hitting nearly 200 FPS in CUDA. It may drop dramatically with additional bounces, but it's a lot more power to play with, if I can make it work properly... :? - TeraBitHonored GuestHi All,
Still in the process of porting my 3D Ray Tracing engine to CUDA and the Rift. Making slow progress. 8-)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 11 years ago
- 12 years ago
- 6 months ago