Search Unity

Showcase Fast Post-Processing for VR / Unity URP

Discussion in 'VR' started by Kleptine, Sep 19, 2022.

  1. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    282
    In case anyone is interested and trying to solve the same problems, I wanted to share a blog post I wrote about how I implemented tonemapping and color grading in The Last Clockwinder.

    The standard Unity URP post processing pipeline is written to use a secondary fullscreen pass, but instead, I made several modifications to move much of the post processing into the Forward Geometry Pass, along with the pixel shader.

    https://johnaustin.io/articles/2022/fast-post-processing-on-the-oculus-quest

    You can take a look at the final code in the PR here:
    https://github.com/AStrangerGravity/Graphics/pull/3

    The shader modifications weren't tricky, but it took some work to make the SRP Pipeline support it as an extra mode. Our fork adds an extra dropdown in the pipeline settings to enable forward pass color transformations.

    Happy to answer any questions!
     
    TigerHix, glenneroo and mgear like this.
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,041
    What else is in this repo?
    And is spacewarp supported?
     
  3. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    282
    This is our fork of the Unity/Graphics repo. We implemented a bunch of customizations for The Last Clockwinder, which you can peek at in the PR list.
    - Forward Pass Post Processing
    - Baked Specular Lighting
    - Disabled Directional Light and Point Lights
    - A custom Fade-to-Black global shader parameter that fades all shaders to black
    - Alpha to Coverage for Alpha Cutout shaders
    - Various shader optimizations that are hyper specific to TLC
    - (Prototype) Custom Post Processing per Render Layer

    Lastly, yes! There is an Application Spacewarp implementation on this unmerged branch:
    https://github.com/AStrangerGravity/Graphics/tree/asg/john/spacewarp

    We didn't ship with ASW though, because it had too many artifacts in our use case.

    Note that this URP fork is fairly specific to The Last Clockwinder, and so you would probably want to cherry pick changes out of it, rather than using this fork wholesale. It's not intended to be a general pipeline for all projects.
     
    TigerHix, DevDunk and glenneroo like this.
  4. ftribelicense

    ftribelicense

    Joined:
    Jun 8, 2022
    Posts:
    2
  5. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
  6. TrentSterling

    TrentSterling

    Joined:
    Jan 4, 2013
    Posts:
    99
    Just wanted to say I played through The Last Clockwinder recently on quest 3 and was impressed at how smooth the experience was..... and came across this thread and another thread: https://forum.unity.com/threads/urp...rocessing-for-oculus-quest-or-mobile.1043182/

    It's an interesting topic for sure! Getting the quest to run smoothly involves moving all the postfx into the forward pass. This runs fast and works well with MSAA. I only tried the BiRP version but maybe I'll check out that fork with ASW! What kind of artifacts should I look out for there?
     
  7. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    282
    Thanks for the kind words! We worked hard to get all of those clones rendering at 72fps! (It maxes out at 25 clones, but few people get there).

    Good link! A major difference with our version is that we use the standard Post Processing and volume workflows, and support shader graph. We use this in a few points in the game to adjust color grading / exposure on the fly. On the other hand, their drop-in shader would be much easier to integrate.

    The artifacts were with ASW itself. ASW can't interpolate information that doesn't exist. For example, if you quickly turn an object over in your hand it has to guess what the other side might look like. It's similar when you reveal objects from behind others or with fast moving objects. It was very playable, but enough artifacts that I didn't feel comfortable pushing it to players. And we had just enough performance to meet out targets for shipping.