Skip to main content
Up and Coming
March 21, 2013

Deferred rendering and AA in Unity

Hello!

Has any of you been using deferred rendering in Unity with the Rift? I'm having troubles getting image-based anti-aliasing to work properly, it looks almost as bad as having no AA at all.
Either the lens distortion shader isn't working properly with the AA shader or the flaws in image-based AA are just much more visible through the Rift?
    This topic has been closed for replies.

    8 replies

    SiggiGAuthor
    Up and Coming
    March 22, 2013
    Going through the new docs and these two bits explain what I'm seeing :) Thanks!

    since we are not going to be rendering with Deferred Lighting
    mode (only with Forward-Lighting).


    Unity does not currently support setting anti-aliasing on render targets. This impacts the overall
    resolution of the rendering since the lens correction pass 'stretches' the image, causing artifacts
    that can be corrected by rendering into a larger buff er fi rst and then down-sampling to the final
    buff er.
    CCP Games, EVE: Valkyrie developer | @SiggiGG
    Inspiring
    March 22, 2013
    @SiggiG: Yeah, sorry for the delay. Been really busy the past few days. From what I understand we aren't using deferred rendering in the demos specifically because of problems like this. There may be solution, I'm not sure. I will look deeper into the issue when I have a chance. Thanks.
    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
    Up and Coming
    March 29, 2013
    Probably the best solution here is to integrate image-based antialiasing into the distortion shader itself, so that you are re-sampling and filtering at the same time without data loss. FXAA is probably not ideal for the non-uniform sampling due to distortion but there should be some other good image reconstruction filter floating around that works. Maybe just use anisotropic filtering with manually computed gradients? Experimentation needed.
    Up and Coming
    March 30, 2013
    After trying the SDK in my project, there seem to be two things breaking deferred rendering with the Oculus SDK:

    -The post process that performs the optical correction uses a custom blit operation that calls opengl instead of the standard Graphics.Blit method. This turns the screen black and white for some reason. I don't have a rift yet so I can't be totally sure if there is some other reason it was done this way, but it should not be necessary.

    -The camera class computes a custom projection matrix which breaks unity's screen space to world transform, making point lights and shadows appear in the wrong place. As far as I can see this is only done to apply the IPD offset, but that should be just as easily done by simply moving the camera transform.

    I have tried my own fixes to these issues and I will see how they work once my dev kit arrives. In any case it should be easy for Oculus to fix.
    Up and Coming
    March 30, 2013
    If you want something that will give you a huge image quality in Deferred mode, try applying the camera-motion blur image effect (DX11 reconstruction is the best), and turning the max velocity of it down. Because the oculus headset is _always_ moving ever so slightly, the resultant effect is almost akin to temporal anti-aliasing.

    In my tests thus far in our project, it doesn't seem to introduce any problems in terms of motion-sickness, as the effect is still fairly light. Only downside is that its a touch expensive. Considering one is only doing a 1280x800 frame though, not too bad.
    Up and Coming
    March 30, 2013
    I added this to another thread here but it is relevant :)

    To enable deferred lighting I turned it on for CameraLeft and CameraRight then edited the OvrCamera (script) file to add at line 221:

    if(camera.actualRenderingPath == RenderingPath.DeferredLighting) {
    flipImage = false;
    }

    The shadows flicker and shimmer with every head movement and are moving with my motion instead of being fixed with the geometry itself, but at least it isn't flipped.
    Ibex 3D VR Desktop for the Oculus Rift: http://hwahba.com/ibex - https://bitbucket.org/druidsbane/ibex
    Inspiring
    April 3, 2013
    You should be able to use image based AA with deferred rendering after applying this fix:

    viewtopic.php?f=37&t=102#p1397

    However, there are still more issues with deferred lighting (shadows, etc.) that we are still looking into.
    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
    Participant
    May 23, 2015
    Has anyone managed to come up with a newer solution for this using the latest oculus build?

    Using forward rendering and both unity and oculus manager set to AA x8 then adding a standard FXAA to each eye I get a decent effect.

    However forward rendering just really doesn't work well for my game.
    Most of the information on this site or on the net that I could find is old.

    I have an SMAA script for unity that is supposed to work with deferred but I keep getting a black screen when adding to the cameras, I know this stuff has been spoken about in various places but I haven't seen any up to date information it.

    So does anyone have a decent up to date solution for using deferred rendering, Anti-aliasing and the Oculus?
    it can obviously be done as seen here http://blogs.unity3d.com/2015/02/16/pollen-vr-developing-high-end-visuals-with-unity-5/