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. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Any updates on reworking the fog, GoGo? I updated today from 1.7 to 1.83, and the fog in my scenes is now dense and opaque.

    I see in the release/patch notes "Removed fog intensity from the inspector, as it's unneeded. You can reproduce lower intensity by darkening your fog colors " I tried doing that, but I'm getting odd results, suggesting something is broken. I dont see how to get sensible results with it as is. Maybe if it respected the alpha value in the fog colours, it would be a simple solution to density management, and allow intense dark fog.
     
  2. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Next PRISM update is currently being tested out by a few users, as per the release page it's mainly focused on PRISM's AO, adding a new blur option and fixing some bugs with it. Good idea regarding the alpha in the fog, I'll take a look before next release to see how I can implement that best, potentially even with a new fog algorithm.
     
    punk likes this.
  3. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Quick update on 1.8.5, this week I've been (attempting to) use Unity 5's light baking for the first time, and found the workflow so bad I've actually been inspired to make PRISM's new fog as easy to use as possible, so you don't have to guess any more magic numbers, and so that you can't really plug in anything that's invalid.
    Little gif of new fog in action - faster performance, less parameters, more results.

    With fog/tonemap/bloom

    Without
     
    Last edited: Jun 9, 2016
    SAOTA, PeterB, Gametyme and 2 others like this.
  4. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    looking nice ;)
     
    GoGoGadget likes this.
  5. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
  6. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Been doing some comparison with scion in the Depth of field, I would like to request a auto adapt DoF like the one in Scion, the current one looks nicer but it is tedious to make it work.
     
  7. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    This is simply fantastic. Finally something that completely blows Unity's Global Fog out of the water, and is intuitive and logical.

    Can't wait.

    It'll be interesting to see if it's possible to adapt UniStorm to use it instead of Global Fog. Do you communicate with the UniStorm guy? Are you in contact?
     
  8. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    By auto adapt DoF, do you just mean a DoF that focuses where the camera is looking? That should be fairly simple to add, just a spherecast that lerps the DoF focus point to where it hits.

    Thanks! So if UniStorm currently uses Global Fog, I see no reason why it couldn't support PRISM as well - I'll send the author an email, PRISM integration should be simple into that sort of asset, I would imagine it would just be creating a few different Fog PRISM-Presets for each time of day, then calling LerpToPreset on them.
     
    katoun and PeterB like this.
  9. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    If you get Unistorm to support PRISM fog ask them about sunrays also. It would be great to be able to skip those extra effects when using Unistorm
     
    GoGoGadget and radimoto like this.
  10. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    yes that would be great, and in addition an option for transform based focus DoF like the one in unity cinematic beta would also be great, in case the object to focus is not in center.
     
    GoGoGadget likes this.
  11. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    PRISM's DoF actually does have that transform based focus feature already, just call SetDofTransform(transform target) as per the scripting reference. Will get the auto-focus in for next release though!
     
    yc960 likes this.
  12. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Tested the UI blur feature. Couple of things to fix.
    1. documentation mentioned a "use UI blur" option, I don't see it with the HDR bloom settings.
    2. image is flipped and I thought adjust the flip value would fix it. It does not.
    On line 115
    Code (CSharp):
    1.     screenPos.y = _Flip - screenPos.y;
    If my elementary math teacher did not fail me, image is gonna be flipped no matter what number I plug in.
    3. Ideally material tint should be using vertex color and alpha to make use the unity UI color and make life easier for us instead of having to access material through code.
    4. Tint alpha does nothing, intended?
    5. Blur seems to be bokah based, do we get a choice?
     

    Attached Files:

    GoGoGadget likes this.
  13. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    1. Are you on the latest version? It should look like this:
    2. Think that must've been a relic from when I was testing something, will get that fixed for next version. Thanks for the report.
    3. Actually wasn't aware that's what Unity's UI thing changed, will also change that for next release!
    4. Intended
    5. It's bokeh unless you use the bloom texture, in which case it will be gaussian. I'll add a note in the docs on how to change the shader to remove the bokeh if you want to as well (or maybe just provide another shader, but it's pretty easy to manually edit)

    Edit:
    Will also be testing out various UI setups (screen space camera, world space camera, overlay etc) before next version.
     
    Last edited: Jun 11, 2016
    yc960 likes this.
  14. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    UI blur 2.jpg
    It seems that the UI blur is screen space overlay only, in screen space camera the blur behaves weird.
    The new effect appears to be AO related, it do certainly looks cool, so maybe you can fix it up and make a variant of the UI blur.
     
    Last edited: Jun 11, 2016
  15. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    So, in order to fix that, you'll have to make sure that your UI renders after PRISM is finished rendering, as it's caused by PRISM's effects pool all rendering at the same time after opaques. Will add some documentation on the various methods to do this before next patch goes live.

    In other news, PRISM v1.8.6 has been submitted to the Asset Store, pending approval. Huge QoL patch, including the new fog algorithm, and plenty more changes which can be found on the Patchnotes page. This version has also been production-tested in the most recent update of my game Down To One, and by all reports it's blazingly fast! (After an upgrade from PRISM v1.2)
     
    punk and yc960 like this.
  16. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Just read the patchnotes, couldn't wait. Quick question, would unity's SSRR benefit from stack with defer AO? They use the same geometry info, do they not? What is the ETA on lens flare and anamorphic flare? I am using Ultimate bloom at the moment and the perf is killing me (comparable to high quality SSRR).
     

    Attached Files:

    • 4.jpg
      4.jpg
      File size:
      1.2 MB
      Views:
      877
    GoGoGadget likes this.
  17. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    As per this post, I just want to clarify, I haven't confirmed that lens flare will be added to the stack. Also, it is inherently a much more expensive effect, and since anamorphic/lens flares have to undergo separate blurs in their own pass anyway, it really wouldn't benefit a lot from PRISM integration.

    At the moment, Unity's shader compiler is driving me up the wall with unexpected behaviour on shader keywords - it's a bug which I've reported & had verified, and until that's fixed I can't add more effects without them negatively affecting performance for everyone, which I don't want to do.

    SSRR would benefit from final-pass integration, but for the reason above, more effects are not really on the table at the moment, focus is on further improving performance and ease of use of the current stack on all platforms. Your screenshot looks awesome though!
     
    yc960 likes this.
  18. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    If it is amount of keyword that is the problem, the shader has to be built in editor with a script that allows customer to choose the which aspect will be toggle-able in runtime, so the shader built from script will have always on effects(no keyword spent), effect to be toggled (key word cost), always disabled effect (keyword not spent). It would be a life-saver if you did this as I am hitting the hard 128 word limit and It kills me whenever I see stuff on asset store that I know would cause me nightmares to integrate into my project.

    Do you mean anamorphic flare cannot share pass with bloom? If I use other bloom solutions in addition to Prism, it would look weird in addition to the perf problems. I can live without lens flare, but please do consider integrating anamorphic flares.
     
  19. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    It's a deeper issue than just keyword amount unfortunately, and many of PRISM's shader keywords perform more than one function than just 'effect on/off' anyway, to save on keywords.

    Anamorphic flares need to be scaled down on the horizontal axis before blur, and then need to undergo a completely separate multi-pass blur, so there's very little that can be shared in that regard. Feel free to PM me if you want more info on this as well, just so we don't clutter up the thread too much.
     
    Last edited: Jun 21, 2016
    Shodan0101 likes this.
  20. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    1.8.6?

    For me, the Asset Store shows 1.8.3 as the current version?
     
  21. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Submitted to the Asset Store and pending approval*, and now the new version has been approved and is live!
     
  22. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    So there was no 1.8.4 and 1.8.5 ?
     
  23. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Correct, they were internal versions for the AO improvements (1.8.4), new fog (1.8.5), and experimental multi-cam + previous changes for v1.8.6. I should actually put that in the release notes, but if there's a version jump on the Asset Store that will generally be why.
     
  24. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    could you elaborate on the multi-cam functions? Is it stacking cameras together? I cannot find relevant features in docs.

    And the AO on UI is actually a cool effect if you can somehow stabilize it, current it does not play well with exposure adaptations.
     
  25. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    No worries - was mostly concerned that the Asset Store wasn't "updating" for me or something along those lines. Thanks :)
     
    GoGoGadget likes this.
  26. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Will add some info to the docs on multi-cam, but do know that at the moment it is plagued by some strange behaviour with how Unity clears depth buffers, and only relevant for DoF/AO (basically a specific use case for Down To One). Very much an experimental feature that may or may not be possible to improve in the future.
     
    yc960 likes this.
  27. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    There is more to it than just depth clearing. To put it simply, Unity simply cannot do HDR multicam correctly. It breaks AO,bloom,AA and SSRR. Look up, Case 760037, it literally forced me to change my game design and mechanics to work around it. When you want to mix and match forward and deferred it gets even worse.
     
    GoGoGadget likes this.
  28. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Updated to 1.8.6 excited to try out the new fog. At first I found that my fog was appearing fully dense at the Fog Start Point, with no fade in. It turned out that I had Fog End set to the same value as Fog Start Point. I guess I had assumed Fog End was treated as a distance from Fog Start Point, rather than from the viewer, so it seems its still possible to plug in invalid values. Anyaway, looks great with correct values. Also is the "Fog Lower Color" value still being used for a height based fog effect? I dont see any height settings now. Is it using the same distance settings as the "Fog Upper Color" but based on the distance in world Y from the viewer?
     
    GoGoGadget likes this.
  29. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Hmmm, thinking about it that would make a lot more sense... Will make some changes to the inspector before next release to improve this.
    The "Fog Lower Color" does indeed get applied at a preset distance below the normal fog color, just to make things easier/less settings to tweak. I will add an easy way to manually change this in the shader for next release and relevant docs, a define up the top or something.
     
  30. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Is there a way for the fog to be influenced by skybox color, like the one in Azure[sky]?
     
  31. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I used to find the fog would sit nicely on the ground - i.e. it appeared to be a horizontal effect. Now it appears to be a vertical "wall". Is that the intention? Is there any way for that to become an option? For me, building a dungeon crawler, the fog layer across the floor looked fantastic. Now it's a very different looking effect. I'll find old and new screenshots if I'm not making sense :)
     
  32. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    No, that's a limitation of having the fog combined into the main pass unfortunately, but it is affected by bloom color, which in turn is affected by skybox intensity during the day.

    Will be honest, forgot about your use case Steve, and the new fog won't support that by default, but I've gone ahead and added some lines you can edit in the .cginc shader to achieve your effect. Not pretty, but it'll work, and shouldn't ever change from now on. In the next update, just search for #VERTICALFOG in the CGinc file and uncomment the lines below/manually tweak values, which results in vertical-only fog:

    Will add this HOWTO in the docs too.
    If Unity's shader compiler actually worked with shader features then this wouldn't be an issue to add in properly, but alas.
     
    SteveJ and yc960 like this.
  33. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    New version of PRISM with the above fixes is now live on the Asset Store! Also, I'm moving to Sydney this weekend, so expect a delayed response to any support inquiries - should be back up to full speed on them by next weekend!
     
  34. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Is there any way to get dark fog? Like, for example, black fog. It seems like if I make the colors too dark, the fog just becomes transparent instead of actually dark.
     
  35. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Have you tried setting the alpha channel on both colors to full alpha, and updating to the latest PRISM version?
     
  36. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Thanks for the assistance - much appreciated. I'll give those changes a try.
     
    GoGoGadget likes this.
  37. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Bug report:

    Getting

    NullReferenceException: Object reference not set to an instance of an object
    PrismEffects.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) (at Assets/PRISM/PrismEffects.cs:1853)

    from editor 5.4 b25 when turning on use bloom tex for UI blur while in edit mode
     
  38. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    There is no such thing as orthorgraphic camera with deferred lighting, unity made it pretty clear that if you use orthorgraphic camera, everything turns into forward instead. Deferred is for perspective only.
     
    GoGoGadget likes this.
  39. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    This error should be an editor-only error if you turn on "Use UI Blur" without re-enabling PRISM. Temp fix is to disable/enable the PRISM component when you are toggling that checkbox in the editor, that bug shouldn't affect anything in play mode/any builds.
     
  40. CallHimX

    CallHimX

    Joined:
    Jun 16, 2013
    Posts:
    7
    I know this effect is overused in the past by many projects and films.
    But is something planed like Anamorphic Lens Flares for this pack in the future?

    This effect is still awesome for Sci-Fi Games, well-implemented.
     
  41. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
  42. CallHimX

    CallHimX

    Joined:
    Jun 16, 2013
    Posts:
    7
    GoGoGadget likes this.
  43. DeadNinja

    DeadNinja

    Joined:
    Jun 3, 2013
    Posts:
    39
    The Prism is broken for vr (vive on openvr api) on 5.4 f1 when *single-pass stereo* feature is on. Im known its beta and im using Prism on 5.3 for vr without any problem but could you please look for it as its really critical for my project.
     
  44. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    As far as I'm aware that is a Unity bug, PRISM doesn't use any specific custom methods to apply effects to the screen (ie. if Standard Image Effects work, PRISM will in 99% of cases).
    If you're still having this issue, or could provide more reproduction steps, emailing the support email in the readme is your best option for super quick support, I don't have a VR devkit to test it out on, but for now I'd recommend rolling back to a Unity version that works.
     
  45. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Feature request: Is there a possible way to link DoF with chromatic aberration? I think uncharted 4 did it in some scenes and it looked pretty good.
     
  46. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    PRISM's DoF and Chromatic Aberration algorithms don't use any particular 'real-world' values from cameras by design, which means in general they're more flexible (can have a wider range of values that work) but can't be linked by nature. With that being said, you can always set up a PRISM-Preset for DoF and Chromatic aberration, and call LerpToPreset to smoothly transition between values.
     
    Shodan0101 and yc960 like this.
  47. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    What I meant was that object in focus gets no chromatic aberration regardless of screen position and blurred object are getting the aberration effect. I don't think I can do that with lerp presets. The object of focus might not be in the very center of the screen.
     
  48. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    What is the recommended stacking order for PRISM, motion blur, TAA, SSRR, and other common posteffect etc?
     
    Shodan0101 likes this.
  49. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I'm having no luck getting ground level fog with those settings. I kind of managed to get fog vertical across my ceiling, but can't figure out what I'm actually doing with those settings - they aren't changing logically that I can see.

    Any tips?

    If it helps, I think these are the settings that I used to use (I saved this screenshot of the settings long enough ago that it SHOULD be from when it was working).

     
    Last edited: Aug 5, 2016
  50. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,748
    Just tried to use Prism in 5.4, I added the Prism component to the camera and turned on DOF and it has flipped the scene upside down, what needs to be done to get that to work?