Search Unity

IndieEffects: Bringing (almost) AAA quality Post-Process FX to Unity Indie

Discussion in 'Assets and Asset Store' started by FuzzyQuills, Sep 2, 2013.

  1. mlhornbo

    mlhornbo

    Joined:
    May 17, 2014
    Posts:
    24
    Thank you for your help. I'm still kind of new to using and modifying Unity scripts, so I didn't think of that, but it makes sense in retrospect.
     
  2. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    You're welcome!
     
  3. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Cyrien, I got DoF working again. turns out Linear01Depth did work, but for the lerp to properly show depth, I basically did this:
    Code (csharp):
    1.  
    2. >>decoding done first. done using DecodeDepthNormal
    3. <depth variable> *= _ProjectionParams.z;
    4. Linear01Depth(<depth variable>)
    5. <depth variable> /= <f-stop variable>;
    6.  
    That was all it took, and I ended up fixing both the depth problems AND the f-stop! (When i added the lerping a while back, it broke the _FStop variable, reducing flexibility. it was unwittingly fixed in this code!)

    Here is the result. (this uses the new depth tex!)
    IndieFxScreenshot.png
    That is all for now. If you recognize the test scene, that would be because I used a modified version of Russian Madman's SSAO example scene for this, back when I was looking for a way to do SSAO.

    Unfortunately, I can't say the same for 0tacun's motion blur, which is the worst affected of the lot. The camera motion blur is completely broken!
     
    Eric2241 likes this.
  4. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    0tacun's motion blur ? He successfuly implemented pixel motion blur with velocity map o_O ? If yes, pretty awesome !
     
  5. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    No, the original script used my original shader, and your new one broke it. i even tried Linear01Depth, but whatever it's returning mustn't be in range 0..1, which is what it uses. (I also tried COMPUTE_EYEDEPTH, but it didn't work... :/)

    I also tried using the Normals as a way of detecting velocity changes, but it doesn't seem to store the previous texture properly... :(
     
  6. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    @Cyrien5100: http://forum.unity3d.com/threads/epic-radial-blur-effect-for-unity-indie.198568/page-15 here you can find the script, it uses the old depth texture.

    @FuzzyQuills: Hmm if I find some time I'll check into camera motion blur. By the way, Fuzzy, as I can see we all have some trouble with merging our different approuches and effects and there are so many version out, what about setting this project up in GitHUB? So everyone could clearly work together on the package and it increases the consistancy and eliminates the confusion.
     
  7. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Is there any quick setup for the SSAO effect? I mean that I get pink screen when I assign ShaderAO slot with SSAOtest -shader. also when trying to use Bunell Disk SSAO I get pink screen when assigning Bunell Disk SSAO to Shader AO -slot. I followed documentation's instructions and here is screenshot about Bunell Disk SSAO -setup.
    https://www.dropbox.com/s/0tmyaohf1879uaw/ssao_unityfree.jpg

    I feel very dumb and I don't know how to debug this kinda stuff...
     
  8. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    You have to put the blur shader in IndieEffects (In Indie effects scrpit, the blur shader is empty)
     
  9. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    I tried it now but it makes no difference, does it matter running on directx11 ?
     
  10. Barry_Evans

    Barry_Evans

    Joined:
    Dec 23, 2013
    Posts:
    7
    im having the same issue. i think this happened right after i updated unity but im not sure. all of my settings are correct but im just getting a pink screen.
     
  11. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Yeah forgot to add that I'm running 4.5.0f6
     
  12. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Hi guys, I have been made aware of a weird problem in Unity 4.5, where the correct settings produce a pink screen. I am hopefully going to have a new release out soon that will fix this problem. (the new release was made in 4.5, and works a charm!) I am also planning on using a .zip file to make the project portable so devs using older versions can still use this a-ok!

    @0tacun: I was actually thinking about that... And in that case, once the new release is out, I may consider opening a git hub portal for you guys so you can present your epic works!

    Typed from my pendo pad.
     
  13. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    My SSAO effect should work in Unity 4.5. But it doesn't works with DX11 (with Free version, you'll rarely need it).
     
  14. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    How come? I had no idea. maybe half of these guys are trying to use DX11!
     
  15. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    It's because i have this error :
    Shader error in 'Hidden/Bunell Disk SSAO': syntax error: unexpected token 'snorm' at line 97
    In this part :
    Code (CSharp):
    1.  
    2. float aoFF(in half3 ddiff, in half3 cnorm, in float c1, in float c2, in float2 uv)
    3.             {
    4.              half3 vv = normalize(ddiff);
    5.              float rd = length(ddiff);
    6.              half3 snorm = readDepthNormal(uv+half2(c1,c2)).xyz;
    7.              if (dot(snorm,cnorm)>_selfOcclusion){return 0;}
    8.              else{
    9.              return clamp(1.0-dot(snorm,-vv),0.0,1.0) * clamp(dot( cnorm,vv )-_Bias,0.0,1.0)*(1.0 - 1.0/sqrt(1.0/(rd*rd*_scale) + 1.0));}
    10.             }
    and it says the dot product is incorrect :
    Shader error in 'Hidden/Bunell Disk SSAO': 'dot': no matching 0 parameter intrinsic function; Possible intrinsic functions are: dot(floatM|halfM|doubleM|min10floatM|min16floatM|intM|uintM|min12intM|min16intM|min16uintM, floatM|halfM|doubleM|min10floatM|min16floatM|intM|uintM|min12intM|min16intM|min16uintM) at line 98

    And i have them only with DX11 compiler.

    But i really don't know why...
     
  16. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    WTF?! I might have to test this!

    Firstly, what's your video card?

    EDIT: I forgot to show you, here's the upcoming BLOOM EFFECT! written by me, from scratch:
    BloomScreen.png
    There you go. the most gorgeous bloom you will see in Unity free. I am hoping to make it coloured... :)

    EDIT2: OK, happens here too. Might have to only compile to D3D10.
     
    Last edited: Jun 10, 2014
  17. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Great looking bloom. Is the performance different with the new bloom?
     
  18. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Not really much difference, might be slightly lower as I used a second tex for the luminance mask.

    EDIT: Another Bloom test. I improved the blurring, and it looks AWESOME:
    BloomScreen.png
     
    Last edited: Jun 10, 2014
  19. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    It does look awesome:). Is the second tex scaled down or the same as the screen resolution?
     
  20. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Does look awesome!
     
  21. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @Baldinoboy: I can have the tex scale down if you like, but at the moment, it's at full res

    @Eric2241: Thanks! Hopefully, once I update the docs, (and update the blur algorithms in the other shaders) I will finally have a new release out!
     
  22. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    I like it at full res but my computer does not:(. Is there a way to put an option for the res. Like 1 for 100% the screens res and .5 for 50%, which is probably what I would have to use. Can not wait to try out the new bloom. So do not worry about the res now. Want to get my hands on it now:D.
     
  23. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Fair enough. What's your laptop specs again? I kinda forgot... :rolleyes:

    Anyway, all I remember is that it was an AMD machine. And i was considering a texture scale-down option for both the bloom and the pack in general. I also have to work on the stacking.
     
  24. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Here's another screen of the new Depth Of Field using the new blurring algorithm I developed:

    DOFSmooth.png
    And another of the Chromatic Aberration Color-fringing effect:

    ChromaticAberration.png
    If you wish to give feedback, feel free to do so!
     
  25. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    It is a desktop. Never could get a laptop that lasted:(.

    AMD Quad-Core 2.5GHz
    4.00GB Ram
    AMD 6670 1Gb

    It is a good pc but it is getting older. the ram is what kills me. It is DDR2 so I can not go over 4GB. I can run Far Cry 3 in ultra 1080p with 30 fps but a mild scene in Unity I get 30 fpso_O. When I use any effects it goes down to 10-12 fps. The texture scale down will help a lot.

    The new images look awesome. The Chromatic Aberration Color-fringing effect is epic:).
     
  26. hexicCore

    hexicCore

    Joined:
    May 4, 2014
    Posts:
    11
    I have spent nearly 2 months trying to get some form of god rays working, to no avail. Any chance you could put this high up on your things to do list?

    By the way, thank you for all of your efforts. Without you, poor devs like me would be making significantly less attractive games.
     
  27. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @hexicCore: dude, you are in luck, i have been considering a new godrays/lightshafts shader for a while, as the current one isn't true god rays. And I might actually put off release just for your sake... How 'bout that? :)

    @Baldinoboy: In this case, your bottleneck is the RAM. that is a real shame! I will definitely add texture scale-down now.
     
  28. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Awesome about the lightshafts idea. That is my favorite effect and anything about it makes me happy:D.

    I agree about the RAM. It works for now. Will build a new computer within the next year. With :eek:128 GB of DDR9 RAM. Okay maybe not that much or that gen;).
     
  29. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    We wish... ;) Anyone know how to get screen space light position? this is the only thing spoiling my determination...
     
  30. hexicCore

    hexicCore

    Joined:
    May 4, 2014
    Posts:
    11
  31. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I did mean how to get it in the shader, not from script. BTW, I actually did find something on how to get screen position in a shader, so let's see what happens... ;)
     
  32. hexicCore

    hexicCore

    Joined:
    May 4, 2014
    Posts:
    11
    I knew that. I was just testing you. Good job. :D
     
    Eric2241 likes this.
  33. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    Hey FuzzyQuills, I have a question.
    If I made an image effect that has a shader that uses 2 functions, for example a blur and a downsample. how would i call those functions or passes and use them in the script?

    example from a script a friend of mine made.

    //calling the shader function or pass from the shader.
    void Downsample(RenderTexture source) {

    //and the function from within the shader
    float4Downsample(v2f_imgi) : COLOR

    //or the pass
    Pass
    {
    Name"Downsample"

    CGPROGRAM
    #pragmafragmentoptionARB_precision_hint_fastest
    #pragmavertexvert_img
    #pragmafragmentDownsample
    ENDCG
    }

    How can i call those functions from the script?
     
    Last edited: Jun 16, 2014
  34. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @FrostBite23: try this:
    Code (csharp):
    1.  
    2. //define your variables here
    3. var shader : Shader;
    4. var mat : Material;
    5. function Start () {
    6. mat = new Material(shader);
    7. }
    8.  
    9. function OnPostRender () {
    10. mat.SetTexture(<your main texture in the shader>, renderTexture);
    11.  
    12. //for low-level render control, use this:
    13. FullScreenQuadPass(mat, <shader pass index>);
    14. //if all you need to do for fx shader is to show the effect, use this:
    15. FullScreenQuad(mat);
    16. }
    17.  
    For performance reasons, all rendering has to be called in OnPreCull or OnPostRender. (OnPreCull I usually use for capturing buffers such as depth textures, as at this stage of rendering, the image isn't drawn yet).

    There you go. hope this helps. this code is designed for indie effects. if you're trying to implement a pro image effect, I actually have no idea how to do it! I don't have pro, One thing I recommend is to import the Unity Blur effect from the image effects package and have a look at the code. one crucial function is the unity equivalent to FullScreenQuad, and that's Graphics.Blit. take a look at the docs, they will help you.

    Happy coding.

    -FuzzyQuills

    EDIT: Updated post, as it looks like you are trying to use pro image effects!
     
  35. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    ah no I'm not using any pro image effects, since I have some free time I'm making an image effect with this package.
    But thanks

    EDIT:
    Ok I'm having a bit of trouble can you maybe show a shader and a script example, lol sorry your script example is helping me but I'm trying to see how you would do it. so if i were going to grab a pass i would just do this
    FullScreenQuadPass(bloomMat, 0);

    and that will get my first pass? if so than how can i get 3 or more?

    EDIT: ok i tried it but it still isn't working, ill post the script here

    Code (JavaScript):
    1. #pragma strict
    2.  
    3. @script RequireComponent (IndieEffects)
    4. @script AddComponentMenu ("Indie Effects/Bloom")
    5. import IndieEffects;
    6.  
    7. private var bloomMat : Material;
    8. var bloomShader : Shader;
    9. @range(0,10)
    10. var intensity : float;
    11. @range(0,1)
    12. var threshold : float;
    13. @range(0,0.3)
    14. var radius : float;
    15. @Range(0, 2)
    16. var downsample : int = 1;
    17.    
    18. function Start () {
    19.     bloomMat = new Material(bloomShader);
    20. }
    21.  
    22. function Update () {
    23.     bloomMat.SetTexture("_MainTex", renderTexture);
    24.     bloomMat.SetFloat("_Amount", intensity);
    25.     bloomMat.SetFloat("_Threshold", threshold);
    26.     bloomMat.SetFloat("_Radius", radius);
    27. }
    28.  
    29. function OnPostRender () {
    30.     bloomMat.SetTexture("_MainTex", renderTexture);
    31.     //var rtW : int = renderTexture.width >> downsample;
    32.     //var rtH : int = renderTexture.height >> downsample;
    33.     FullScreenQuadPass(bloomMat, 0);
    34.     FullScreenQuadPass(bloomMat, 1);
    35.     FullScreenQuadPass(bloomMat, 2);
    36.     FullScreenQuad(bloomMat);
    37. }
     
    Last edited: Jun 16, 2014
  36. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    You are welcome. I also am here to tell you, we have a problem...

    Someone is attempting to make a mobile-friendly version of my fx pack! it turns out Cyrien5100 cheated on this thread and has gotten away with what I think is another version of my fx pack, renamed to FX4indie, and includes screen-space GI! Ugh! (And i was seriously looking for a way to do that... :eek:) HE ALSO MANAGED TO FIX THE CAMERA MOTION BLUR 0TACUN MADE!!!! :mad:

    The only difference is that he attempted to make it harder to write fx for it, so I guess it isn't a complete clone... :cool:

    I opened a conversation on this, so feel free to PM me.

    -FuzzyQuills.

    EDIT: This might also mean I may have to rush this next release to blow Cyrien out of the water! o_O
     
    Eric2241 likes this.
  37. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    ah yes, the old fashion competition. thats is what todays days is full of. don't worry, at least yours is free and he is selling his for money so you have an advantage there, on the other hand after my first custom image effect made with this package is working, then i will have a a bunch of surprises to show and give out. :D
     
  38. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Good plan! I will be sticking to Indie Effects!
     
  39. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I have seen your work enough, FrostBite! If you ahve more goodies... GIVE MEEE! :D

    Just kidding. But if you wish to show off anything, go ahead! :)
     
  40. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    yes but before i do i need to resolve this problem. if you want to help, have a look at my post (4 posts above this one)
     
  41. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @hexicCore: Still have your recent attempts to get God Rays working? I may need them, I can help write it.

    @Frostbite23: Oh... you need help with it. Give me your current code, and I will fix it up and re-post it for you! :)

    I also re-read your post and noticed you are trying to downsample the Tex. I usually don't do this for blurring shaders. Please correct me if I am wrong though! :)
     
  42. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @Frostbite23: the screenshot as promised:

    NewBlurFrostBite23.png
    All I have to say about the shader is... well done.
     
  43. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
  44. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I actually gave that a read at some point. And my blur shaders are improving, you probably got my older version with the crap "four-point-star" blurring my older shaders used.
     
  45. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    My Custom Bloom Image Effect With Bungie Bloom Curve!
    Features

    Threshold
    Intensity
    BloomColor
    Radius
    And More!

    Without
    https://www.dropbox.com/s/gult3zrccpfmiah/Screenshot 2014-06-15 21.54.54.png
    With
    https://www.dropbox.com/s/ufpd9rwl1kcdbs5/Screenshot 2014-06-15 21.55.22.png
    And with my little treat, Dirty Lens Bloom!
    https://www.dropbox.com/s/4dh75b5clfzotj8/Screenshot 2014-06-15 21.58.13.png
    All 100% Unity Indie, and is now in your hands
    https://www.dropbox.com/s/wpicufwis6o1p7y/IndieBloom.unitypackage

    IMPORTANT: Do not use the lens texture for commercial use.

    Warning: This asset is performance hungry (on my iMac i have a AMD Radeon 5670 512MB, Fps drops from around 50 - 100 from 10 - 20fps, i am attempting to improve performance with this asset so it can run well on low hardware.

    References
    http://digitalerr0r.wordpress.com/2009/10/04/xna-shader-programming-tutorial-24-bloom/
    http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
     
    Last edited: Jun 18, 2014
  46. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    YESSSS!

    BTW, Just letting you know, the next release eliminates extensions, and packs ALL texture generators in the same script. there are a few API changes too, and will be explained in the docs.

    EDIT: Why did you include the "IndieEffects" class? it just overwrote my new one... :(
     
    Last edited: Jun 16, 2014
  47. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    oh lol, sorry lol i thought it had to be included in the package in order for the bloom to work. next time just look more carefully when importing the package
     
  48. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    yea... I do that a lot! :)

    I also managed to re-write it in no time at all, so no problem there.
     
    Last edited: Jun 16, 2014
  49. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Does that Dirty Lens Bloom really work in Unity indie?
     
  50. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I will have to mod the script to take the other shader so I can test this... Actually, the .unitypackage has a modded bloom.js that might work. Perhaps you, frostbite, could help us? (if the bloom.js is indeed the dirty lens blur, please rename it, as it overwrote my default bloom on import)

    BTW, Frosty PMed me several screens from the unity free editor on his mac, so if you need proof, I have it! :)