Skip to main content
Up and Coming
January 30, 2014

Bicubic Warp Reconstruction

Hi All,

I've been playing around with hacking a dynamic Bicubic reconstruction filter into the Standard Rift HLSL Warp Shader.

So far it's been going quite well, with just a standard sized buffer it seems to eliminate most of the shimmery artifacts without sacrificing too much in the way of detail. I only just got it working, so it's not really tuned yet, but:

Standard Chromatic Corrected Filter


Bicubic Version


Standard Blown Up


Bicubic Blown Up


This is running on a modified OculusWorldDemo executable.

    37 replies

    TeraBitAuthor
    Up and Coming
    February 8, 2014
    Yes, the main-lope of the Lanczos-filter is one-half of that from the Triangular one, so it smoothes much less. If you increase the filter-size you can compensate for that.

    Thanks. Actually, the second thing I tried was to increase the filter size. It does bring it closer to the triangular one, but it didn't improve on it in any noticeable way.

    float CosFilter(float x) {
    return cos(x*(3.14159*0.25));
    }

    Will give that one a try. 8-)

    I fear that all the extra-steps needed for finding the high-contrast areas will cancel out the performance-gain of filtering less pixels,

    For the purposes of this exercise, I'm not really thinking of performance, although I agree it would be a consideration (the Triangular filter is many more times as efficient than a Lanczos one twice the size (as you mentioned earlier)).

    With Raytracing, doing a global AA is always going to give you better results, but performance wise it will be a slideshow! In this case, filtering where it is not needed will decrease image quality, hence why I was considering only blurring pixels on the boundary of a high contrast area. Performance should work out only a little worse than the triangular filter, but should sill be better than a massive Lanczos one. ;)
    Regards, Lee Page TeraBit Software
    Up and Coming
    February 9, 2014
    "TeraBit" wrote:
    Yes, the main-lope of the Lanczos-filter is one-half of that from the Triangular one, so it smoothes much less. If you increase the filter-size you can compensate for that.

    Thanks. Actually, the second thing I tried was to increase the filter size. It does bring it closer to the triangular one, but it didn't improve on it in any noticeable way.

    The Lanczos-filter does approximate the nyquist-theorem better than the triangular-filter (or other single-lope filters), but the difference (especially for downsampling) is rather subtle, so in the end it probably isn't worth the extra-calculations (but still an interesting experiment).

    "TeraBit" wrote:
    With Raytracing, doing a global AA is always going to give you better results, but performance wise it will be a slideshow! In this case, filtering where it is not needed will decrease image quality, hence why I was considering only blurring pixels on the boundary of a high contrast area. Performance should work out only a little worse than the triangular filter, but should sill be better than a massive Lanczos one. ;)

    In smooth areas filtering is redundant, but at the same time it will not decrease the image-quality. What makes you think that unnecessary filtering will decrease image-quality in this case?
    Watch panoramic 3D photos, videos and do FPV-flying with LiveViewRift! viewtopic.php?f=28&t=11001
    TeraBitAuthor
    Up and Coming
    February 9, 2014
    In smooth areas filtering is redundant, but at the same time it will not decrease the image-quality. What makes you think that unnecessary filtering will decrease image-quality in this case?

    It's subjective really I suppose. I noticed that when the filter was strong enough to stabilise the image (leaves on the tree, lines on the window shutters), it also made the image as a whole just feel a little softer or out of focus.

    Basically, I want to do extra filtering where it matters but leave as much of the sharpness in tact as possible. It's a fine line to walk really, and different global filtering techniques may help, but being able to target it, should be the next step.

    In the process of putting together the demo to show off the difference.
    Regards, Lee Page TeraBit Software
    Up and Coming
    February 9, 2014
    Ok, now I understand. The problem is that simpler low-pass filters (of lower order) have a rather flat fall-off in the frequency domain. This leads to a bad compromise of attenuating high spatial frequencies and a lot of aliasing at the same time.
    The perfect filter regarding following the nyquist sampling theorem is the sinc-filter, but it is of infinite size and shows some ringing artifacts. The lanczos-filter is a good approximation of the sinc filter. It really should solve the issue with the triangular-filter you describe. The variant of the lanczos-filter I showed you is that with a=2. If you want an even more steep behavior in the frequency domain, choose a=3. See Wikipedia for the formula. Also test the cosine-based filter I posted for a better performance/iq ratio.
    Watch panoramic 3D photos, videos and do FPV-flying with LiveViewRift! viewtopic.php?f=28&t=11001
    TeraBitAuthor
    Up and Coming
    February 10, 2014
    Right. The next demo is up: Download

    Same deal as before, you need to place it next to the OculusWorldDemo Assets folder.
    This time you have the shader as a text file, so you can play around with it outside the executable.

    Controls
    Ins/Del Increase / Decrease Edge Threshold
    Home/End Show Edges (blends anything above 0.1)
    PgUp / PgDn Change Filter size
    F Cycle through Filters (Cos, Triangular, Lanczos)
    C Toggle Custom Filter / Standard Reconstruction

    Edge Filter at 0.5 Opacity
    Regards, Lee Page TeraBit Software
    Up and Coming
    February 11, 2014
    The program is crashing immediately after starting it. :/
    Could you perhaps post some screenshots with various settings instead?
    Watch panoramic 3D photos, videos and do FPV-flying with LiveViewRift! viewtopic.php?f=28&t=11001
    TeraBitAuthor
    Up and Coming
    February 11, 2014
    "mrjazz" wrote:
    The program is crashing immediately after starting it. :/
    Could you perhaps post some screenshots with various settings instead?

    I've re-compiled it with Unicode String Handling and uploaded the entire package.
    Download.

    Can you give it another go? :)

    Also:
    Edge Detection


    Standard Filter


    Lanczos Filter


    Triangular Filter


    Cos Filter


    Edge Detected Filter vs Global
    Regards, Lee Page TeraBit Software