Search Unity

Official New Post-processing Stack (Pre-Release)

Discussion in 'Image Effects' started by Chman, Oct 10, 2016.

  1. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Any plans to re-introduce the missing reinhard tonemapping? I think for outdoors it's results were better than ACES or the neutral curve one.
     
  2. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey guys... now that 5.5 is out, I have a question to regards to scripting this via runtime. I am using the UFE asset and since the levels are just prefabs, I am looking for a way to script the prefabs so that the camera (Which is also a prefab called "LoadCamera" and that is used for all of the levels) can use the PostProcessingProfile I have.

    Example, when my level "The Sanctuary" loads, the script will find the load camera, and assign the Profile to the camera I want.
     
  3. Fodalichking

    Fodalichking

    Joined:
    Mar 18, 2015
    Posts:
    14
    Hey,

    do you guys have actual numbers on how better the performance is?

    Cheers,
     
  4. tanoshimi

    tanoshimi

    Joined:
    May 21, 2013
    Posts:
    297
    I don't think any generic "numbers" can possibly be used as a comparison: it's an effect stack - so the performance benefit increases the greater the number of separate effects you replace. It's not particularly that the DoF effect in the stack is better performing than the standalone DoF component (though it may, or may not be).
     
  5. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I can say for sure than the SSR inside the stack is performing incredibly well (maybe 2x-3x better? correct me if I'm wrong, but personally I thought we'd never have that effect with the old cinematic effects). The only thing lacking that I had to fix (took me a few mins) was the lack of Reinhard tonemapping that was scaling incredibly well with my outdoor island environment.

    But I would strongly recommend the stack.
     
  6. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    Running even a fairly lean PP stack for prototyping purposes (to try and better profile asset speed) it seemed to shave just about 0.5ms per frame off, @ 720p and on a GTX1070. Bear in mind both the previous and new setup aren't optimized other than turning things on.

    It looks like the general performance is pretty good. Haven't given SSR a decent thrash yet, but AA, tonemapping, DoF and AO are looking great and running fast. Also, the motion blur, at higher framerates, looks fantastic.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    AO isn't fast, SSR isn't fast. Haven't tested grading/tone and DoF yet, but I'm pretty sure the AO is slow, have to use the bare minimum settings on that one :)
     
    KRGraphics likes this.
  8. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Hi guys, I have a question regarding the stack: how can I access its individual components (bloom, DOF, etc...) via code to change them in real-time (when the game's running)?
     
  9. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I don't even use AO or SSR... if you have AO in your textures, you don't really need it... it is just slowing everything down
     
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well without nearby "contact" shadows, it's kinda needed yeah, especially as it's possible for AO to be really, really fast - 0.5ms on PS4 if I'm not mistaken with GTAO. Particularly impressed how close to ground truth it is, and it even has specular occlusion.
     
    KRGraphics likes this.
  11. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    man i really hope that we getting a specular occlusion soon, speaking of performance, ssr is mostly the one which affect performance from my test.
     
  12. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    And even on my laptop, it is pretty quick... is there any scripting reference on adding a Profile at runtime? I want to add a script to an empty object to just assign a Profile of my choosing. (I'm finally learning to script a bit)
     
  13. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Well, if it's not fast in general, it is, for sure, 'faster' than the Cinematic effects one. At least in my scene's case.
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's the same one though, and it's still 100% unusable on console. It needs to be made considerably faster (in our case).
     
    StaffanEk likes this.
  15. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    I'm sorry, I realize maybe my question maybe wasn't clear: How do you modify an effect in real-time, using C#?

    Let's say you need to change bloom intensity. Currently we do:

    Code (csharp):
    1. myCamera.GetComponent<Bloom>().bloomIntensity = 1f;
    But now that the effects are driven by a profile asset which lives in the project, how do you access the individual effects?

    Also, if you make changes to the profile asset during gameplay, do those changes remain as is, or are they reset once you exit the game (in the editor)?
     
  16. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    @Chman @Panokani
    Can you please take a look at the questions about tonemapping I've posted earlier?
    https://forum.unity3d.com/threads/new-post-processing-stack-pre-release.435581/page-3#post-2872342

    You can get a reference to the profile from the behaviour component and then and modify fields on it. If you don't want to modify a profile object (you probably don't, since they will likely be used as quality presets or something), the best approach is to copy the profile object before assigning it to the camera, and perform changes on that copy. I think it was discussed in detail a few pages ago.
     
  17. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Hi there ! That's a pretty dense post indeed but it does raise a few good points :)

    First, this may seem obvious but it's worth mentioning anyway : make sure you're working in HDR or tonemapping won't be of much use (and will result in a precision loss).

    So, the neutral tonemapper is "neutral" in a way that it won't result in any color or saturation shift in lows, mids and highs. Its goal is to remap luminosity without impacting colors at all. The underlying implementation is very close to the well-known "Uncharted" tonemapper.

    You can customize the white clipping by dropping White Level down. You generally don't want to tweak White Clip too much unless you know your luminosity range is pretty low.

    With regard to settings, I agree that the slider ranges and names can be confusing. That's definitely something we'll have to improve at some point. These map somewhat directly to the factors used in the following polynomial :

    Code (CSharp):
    1. ((color * (a * color + c * b) + d * e) / (color * (a * color + b) + d * f)) - e / f
    Black/White In/Out settings make it easier to tweak the curve without having to deal with the "arbitrary" A, B, C, E, F factors from the formula. They aren't perfect (making generic artist-driven settings for a polynomial like this is a bit complicated) and depending on the values you put in they may end up slightly affecting other parts of the curve. Basically, "In" settings are the entry control points for a given extremity (black or white) and "Out" represent the exit control points.

    That's why there's a curve preview in the editor :) Interestingly you're the first person/artist I know who finds it hard to tweak.

    Keep in mind that "tonemapping" in this context isn't about color correction per say but about luminosity range remapping (HDR values -> LDR range). You're meant to use it to remap your HDR input to a range that better fits your LDR display if you need it. Any color correction work has to be done with the other grading controls.

    That's a weird one. I'll look into it but it might be difficult to find the cause if I can't reproduce it.

    We don't have any plan to put Reinhard in. You can get results quite close to Reinhard by tweaking the Neutral tonemapper and using the Lum VS Sat curve to get the defects of Reinhard back. The most glaring downside of Reinhard is that it has a tendency to desaturate blacks, and tonemapping in this context is supposed to be used for luminosity range remapping (HDR values -> LDR range), it shouldn't have any hue or saturation shift.

    SSR in its current state is definitely the slowest effect of the stack. We're working on it :)

    See this and this.

    See this, this and this :) No ETA for the official, more flexible solution yet.
     
  18. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Thanks Thomas! I'll take a look at that.
     
  19. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Happens on builds as well, as the build is "the first run" also...
     
  20. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Good morning @Chman, is there a script reference for this? I am trying to do a setup for my prefabs in UFE to minimise set up.
     
  21. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    If you only want to assign a given profile, you can do it directly. There's a public profile field on PostProcessingBehaviour so it works like any other public field in Unity :

    Code (CSharp):
    1. yourCamera.GetComponent<PostProcessingBehaviour>().profile = yourProfile;
     
    KRGraphics likes this.
  22. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    This will be applied to a prefab... if it's anything similar to assigning a skybox to a scene at runtime, should be easy to do.
     
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Seems to break on latest 5.5p1 released today with pink screen:
    Invalid pass number (2) for Graphics.Blit (Material "(Unknown material)" with 1 passes)

    This all smells like serialization issues. I removed the pp stack and re-added it, same error, then restarted Unity and it's fine.

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.PostProcessing.PostProcessingBehaviour.OnPreCull () (at Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs:104)

    Still exists, but goes away when I disable InControl input Manager.... fecking odd considering all was well in pre-f3 land.
     
  24. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    This is so weird. The only way it could failed here is if OnPreCull is called before OnEnable. This shouldn't even happen in the first place, I'll try to find out what's going on. Sounds like a race condition or sync issue to me. Thanks !
     
  25. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    618
    Any update on this?
     
  26. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Not yet, mobile support is still experimental and only roughly tested. It could work on some devices and not others. The focus right now is desktop & consoles, but once we can allocate some time to do proper mobile testing this will be fixed.
     
  27. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    618
    Any plans to support Luts for color correction?
     
  28. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    Like this ? :)
     
    Gametyme likes this.
  29. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class SetPostFXProfile : MonoBehaviour {
    6.     public Profile postfxprofile;
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.         LoadCamera.GetComponent<PostProcessingBehaviour>().Profile = postfxprofile
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update () {
    15.        
    16.     }
    17. }
    18.  
    So here is some code I threw together... I basically want the script to find my LoadCamera, and just assign a profile... I am not a programmer so I am sure a lot of this syntax is not correct...
     
  30. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    I'm really enjoying this combined stack, the ability to tweak things in play mode easily is a giant help when it comes to tweaking content.

    Of course it is a bit easy to abuse the effects when you use too many at once. Earlier today I was trying to recreate the ReCore look (using realtime GI with a simplified environment mesh in a layer culled from the camera view providing the GI to the light probes) and I quite enjoyed the results when I used this processing stack on top. LPPV_Testing001.png LPPV_Testing002.png
     
    Last edited: Dec 8, 2016
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I've been trying to figure out how to get GI working properly for my outdoor levels... I would love to know the workflow to cull the mesh from the camera for light probes... i love the red tinge from the dirt, something I am having a hard time getting correct in my lighting...
     
  32. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    It's just a basic mesh as low poly as possible that roughly matches the more detailed mesh placement. The basic mesh is the only thing marked as lightmap static, with only Realtime GI calculation turned on. It's then placed on a layer of its own which is simply culled in the camera settings.

    We probably shouldn't get this particular thread too off-topic considering it's about the post effects stack, I'll start a thread for my workflow if it turns out to actually be useful performance wise once I've done some proper comparisons and profiling on it.
     
    Alverik and Zuntatos like this.
  33. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Or you can pm me... :) But on topic, this new Post Effects stack is the closest I have gotten to film quality
     
    Adam-Bailey likes this.
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  35. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Agree it would be nice to have. I second the feature request. However, I very very strongly disagree that its more important than SSAO. I find your opinion on that very surprising.
     
  36. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    SSAO is overrated and highly unrealistic. Corner shadows should come from the lightmapper, so no need for SSAO there. The only thing that it's useful for, is some fake indirect shadowing for dynamic objects. But there are better solutions for that (look at naughty dog papers for the last of us).

    And all in all, I don't think the performance hit is worth the benefit of grounding the characters somewhat, while also making all the corners in your game look like they have mold.
     
  37. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Because I doubt I have the perf budget for both. What would be nice is some new invention that combines both techniques for SSAO and SS shadow ;)

    Go on Unity, you've been innovating so far, why stop here?

    Basically, if it means I'm allowed to reduce my main shadowmap rendering requirements, it might even go a long way to breaking even because SSAO and SS Shadows do not require re-rendering the scene. That's a lot more quality for similar bucks in theory, assuming they can be optimised together.

    Also, one cannot rely on 3rd party due to 3rd party hitting limitations of the Unity API.
     
    Alverik likes this.
  38. Gogeric

    Gogeric

    Joined:
    Apr 5, 2013
    Posts:
    7
    I'm not sure if it's me but, inside the HTC vive I can see the SSRR as being slightly off to the left in the left eye and slightly off to the right in the right eye. I have Unity 5.5.0b10 and I tried many different combinations, (With or without the steamVR plugin, and many other configurations).

    Typically if I open my project, set-up Steam VR prefab character, attach the post effects to the eye camera, I get this rendering issue.

    I read on github that SSRR had issues in VR but I'm not sure this was the actual problem that it was talking about.

    FYI other than that the scene is fluid and there are no particular issues.
     

    Attached Files:

  39. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    Is there any way to preserve the depth buffer when postprocessing?

    For VR, I want to render some in-scene UI without postprocessing, and then some controller models which are usually on top of that. I'm trying to do this by rendering a second camera without clearing Z for the UI - but the Z-buffer doesn't survive if any postprocessing is enabled.

    I think this is a general OnRenderImage-related issue that's not specific to the new postprocessing system, but if there's a good solution to this, it'd be nice if it was built into the system?
     
  40. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    I support this idea, it would be awesome to have this effect in the stack, and it would be even more awesome if it was a Unity's own version.
     
  41. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Has anyone else noticed a memory or performance leak while using this effects stack? When I first run a simple scene with this stack enabled everything runs very smooth at 70+ fps . However within a few minutes of running the scene, performance starts dropping into the 50s then 40's and even lower. This is without even doing much of anything in the scene apart from looking around. At first I thought it was specific to the SSR effect, however it does seem to happen with other effects as well, though not quite as badly or as quickly.
     
    KRGraphics and StaffanEk like this.
  42. Chman

    Chman

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    721
    SSR hasn't been made to work with VR at all at the moment, what you're seeing is one of the problems you'll experience by trying to run it with VR.
    Hmm there's been a big refactor done on render textures / OnRenderImage in 5.6 that fixes a lot of issues with multi-camera setups. This may very well be fixed in 5.6. The first beta is available, any chance you could test your project on this version ?
    Are you sure it comes from post-processing ? What version of Unity are you running ? I just ran a fly-through in the viking village demo with all effects enabled and turned to 11 for more than an hour and memory usage has stayed consistent and pretty much static.
     
    StaffanEk likes this.
  43. UltronTM

    UltronTM

    Joined:
    Dec 26, 2014
    Posts:
    78
    Is the limit of 300 units for the max distance in Screen Space Reflection going to stay this low? Or did I oversize my scenes? Because 300 units seem way to low for a top-down like camera perspective.
     
  44. Gogeric

    Gogeric

    Joined:
    Apr 5, 2013
    Posts:
    7
    Thanks Chman I'll stick to Candela then until Unity solution is out (but Candela SSR is much much slower...)
     
  45. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    laptop?

    ....heat? :D
     
    KRGraphics, Zuntatos and GoGoGadget like this.
  46. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Is dithering planned to be added? It was really great in the Cinematic effects and here it seems like an odd omission.
     
    StaffanEk likes this.
  47. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    I've had this happen to me sadly :(

     
  48. UltronTM

    UltronTM

    Joined:
    Dec 26, 2014
    Posts:
    78
    Does anybody work with Voxels (Voxel model to static mesh export)? What scale do you use for each voxel?

    Mine is the default of the Voxel Importer extension, which is one unit per voxel. I didn't have distance problems in UE4 with this scale. But given that 300 units are max, and will stay this way. I'm going to have to shrink by /10.

    The thing is, that both voxel importers on the store don't extend Unity's file import pipeline really. They just act as components or via separated editor panel generators. This also means that since Unity is not supporting nested prefabs, it's a hassle (even in code) trying to construct voxel models inside unity for those who have to, because they use MagicaVoxel that can't do constructions since it only got one single voxel grid.
     
  49. gskinner

    gskinner

    Joined:
    Aug 28, 2014
    Posts:
    43
    @Chman First off, thanks so much for the amazing work, this new approach is light years better than the old, and the performance is really impressive.

    I'm wondering if you're planning on adding multi-edit support?

    Currently we have an effects stack that we want to use for the main VR camera, but also for the Spectator camera.

    For the most part, the stacks are the same, but the Spectator stack has a few extra effects, specifically Depth Of Field and Vignette.

    Currently, I'm using a shared profile, and then on my VR camera I Instantiate(profile) and then disable DoF and Vignette. It works fine, but prevents me from tweaking both stacks at runtime, which is a bummer.

    Ideally I would just use 2 different profiles, but because they don't support multi-instance editing, this would be too cumbersome, as I'm constantly copy and pasting settings from one profile to the other trying to keep them in sync. If we could select both profiles, and tweak the shared settings we're interested in, that would be a nicer workflow.
     
  50. gskinner

    gskinner

    Joined:
    Aug 28, 2014
    Posts:
    43