Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
JMF's avatar
JMF
Honored Guest
11 years ago

Barrel distortion NEW SOLUTION MADE!!!

I would like to point out main disadvantages of current barrel distortion solution know as "pixel mapping":

• Black borders around image (21% of screen is not in use)
• higher resolution (than screen) buffer slows down FPS
• current distortion is post-effect

Now that you know this mystery I can describe to you the solution that I invented.
Basically lets see how 3D objects are projected on flat "screen"

This is oversimplificated presentation

To create distorted image, projection on curved surface can be done, but you must know that computer sees single
polygons as projected objects...
and wall divided by 3 polys looks like this:


but... we can cheat it!

What is the difference between flat projection and curved projection?
The distance between focal point and the pixel! :D

simple presentation –>

Moving focal point for every pixel creates curved image.
How to achieve it?


Assume that you have 1920x1080 screen and 110 fov:
Xres = 1920
Yres = 1080
FOV_H = 110


Distance between pixel and focal point for left/right middle edge pixel is:

DistancePixToFocal = 960/ sin( FOV_H / 2 )
Focal4ThisPix = sqrt( DistancePixToFocal**2 - DistanceFromCenter**2 )


Focal points values can be calc to file and then readed when needed ;)

Aspherical distortion for Oculus Rift

Graph shows different projections for pixel distance.
Changing DistancePixToFocal to the value from graph creates flowing effects:
This graphs represent relationship between distance from pixel to center of the screen and pixel to focal point distance



If you like it please leave the comment...
I'm already making code for this

EDIT
I changed links to images ;)

15 Replies

  • "Fredz" wrote:
    "mrmonkeybat" wrote:
    As well as the distortion there is also the chromatic aberration which is harder to correct for with something other than a post processing effect, unless we used something like sub pixel rendering.

    If you ray-trace for distortion you can do it for the three different wavelengths as well to account for chromatic aberration. There is no need for a post processing effect.

    The difficulty in the ray-tracing approach is to come with the correct parameters for the aspheric surface lens profile and to implement intersection and normal calculations for aspheres which is not trivial (iterative solution, but can be pre-processed).

    If you sending out a ray for each color channel you might as well send them from the sub pixel coordinates on a pentile screen this also cuts down the number of rays used by one third.

    "JMF" wrote:
    snip
    Yes, you have right. Best way for chromatic aberration is the post effect -pixel mapping. But it can by done better 8-)



    Currently RGBY channel shift is used, but real chromatic aberration (produced by OR-VR lens) has smooth transition between colors. By using Pixel-color-hue to shift-multiplier graph the program can read value of how much he must move each pixel to get perfect correction.



    Video displays and monitors produce the illusion of many hues but in reality they are always emiting the same three discrete RGB wavelengths, (fortunately our eyes detect hues by how much they affect three diferent cone cell types in our eyes so this works), if you create a distortion that treats the pixel as a single hue you find the that the lens separates that hue into 3 RGB images. Hue based chromatic correction wont work, sub pixel based chromatic correction can work, its also cheaper.

    "JMF" wrote:
    "geekmaster" wrote:
    This "new" method you invented has been a standard (commonly used for domed screens) for many years:
    https://developer.oculusvr.com/forums/viewtopic.php?f=33&t=965&p=11107#p11107

    Sharing your implementation is of great service to the VR community. Thanks!


    You are missing the hole thing. This "moving Focal point" method is not a ray-tracing thing, its more like dividing the screen in tiny rings and using different camera settings for each. I think this link could misled you:
    , here is updated version


    I'm already making it work in Maxon Cinema 4D as Python plugin.

    snip


    So in practice how does this differ from the tessellating and displacing the triangles like Carmack tried earlier. Unless your method can draw polygons with curvered sides to match the distortion presumably you still have to tessellate them to to avoid this kind of artifact:
    "JMF" wrote:
    snip
    and wall divided by 3 polys looks like this:
    snip
  • JMF's avatar
    JMF
    Honored Guest
    I would like to update this topic with some useful informations, because now it's basically pointless to read it...
    So... I searched the forum for this and I didn't found any info about that. I want to show you screendoor-effect fix. didn't test it on my own eyes, but it makes sense. http://youtu.be/t0xaMIyUGfk
  • Anti aliasing techniques take multiple samples from diferent parts of a pixel to blur edges. I wonder if this could be hacked to take samples from different precise parts of the screen for the different sub pixels, combined with a tiled renderer just ahead of the scan out for near zero latency.

    Or with the tessellation shader using three different tessellation distortions for the different colors would be expensive but the Red and blue can be done at a lower resolution. An as the screen is all divided into small triangles perhaps the order that they are rasterized can be done just ahead of the scan out again for low latency.

    Sub pixel ray tracing just ahead of the scan out could be good too. Could even update the position the rays are sent from with each line and could work with interlaced scanning.
  • They said they made completely new optics for the Crescent Bay version. This barrel distortion solution might be completely irrelevant and pointless to continue now.
  • "AntDX316" wrote:
    They said they made completely new optics for the Crescent Bay version. This barrel distortion solution might be completely irrelevant and pointless to continue now.


    Photos from the Cbay booths showed barrel distorted images on the monitors.