Search Unity

Image Effect for Bloom/Blur/Color Correction/Exposure Adjust

Discussion in 'Made With Unity' started by RElam, Jan 29, 2010.

  1. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Finally got around to updating my post processor, and thought others might find it useful. Fixed a bunch of little problems, made it a bit more animation friendly, and added constant and radial blur options. Running animations on the post-processor for in-game events is pretty useful and easy. The blur effects are highly adjustable, so it's likely alot more useful to many people than the built in Unity blur functions. The bloom may also be more useful to many than the Unity glow, due to additional options. Although it's made primarily for SM3, the SM2 fallbacks are likely acceptable in most cases.

    Here's a web demo of the Unity island level.

    Added U3 version, should work mostly the same as the previous version (few math changes/fixes, so if using previous animations, may need minor tweaking). I'm very happy with how well this works in conjunction with the U3 Bloom and Flares image effect, although I might in the future figure out an easy way to optionally work with float render targets between these two effects, it's still pretty nice right now. Using this image processor first will allow you to apply color correction and the simpler blur, then you might be able to get away with less iterations on the Bloom and Flare gaussian blur, but even if not, it'll still give you a ton of control over how things look in the end. Make no mistake though, this is not a replacement for U3's, well, anything, but it compliments the Bloom and Flare really nice, and give you a ton of control for animated effects and refining the look of things. You can do a ton of cool stuff with just this and U3's bloom and flare, IMO.
     

    Attached Files:

    Last edited: Nov 21, 2010
  2. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Hi!


    I tried out the demo, and I have to say, I like it a lot!

    Camera effects are beyond me...


    My computer has a strange issue with downloading .unitypackage files..

    As it is, my computer just displays the .unitypackage inside the web browser, and doesn't actually download it.

    If you were to zip the package, my computer would download the zip, unzip it, and then start decompressing the unitypackage as well.


    So, the only option is to put the unity3d file into it's own folder, and compress the folder..

    Do you mind doing that?

    Also, I have a couple questions...


    Is this pro only - if so, unlucky me...
    And, would this be useful for making a glowing effect?

    I have a model that currently uses a self illum shader, to make the sides kind of glow, but, not so much with a "halo".

    From what I have heard, the (pro only) Unity bloom effect is great for doing glow.

    I only want parts of the model to glow, and not the whole screen.

    Still, blur would be useful for what I'm working on!
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Right click -> Download Linked File. (Or whatever option is most similar to that with whatever browser you're using.)

    All camera image effects are, I'm afraid.

    --Eric
     
  4. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    What an amazing shader, really great work.

    I have one question, when I have the gui active on and I build a version the gui to control the shader appears as expected but only some of the sliders work, the iris ones for example all work, and I can turn the gui on and off but the stauration sliders cant be dragged, have I done something wrong?

    Again well done on an amazing shader.
    Chris
     
  5. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    As Eric said, yea, pro only.
    If you’re wanting any kind of localized glow, no, this would be no good for that. You could check the shader replacement stuff for something like that, I remember seeing some kind of glow thing, but that’s about all I recall. This shader will indiscriminately adjust all pixels, currently.
    It’ll still glow the entire screen, just like this one. IMO, the Unity glow/blur effects lack sufficient parameters for production purposes, that’s part of the reason I made this. The Unity animation system makes these kinds of highly parametric shaders pretty powerful.
    Thanks, and no, that’s not your fault. I forgot to test that, but I’ll likely take that GUI setting out, I added that when I first released the shader Old shader. I broke it when I made the shader more animation ‘friendly’. The shader basically copies your initial settings when it starts running, and sets them each update. That way, you can play one-shot animations on the camera (otherwise, the values will slowly ‘drift’ away from their initial values). This allows your initial, inspector set values for the shader to act like a default animation, but the GUI option was altering the ‘animated’ values, thus resetting each frame. In the end, being able to temporarily adjust settings in-game isn’t that useful, you can get just as much testing just playing around with the shader settings in the editor, it was just an easy way to show the shader’s settings in the first demo, but now it’s more trouble than it’s worth :(.
     
  6. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    REalm, Eric, thanks for the help.

    Amazing work, REalm. :)
     
  7. X5900

    X5900

    Joined:
    Jun 19, 2009
    Posts:
    11
    This is a great piece of work, seriously. What does the bloom only function, if I turn it on, the screen flips upside down in 2.61. Other than that, it's amazingly cool.
     
  8. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    I've noticed that Unity renders stuff upside down sometimes, but it's usually fixed in the final pass(s). I've no idea why Unity does it, when Unity does it, or how to fix it though, but I'll look into it.

    Edit: Well, looks like a common problem even with built in effects. Does it only happen when more than one image effect is active, or just when this one is active? If the former, what image effects are active that make it happen, and on what hardware (seems hardware related in some cases too).
     
  9. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Updated shader, took out GUI, and fixed some fairly silly math errors on my part. Anyone using it should likely grab this newer version.
     
  10. X5900

    X5900

    Joined:
    Jun 19, 2009
    Posts:
    11
    If I add another image effect like Noise, the Bloom only works and isn't flipped. I'll try your updated version and see what happens.

    I forgot to mention that Bloom only not only flips, it also doesn't work (just saw what it does as I've added a second image effect). Hope this helps.
     
  11. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Well, I've seen people discuss this as something that happens with the built-in Unity effects when using more than one, so it might not be something I can fix. I've yet to see it render upside down when drawn to the screen, with any screen effects, I've just seen it render upside down to the off screen buffer when looking at it in NVPerfHUD, so seems somehow hardware related.
     
  12. cloud369

    cloud369

    Joined:
    Jul 26, 2009
    Posts:
    5
    I wish I could use this shader. I'm using the free version of Unity3D and all I get is a blur effect that really seem to work.
     
  13. perversonality

    perversonality

    Joined:
    Jan 8, 2010
    Posts:
    57
    I haven't gone pro yet either but thanks for sharing it! Great that so many people are prepared to share their hard work here :)
     
  14. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I'm really excited about using this, but when I choose the menu option to add the component to my camera, I get an all-white screen.

    Am I doing everything correctly?

    Also, the PostProc file is a txt file. Do I need to rename that?

    EDIT: I'm on a Macbook Pro, ATI x1600
     
  15. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Funky. You're likely not doing anything wrong, it's fairly simple to use. As long as you have Unity pro, you should be good. I'd make sure at first that this is the only image effect on the camera. If the web demo works on your machine, but the shader doesn't when applied, then I'm not sure what's up (that's the same thing I used on the demo, except the part of the shader that makes it work on half the screen). You shouldn't need to change the names of any files or anything.
     
  16. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    It looks like I can get the exact same result as not having the effect (i.e. "neutral") when I have the follow Color Correction settings:

    Saturation - [1]
    Add - [0.5]
    Multiply - [-0.5]
    Contrast - [1]

    I don't see any Bloom, though. Fiddling with those settings doesn't do anything.
     
  17. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Does the web player island demo work?

    You could try looking in the REPoseProcessorFinalBlend.shader file, and comment out the line
    Code (csharp):
    1. c=mul(_ColorCorrectionMatrix,c);
    That'll disable the color correction part of the shader. IMO, the color correction is much of what makes the shader cool, so it'd suck to leave it like that, but your results are weird and I'd be interested in what that does. If that fixed it, though, it'd imply the color correction matrix is the problem, and that seems unlikely.

    Also might wanna try building your app and see if it works the same as in the editor, and perhaps test that on another machine.
     
  18. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    Yeah, the island demo works fine. And oddly enough, commenting out that line did not fix anything, even after testing with an executable.
     
  19. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Hmm, that is freaky. Well, you could try applying it to the island demo yourself, that would let you know if there's some weird thing with building it from your machine. If you put it on the island demo, build it, and it works, then that means there's some weird issue with it and your content. Not sure how to help you fix it if that were the case, but it might be useful information.

    Pretty much all I did was load the island demo and smack the processor on the camera, so it'd be a fairly quick test I'd imagine (can't remember if there was already a glow on it, if there was, then I removed it :)).
     
  20. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    Good idea.

    It definitely looks weird on my machine. When I apply the effect, it's very dark and there's no bloom. I have to adjust the CC Multiply to around 5 in order for it to look "normal." And then at specific viewing angles, the screen flashes white/sky blue. I see it happen more often when I walk up the hill toward the peak. Very odd.

    One thing I didn't mention with my own scene is that there's no skybox - just a solid color bg. Not sure if that makes a difference with the alpha channel or what.
     
  21. slaQ

    slaQ

    Joined:
    Feb 21, 2010
    Posts:
    18
    Hey I'm trying to import your package, however when I do so Unity crashes. It happens with my current project as well as with a new project.

    Only thing I can think of that this package was written for 2.6.1 while I have 2.5(something) version.

    Could that be it? or is something else causing the error.

    Thanks in advance.
     
  22. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Certainly could be the problem, I'd try installing the newer version of Unity and trying it out. FYI, I haven't tested it on anything but the newest version of Unity, and don't plan to.
     
  23. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    Will you be updating this for 3.1 at all?
     
  24. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    I have actually updated it and am using it on my TD game (I use it right now along with the Unity bloom one, like the results I get that way), but I have a few things I'd want to check into before updating it. I wasn't sure if anyone was using it, but will update if you like.
     
  25. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    If you would that would be great, I also like the look of things with your post effect shader, and it's handy to have it all in one. Would have replied earlier but just lost an hour playing your defense game, great fun, took me 30 mins to realise I could get envolved with firing the various weapons from first person. Very nice indeed :)
     
  26. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    hey the link is broken... i have basic so i cant download it but i would love to see it!
     
  27. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Thanks. Yea, it's in desperate need of help/training mode, it's very easy to miss out on stuff right now. I've been wanting to get all the nuts and bolts in before doing that, just so I know what features I'm training the user in (I'm cutting a few planned features just because the mechanics will be too dense for a first release), but it's getting close to the time when I'll need it.

    As far as the image effect, I'll likely update in no more than a week, there's really very little I need to do, but just doing other things, and don't wanna be sidetracked ATM. If you need an update and I haven't done it by then, feel free to jab me in a PM or something if I forget :).
     
  28. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Good call, fixed it. Forgot that I'd let the domain expire.
     
  29. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Great! But one problem... my camera got seriously messed up when i added the script to the cam.. im using 3.1 pro
     

    Attached Files:

    • $wtf.JPG
      $wtf.JPG
      File size:
      104.9 KB
      Views:
      1,427
  30. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Looks fine to me :). Yea, I'd just updated the link to the old player, I haven't updated the image effect for 3.x yet, sorry.
     
  31. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    I'd love to see a 3.x version. It's one thing I've been missing since moving to 3.
     
  32. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Are you planning on updating for U3? It would be great if you can, i loved the island demo effects :p
     
  33. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I'd love to see this too please ^_^
     
  34. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Absolutely, sorry guys, I forgot that there might be others using the effect. I'll have an update up soon.
     
  35. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Ok, posted a new version, but did not test it on anything, just exported my version, so let me know if something breaks please, and I'll do what I should have done in the first place :).
     
  36. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    The limited testing I've done so far looks good.
     
  37. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    Thanks RELam works great, felt lost without it :)
     
  38. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    Show Bloom only option flips part of the image.
     
  39. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    So... You're saying I should change the option's name to 'Flip Image'? :)
     
  40. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Sure why not, not many scripts have that feature ;) And im glad you updated for 3.1, i am greatful :D
     
  41. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Well, wouldn't have happened, likely, without SpookyCat, I'd forgotten about everyone but me :(. But anyways, glad you guys are making use of it.
     
  42. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,765
    Maybe 'Flip Some of the Image' :)
     
  43. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    This is absolutely, utterly awesome! x10 RElam is awesome!

    But I get this error
    Assets/RE Assets/PostProcessor/REPostProcessorEffect.cs(527,91): warning CS0168: The variable `v' is declared but never used
    I don't know if I should delete the line it's on or not. All works fine from what I can tell with the error though.

    Also the text file, should that be renamed to something? (again all seems fine with it as a .txt file).
     
  44. APProjects

    APProjects

    Joined:
    Aug 28, 2011
    Posts:
    68
    I just can't say enough thanks for this awesome Image Effect. It is really great, fast, effective, beautiful!
     
  45. WalterEspinar

    WalterEspinar

    Joined:
    Aug 23, 2011
    Posts:
    84
    yes, very good effect!
     
  46. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Wow, thread resurrect. I had actually worked on this effect recently, to take advantage of HDR better, and to add some other improvements. Although I've been really busy with work on a large commercial project, I'll try to get back to this, clean it up, and release it when 3.5 officially drops.

    Here's some shots from my stuff, showing how it tends to feather out nicer without blowing out mid/low range stuff.



     
  47. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Whoa...i know this is kinda off topic, but your terrain texture looks nice...loved the rocks textures dude...especially the third pic
     
  48. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Really looking forward to an updated version of this, although a little confused since 3.5 had already dropped when you wrote your last post.

    Anyways, subscribing to this thread so I know when you release it.
     
  49. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I reckon Unity sometimes dont shout loudly enough on the forum when new versions come out, so people who just come to the forums more often than the main site may take a while to notice new releases.
     
  50. RElam

    RElam

    Joined:
    Nov 16, 2009
    Posts:
    375
    Thanks. Yea, that's actually a bit more than a texture, it's actually a moderately complicated custom terrain shader. I might release that after I finish my game, but it actually requires some other custom tools that are quite a bit more difficult to package up than the post processor.
    Hehe, yet another indicator I've been away from my unity project too long :(.