Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PRISM - Realistic All-In-One Post-Processing for Unity

Discussion in 'Assets and Asset Store' started by GoGoGadget, Dec 12, 2015.

  1. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Sorted - thanks!
     
    GoGoGadget likes this.
  2. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Any compatibility issues with PS4 and Xbox One platforms?
     
  3. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    There *should* be no issues with PRISM on PS4 and Xbone, although I don't know of anyone running PRISM on those platforms yet. If you are a registered developer for them and interested in trying out PRISM, send me a PM, I'd love to gather some more info and get it tested out on consoles.
     
  4. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,748
    Does this cool looking system work fine with latest 5.3 and the latest 5.4 beta?
     
  5. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    I'm using it on 5.3 right now (it has 1 shader compilation warning which doesn't actually mean anything), and there's no reason that it won't work on 5.4, it doesn't rely on any fancy editor code that can break between updates. Of course, if you do find an issue in PRISM, let me know via email and I can get it fixed ASAP.
     
  6. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    PRISM v1.32 is now available on the Asset Store, with a few minor bugfixes to AO, namely:
    -Fixed AO not compiling on <SM5.0
    -Fixed AO applying to transparents when no blur was used
    -Fixed AO not clearing after "Clear PRISM Preset" has been pressed
     
  7. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Running on xbox one I'm getting this:
    WARNING: Shader Unsupported: 'Hidden/PrismObscurance' - Pass '' has no vertex shader
    WARNING: Shader Unsupported: 'Hidden/PrismObscurance' - Setting to default shader.
    WARNING: Shader Unsupported: 'Hidden/PrismEffects' - Pass '' has no vertex shader
    WARNING: Shader Unsupported: 'Hidden/PrismEffects' - Setting to default shader.
    WARNING: Shader Unsupported: 'Hidden/PrismEffectsSecondary' - Pass '' has no vertex shader
    WARNING: Shader Unsupported: 'Hidden/PrismEffectsSecondary' - Setting to default shader.

    Is it possible for you to fix it?
     
  8. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Interesting, that should be an easy fix (I'd assume), I'll pm you.
     
  9. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    The problem is solved now, thanks for the help.
     
    GoGoGadget likes this.
  10. KyleOlsen

    KyleOlsen

    Joined:
    Apr 3, 2012
    Posts:
    237
    Any way to get the global fog component to play well with skyboxes? Specifically the Time of Day skydome asset.


    (Fog extremely exaggerated to show what I mean...)
     
  11. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    So, the closest you could get right now is by making a fog-only PRISM-preset for each time of day (eg: Morning/Midday/Dusk/Night) with different fog colors in each preset, then calling LerpToPreset(middayPreset, time). I actually have TOD, so I'll take a look at it in the next couple of days to see if I can find an easier way of integration.
     
  12. KyleOlsen

    KyleOlsen

    Joined:
    Apr 3, 2012
    Posts:
    237
    The issue I'm experiencing is that the fog doesn't affect the sky no matter the density or distance setting, which setting on the preset would control that?
     
  13. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Ah, that's not actually a visible setting - to change that you'll have to edit PRISM.cginc, around line 768:
    Code (CSharp):
    1.         if(depth_r > 0.9999999)
    2.         {
    3.             //Comment out this line, or just delete this if statement
    4.             //fadeAmount = 0.0;
    5.         }
    I'll add this into the PRISM docs so it's clearer to future users, can't really add it in as an option without adding another shader keyword, which I like to avoid where possible.
     
  14. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    What does the second fog setting do - cant really see any difference - would be nice to see Prism lerp between the two colours.
     
  15. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Some lovely Prism effects here - playing with Gaia and Prism :)



     
    GoGoGadget likes this.
  16. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Hmm, just tested it out, definitely not working as intended, and I know why, one line which I forgot to change back before the current asset store version (whoops):

    Code (CSharp):
    1. PRISM.cginc, around line 775, change the - symbol to a /:
    2. float fad = _FogHeight - worldPos.y;
    3. to
    4. float fad = _FogHeight / worldPos.y;
    And then you'll be able to get results like this, which uses the secondary fog as a stronger, lower, height-based fog, which fades up to the bluer distance fog:


    That will be in next patch, as well as a new cutoff option for PRISM's AO, which will it easier to use AO in super long distance scenes without worrying about artifacts or large bias.

    Looking gorgeous Adam! Just starting to really get my hands dirty with Gaia now, and I'm loving how easy it is to iterate.
     
    AdamGoodrich likes this.
  17. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Lovely - was hoping that was what it was supposed to do - this will create some awesome creative opportunities :)
     
    GoGoGadget likes this.
  18. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    Ahhh - lovely :)

    Grab 20160303174312 w1900h1200 x0y56z-156r148.jpg Grab 20160303175427 w1900h1200 x21y53z-360r149.jpg
     
    montyfi and GoGoGadget like this.
  19. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    214
    GoGoGadget likes this.
  20. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Definitely - If you can put an image effect on your camera, then PRISM will work in your scene, it doesn't rely on any special shader hacks etc, and works perfectly in both HDR and LDR scenes where other non-LDR PostFX (like Sonic Bloom) don't.
     
    blacksun666 likes this.
  21. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    blacksun666 likes this.
  22. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Tried out Unity's (beta) Cinematic Image Effects the other day - their SSR is brilliant, DoF looks quite nice, unfortunately it's downhill from there. I was actually a bit worried (and hopeful) after Unity announced them, that they might all perform extremely well, and be a no-brainer. Nope!


    The above profiler shot shows an equivalent setup of Unity Cinematic Effects vs PRISM (using the Standard Linear HDR PRISM.Preset), where PRISM has a 1.7ms lead on Unity's stack. As a Unity dev myself, I was actually hoping that they'd combine all their new image effects properly (as is standard in AAA games), but it looks like they've gone down the backwards route again, unfortunately.

    Edit: Fixed profiler shot
     
    Last edited: Mar 5, 2016
  23. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Few new screenshots of the new SAO coming in next update, PRISM v1.4 (which will be submitted to the store for review today):



    So, the new SAO is an adapted version of Keijiro's effect, which Unity have also just committed to their new Cinematic Image Effects package, but with some large improvements, the issues I found with Keijiro's SAO were:
    • Way too strong on bright surfaces (his has an "Ambient-Only" checkbox which doesn't really work, the version in PRISM is fully HDR-compatible -- if you have a strong light, you won't see the AO where it hits)
    • No distance cutoff (can be nice to have sometimes, so I added it)
    • Not combined with other effects (looks like Unity's version won't be combined anytime soon!)
    • Few very minor bits of code which I've optimized
    Done some tests using the standard/linear/HDR preset (Bloom/DoF/SAO/Tonemapping/Color Correction), and PRISM is now hitting just under 2.5ms @ 1080p for all those effects, start->finish, from my benchmarks :)
     
    Last edited: Mar 8, 2016
    AdamGoodrich likes this.
  24. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Will it work with SpeedTrees in Forward? At the moment I know only one SSAO asset which promises to make it work pretty soon.
     
  25. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,780
    I have been told that performance of SpeedTree is much better in deferred - have not validated this myself tho. Might be interesting to profile.
     
  26. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    That could be true, but I have just several trees and the overall performance is down by 10fps in deferred. I'm trying to move my old game to consoles and it makes a difference. At the moment I prefer to turn SSAO off instead.
     
  27. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Just checked, no, was not aware of this massive issue with SpeedTrees. It's very very tricky to make a workaround for this that doesn't end up taking more performance than it saves, I'll be very curious to see how other assets do it. Also, I'd expect Unity will actually be fixing the bug itself soon, since their new SSAO doesn't work with this bug either.

    To be honest, it would probably be easier to modify the SpeedTree shader itself to include an AO map, it's surprising that it doesn't have support for one in the first place really.

    I know it's not an easy decision changing rendering paths, but have you tried Legacy Deferred? It has a much lower overhead than normal deferred, and AO + SpeedTrees work in it.
     
  28. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Ha, this bug exists for a year already, maybe longer. Unity doesn't care.
    Thanks for advice, I will try that.
     
  29. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    791
    A workaround without loosing performances is maybe feasible depending on your algorithm.
    In my SSAO, I needed to get positions of the nearest neighbor pixels on the tangent plane so what I've done is that I replaced this with simply getting position of the direct neighbor pixels and reconstructed the normal from them.

    To sum up, by doing this I'm saving 1 texture fetch (the normal). The downside is that you don't get texture normals, but anyway you don't get it from Unity's view normals texture when in Forward rendering.
     
    GoGoGadget and montyfi like this.
  30. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    You'll like next update :) It actually ended up being way easier than I thought to completely remove the dependency on the normals texture, which has the added benefit of making the effect work much nicer with Unity terrains (which don't blend normals in forward properly anyway). Thanks @jimmikaelkael for the good idea to just reconstruct the normals!
    Here's a little (still WIP) sneak peak of some SpeedTrees in forward:
     
    montyfi and jimmikaelkael like this.
  31. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Super cool, can't wait!
     
  32. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I got a strange bug when setting up PRISM. when I start my game with prism enabled my field of view changes to 106.
    This does not happen if the component is disabled.

    I can change the fov after in script.

    Any idea?
     
  33. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Just checked, no-where in PRISM references the camera's field of view. You can check yourself if you want, by opening the PrismEffects script and searching for 'fieldOfView', it's almost certainly caused by a script outside of PRISM.
     
  34. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    I did the same check. strange problem, still have not identified it. I am thinking unity bug.
     
    GoGoGadget likes this.
  35. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Updated to v1.4 and now my screen is just blurred? It doesn't go away if I turn off individual (or all) PRISM effects. Only goes away if I disable the PRISM component altogether.

    Thoughts?

     
  36. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Try removing the PRISM component from your camera, selecting the PRISM folder, then right clicking>reimport, then re-add the component back to your camera. Then, if it's still happening, view the PRISM inspector in debug mode, and make sure that "Use DoF near blur" isn't ticked.
     
    Last edited: Mar 20, 2016
  37. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    So, after playing some of The Division I was a bit inspired to improve some of the techniques PRISM uses for update 1.5, which will feature:
    • Completely new eye adaptation, rewritten from the ground up to support easy workflow (let's be honest, who knows what the values on most eye adaptation scripts do, even with tooltips). The new version not only works better, and performs better, but it also has multiple debug modes which allow you to 'grab' correct values directly from the rendered texture - no more guessing!
    • Scene-view rendering - thanks to Unity's [ImageEffectTransformsToLDR] feature, PRISM now automatically applies to the scene camera. I've found it extremely handy in testing, your artists won't really need to go into game view/have both views open at the same time.
    • Brand new lens dirt algorithm - better looking, BF4-style lens dirt.
    • New ACES tonemapper (default Tonemapper in UE4) with tweakable values - I personally find the default values of ACES to look a little bit too similar to filmic tonemapping, but with some scene-dependant tweaks, it can look really good.

    Just a quick example of the new scene view rendering + playing around with lens dirt/ACES.

    Also, before release of the next update, I'm running a poll to see how many PRISM users might be affected by the SpeedTree/AO issue. Anyone that's using PRISM, vote here!
     
    KRGraphics and elbows like this.
  38. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    @GoGoGadget did you also make changes to the way Fog works in 1.4?
     
  39. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Yep, in 1.4 Global Fog was fixed so that the secondary fog color now correctly applies (it didn't before).

    To fix the Speedtree issue, for 1.5 what I've done is simply included PRISM's old SAO shader in the package as well, which is actually designed to work without normals. So all you have to do is add the legacy PRISM.AO component onto your camera with PRISM on it, set the values, and it will automatically 'inject' itself into prism, while still sharing the final combiner pass. Worth noting that this AO should only be used if you are using forward rendering and speedtrees, in any other case, PRISM's default AO is better.

    PRISM v1.5 has been submitted to the store today, and it should be the last major release for a while, it's full of performance improvements, visual improvements to a bunch of effects, more demo scripts, just about everything. Now, even if you're only using one effect (eg. tonemapping), PRISM will be just about as fast as a single component. As always, your PRISM Presets will carry across versions seamlessly, the only thing you'll need to change is values for eye adaptation (and potentially lens dirt intensity) in 1.5.
     
    montyfi likes this.
  40. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Prism v1.5 is now live on the Asset Store!

    Very happy with this release, which adds scene-view rendering, less overhead when using fewer effects, faster AO, better lens dirt, and a brand new eye adaptation method.

    Would love to see any screenshots from PRISM users, could potentially even feature them on the PRISM store page, similar to how Amplify do it. So, if you have any good ones, feel free to post them! In the meantime, here's an on-off of the demo scene - with PRISM costing only a touch more than 2ms frame time @ 1080p
    Off:

    On:
     
  41. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    How is Prism's performance under mobile?

    I ask because my game is using the Vignetting and Chromatic Aberration filter in the Unity Standard Assets package and it chops my framerate in half on mobile. Would I see much better performance from your Vignette shader?
     
  42. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    So, if you're using that with the "Blur" parameter, then it performs a slightly different function to the Vignette & Chromatic aberration built into PRISM by blurring the edges of the screen, which costs 3 extra passes.
    If that is the only effect you are using, PRISM's performance will be slightly better than that effect with "Blur" set to 0, since PRISM gains most of its performance through sharing effect passes, but if you wanted to add in another effect after that, then PRISM would start to get noticeably cheaper than builtin.

    Let me quickly do some tests and I'll post an update with screenshots.
     
    Last edited: Mar 30, 2016
  43. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    Thanks for checking.

    My understanding is that the Vignetting is so expensive on mobile due to the limitations of mobile GPUs. I don't know enough about shaders to pinpoint why exactly but I tried following some of the advice on this reddit thread but even when replacing the vignette effect with a fullscreen semi transparent texture I still take a big performance hit.
     
  44. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    So, I don't really think that would work, since you're gonna have to take texture samples for the chromatic aberration anyway.

    Anyways, just tested (in editor - so don't take these numbers as gospel, some mobile GPUs perform certain operations slower, but after taking a look at Unity's shader, it just looks crap, to put it bluntly). Anyway, here's the numbers:

    Unity Stock Chromatic Aberration + Vignette + Blur turned on (0.382ms):

    Unity Stock Chromatic Aberration + Vignette + No Blur (0.161ms):

    PRISM Vignette + Chromatic Aberration (0.074ms):


    Long story short, PRISM is a bit over 2x faster from these tests. I can almost guarantee that you'll see some sort of GPU performance gain from using PRISM, but can't say how much without actually profiling on the target device. Also, if it matters at all, PRISM will increase your build size by a bit when compared to just the one PostFX shader, but if you know the basics of shaders, you can remove some keywords to trim it down a lot.
     
  45. youblistermypaint

    youblistermypaint

    Joined:
    Aug 5, 2015
    Posts:
    14
    Thanks for looking into that again. I am not using blur and I am not sure if that performance increase is going to be enough on mobile. I am most likely either going to disable the effect or prebake it into assets.

    If I did want to try PRISM, what is your refund policy?
     
  46. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    I'd be more than happy to refund it if you try it out and find it doesn't perform as you expected on mobile
     
  47. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Not sure what's going on, but no matter what settings I use now, I always get these artefacts with fog since the changes. It used to work perfectly. Any thoughts?

     
  48. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Strange, does changing the height of the fog fix those? There's no reason the fog should apply to only those bits unless they're at a different depth. Also, can you screenshot your settings in the PRISM inspector, I'd like to get this fixed for you ASAP.
     
  49. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I've tried adjusting everything but nothing fixes it. It was working nicely in v1.2 but v1.3/v1.4 have given these results.

    I'll play around some more tonight and grab some screenshots of the settings. Probably a video.
     
    GoGoGadget likes this.
  50. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Just purchased this now. We're getting an issue with the ambient obscurance effect, when its used in combination with terrains drawn with the Distingo asset shaders. The terrain becomes semitransparent, we can see trees and rocks through terrain walls and floor. prism-distingo-issue.jpg

    edit: I just saw what you wrote earlier about terrain's not providing correct normals and so tried your legacy version of the AO effect. That at least doesnt cause the transparency bug, and though I cant see the AO effect on terrains themselves at all yet, it is at least affecting the grass and other details objects. However I am getting the following error on play:

    UnassignedReferenceException: The variable m_Material of PrismEffects has not been assigned.
    You probably need to assign the m_Material variable of the PrismEffects script in the inspector.
    UnityEngine.Material.SetTexture (System.String propertyName, UnityEngine.Texture texture) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:238)
    PRISMAO.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) (at Assets/PRISM/Legacy Effects/PRISMAO.cs:118)​
     
    Last edited: Apr 1, 2016