Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    Maybe try :
    color = tex2D(_ramp,half2(Luminance(tex2D(_mainTexture)),0));
    I didn't tested it but it should work.
     
  2. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    439
    I think all you need to do for the grey scale effect is just this
    Code (JavaScript):
    1. import IndieEffects;
    2. var fxRes : IndieEffects;
    3. private var Mat : Material;
    4. var matShader : Shader;
    5.  
    6. function Start () {
    7.     Mat = new Material(matShader);
    8. }
    9.  
    10. function OnPostRender () {
    11.     Mat.SetTexture("_MainTex", fxRes.RT);
    12.     FullScreenQuad(Mat);
    13. }
    And the shader
    Code (JavaScript):
    1. Shader "IndieEffects/Gray Scale Effect" {
    2.     Properties {
    3.         _MainTex ("Base (RGB)", 2D) = "white" {}
    4.     }
    5.     SubShader {
    6.         Pass {
    7.                 ZTest Always Cull Off ZWrite Off
    8.             Fog { Mode off }
    9.            
    10.         CGPROGRAM
    11.         #pragma vertex vert_img
    12.         #pragma fragment frag
    13.         #pragma fragmentoption ARB_precision_hint_fastest
    14.         #include "UnityCG.cginc"
    15.         uniform sampler2D _MainTex;
    16.         float4 frag (v2f_img i) : COLOR
    17.         {
    18.             float4 original = tex2D(_MainTex, i.uv);
    19.  
    20.             return original.r;
    21.         }
    22.         ENDCG
    23.         }
    24.     }
    25.     Fallback off
    26. }
    27.  
    All you can do to get a simple greyscale image effect is to return red, blue, or green channels of the main render texture since if you return one of them you'll get a greyscale image. Since thats how i would do it.
     
  3. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The gray scale script and shader works (page 11 posts) they are even optimized :) the problem resides in the implementation of the textureRamp.
     
  4. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    That works, but unity has included a built in function to get the grayscale (Luminance)
     
  5. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Glow shader 50% implemented. Please ignore the UI .
     
  6. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    439
    Nice work and i can tell your using my sky, but i don't want to be rude but it looks ugly with the settings you have.
     
  7. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Thanks! Yep, I was going to give you credit that in but internet screwed up and had to go. But here's the sky normally, anyways thanks for that sky its AMAZING:

    EDIT: Night vision COD style!
     
    Last edited: Jul 1, 2014
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    I have a pretty decent computer that can run most games on ultra or high. However, when I'm using these effects on a standalone blank build consisting of 1 cube, a plane, and a standard fps controller, I find it hard to get 15+ fps. Am I doing something wrong, or that the sacrifice I pay for using Unity Indie image effects?

    I'm using Windows 8.1 with the newest version of Unity Indie.
     
  9. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    What's your graphics card, because running Minecraft on full is not anything (no offense, its just not a very graphically intense game)?

    Off topic: Nice job on Unistorm, it really awesome!
     
    Last edited: Jul 1, 2014
  10. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I've got a semi working fast bloom script working, trying to get some parts to work. Here attached is the GLOW effect, it still can be optimized but its nice for things like night vision, death, and just glow awesomeness! Also attached is the Gray Scale effect that has all the pro features implemented except for the darn texture ramp!! :mad: But it's pretty well optimized! :) Enjoy!
     

    Attached Files:

  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    I've played Skyrim and The Elder Scrolls Online all on ultra with no problems. My graphics card is an Nvidia Geforce GTX760 3GB. I seem to have no frame rate problems with Unity even with very dense scene with 1,000,000+ tris and 1,000+ draw calls.

    I'll have to double check to make sure I don't have any settings on that I'm not supposed to while using these effects. I know the documentation states that there are several things I have to disable in order to avoid issues, but I'm pretty sure everything is setup correctly.

    I had some issues with some of the effects where the screen would just turn white when I tried to use them. I'm thinking it could be some type of compatibility issue.

    Thanks, I'm glad you like UniStorm.
     
  12. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I've actually yet to buy and acquire it, but from the demos, friends recommendations and videos it shows extreme promise! Oh wow that graphics card is amazing! I have the imac standard graphics card, which can run indie effects at ~30fps no problem with a 500k tris scene, and ~15fps on a 850K tris scene, both with generally 700 draw calls. It's probably a config issue. Otherwise a driver issue?
     
  13. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    You would need to use the c# version for c# indie fx and js for js Indie effects
     
  14. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    What is your CPU, I think I read earlier in this that indie effects uses your CPU instead of your graphics card.
    Also if you got windows 8.1, you have to reinstall the drivers for your graphics card.
    -hoped that helps
     
    Eric2241 likes this.
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    I have an Intel Core i7-4770 so I don't think it's a lack of CPU. These image effects are the only thing that seem to cause frame rate issues. I'll have to double check my drivers, but I'm pretty sure everything is up to date.

    If I find a solution to the issue I'll be sure to post it here.
     
    Eric2241 likes this.
  16. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    did you download new drivers after installing windows 8.1? also what effects are you using?(depthof feild kills my framerate: 60-70 down to 25-30 add bloom and i manage 18-25)
     
    Last edited: Jul 2, 2014
  17. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    Last edited: Jul 3, 2014
  18. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    439
    You must know that everything is possible, and yeah i notice a lot of you are reporting major performance drops with my bloom effect, I don't have time to optimize it but i hope fuzzy or someone else can come along and optimize the effect.
     
    Eric2241 likes this.
  19. Gogin

    Gogin

    Joined:
    Nov 9, 2013
    Posts:
    60
    Guys? Can I ask about the free volumetric fog?
     
  20. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    There is none...yet
    I'll try to port it!
     
    Last edited: Jul 3, 2014
  21. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I'll take a shot at it. Where's the newest version?

    BTW: I'm porting http://armedunity.com/topic/5774-vintage-post-process/ (willy willy's) vintage effect to indie fx!

    EDIT: DONE!!!

    JS Version:
    Code (csharp):
    1.  
    2. #pragma strict
    3. private var Yellow : Color = Color.yellow;
    4. private var Cyan : Color = Color.cyan;
    5. private var Magenta : Color = Color.magenta;
    6. public var YellowLevel : float = 0.01f;
    7. public var CyanLevel : float = 0.01f;
    8. public var MagentaLevel : float = 0.01f;
    9. public var curShader : Shader;
    10. private var curMaterial : Material;
    11.  
    12. function Start () {
    13.         curMaterial = new Material(curShader);
    14.         curMaterial.SetFloat("_YellowLevel", YellowLevel);
    15.         curMaterial.SetFloat("_CyanLevel", CyanLevel);
    16.         curMaterial.SetFloat("_MagentaLevel", MagentaLevel);
    17.         curMaterial.SetColor("_Yellow", Yellow);
    18.         curMaterial.SetColor("_Cyan", Cyan);
    19.         curMaterial.SetColor("_Magenta", Magenta);
    20. }
    21.  
    22. function OnPostRender () {
    23.         curMaterial.SetTexture("_MainTex", IndieEffects.renderTexture);
    24.         FullScreenQuad(curMaterial);
    25. }
    26.  
    27. function OnDisable(){
    28.     if(curMaterial){
    29.         DestroyImmediate(curMaterial);
    30.     }
    31. }
    32.  
    Files are attached and available for immediate use! :)


    http://i.imgur.com/hZsRzPt.png
     

    Attached Files:

    Last edited: Jul 3, 2014
  22. Gogin

    Gogin

    Joined:
    Nov 9, 2013
    Posts:
    60
    It looks nice, can you add it to 1 folder and write some documentation? I am newbie with shaders and I cant still realize whats going bad :(
     
  23. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    looks great! but will it work with the indie effects' bloom?
     
  24. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    What's going bad, please explain.
     
  25. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    There is supposedly a new bloom coming, but it should.
     
  26. Gogin

    Gogin

    Joined:
    Nov 9, 2013
    Posts:
    60
    I got lots of errors :( Problem where can I put this folder :/ for example Vintage.zip (folder)
     
  27. Seth-McCumber

    Seth-McCumber

    Joined:
    May 26, 2013
    Posts:
    141
    Hey guys. I was wondering if one of you shader geniuses would be able to port this glitch shader(https://github.com/staffantan/unityglitch) to indie effects or make a custom one? I would really like a glitch type effect for my game!

    Thanks, Seth
     
  28. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    8,656
  29. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    You would need to unzip it, then put it in the desired folder; ie: indie effects. And use the C# version of indie effects if you are using the C# version, and JS for the JS version of the effect. Also try the new JS script if you are using JS indie effects.
     
    Last edited: Jul 3, 2014
  30. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Sure I'll try it.


    EDIT: Done!
    http://i.imgur.com/rCmHiKY.png

    It works, but it's not very well optimized, I'll keep trying to optimize it. It was actually quite easy to port so yay! :)



    Files are attached, use the C# version of indie effects for the C# effect, and likewise for the JS version! JS version not included in Glitch Effect.zip and you need the shader from the Glitch Effect.zip
     

    Attached Files:

    Last edited: Jul 4, 2014
  31. Seth-McCumber

    Seth-McCumber

    Joined:
    May 26, 2013
    Posts:
    141
    Thanks!
     
  32. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    No problem!
     
  33. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642

    Attached Files:

  34. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642

    Attached Files:

  35. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Gray Scale Effect now with more control! It allows for control of the separate color channels (R,G,B)!

    Enjoy! :)
     

    Attached Files:

  36. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34

    Looks great!, however this is giving me a white screen although im not using dx11 and linear. Please help!
    also if you can tell me whats going wrong for the ssao script in indie effects i had it working before but now the ao is not being applied to the scene when the corrects depth and regular textures are being made.
    -thank you
     
  37. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Well for my effect you would need to use the c# indie effects base for C sharp scripts. And likewise for js. I haven't tried ssao so idk about that, sorry.
     
  38. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    439
    Nice work @Eric2241 , your on a roll like i was. Porting the image effects are easy right? lol all you have to do is just assign the render textures and values. thats how i managed to port them so fast.
     
    Eric2241 likes this.
  39. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Yep, I'm currently taking on a bigger task of porting a HDR shader into unity. It
    was from the same site willy willy got some of his.
     
  40. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,869
    Um frosty, there is a reason why those two lines are there! it is to STOP C# CLASSES CONFLICTING WITH JS ONES! :mad:

    So unless the user wishes, please keep those lines okay? I will file a bug report for this, as all those two lines should do is keep the pack organized, not slow it down!

    EDIT: OMG! Too many posts! :eek:

    Anyway... nice work Eric! BTW, i actually have a chromatic radial blur already coming! and it runs at nearly 70fps! basically, it is vignetting, chromatic abberation, and radial blur all combined together in one.

    and good luck with HDR! :)
     
    Last edited: Jul 5, 2014
    Eric2241 likes this.
  41. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,869
    Hi everyone, for all to hear:

    I have a request for everyone: once you have done your fx ports, don't port anymore until further notice. that way I can gather them together without having to chase down so many new posts! :eek: It also means that the docs will be more accurate once I have them ready.

    so please, if you want somethign ported, please wait till the new release is out. for those in the middle of porting, keep going, but don't port any more shaders till I say so!

    This is basically so I can gather the fx up for final release without having to worry about too many to manage! :)
     
  42. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Oh wow! 70fps nice! And thanks, the shader for HDR currently has errors, I'm pretty sure I can fix them, then the scripting is the easy part.
     
  43. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    Will the final realease of indie effects have a better ssao because im having trouble with yours. it creates and updates the correct depth and regular textures but doesn't seem to actually render the final image onto the screen although it was working before. Also can you include more textures for vignetting. Also cant wait to see the new bloom in the final release!
     
  44. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    I think the final release will use my ssao, so it will look good :)
    The actual ssao doesn't works (on the first post).
     
  45. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    k, thanks! for some reason it was working though then it stopped. anyways can you link me your ssao?
    -thanks
     
  46. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Code (csharp):
    1.  
    2. Shader "Custom/HDR" {
    3.     Properties {
    4.         _MainTex ("Base (RGB)", 2D) = "white" {}
    5.     }
    6.     SubShader {
    7.        
    8.        
    9.         CGPROGRAM
    10.         #pragma vertex vert_img
    11.         #pragma fragment frag
    12.         #include "UnityCG.cginc"
    13.        
    14.         uniform sampler2D _MainTex;
    15.         uniform float radius1;
    16.         uniform float radius2;
    17.         float4 frag(v2f_img i) : COLOR
    18.         {
    19.             float4 s0;
    20.             float4 screen = tex2D(_MainTex, i.uv);
    21.             float3 c_center = s0(s0, screen).rgb; //reuse SMAA center sample or lumasharpen center sample?
    22.         //float3 c_center = colorInput.rgb; //or just the input?
    23.    
    24.         //float3 bloom_sum1 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that
    25.         //float3 bloom_sum2 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that
    26.         //_MainTex += float2(0, 0); // +0 ? .. oh riiiight - that will surely do something useful
    27.    
    28.         float radius1 = 0.793;
    29.         float radius2 = 0.793;
    30.         float bloom_sum1 = _MainTex( screen + float2(1.5, -1.5) * radius1).rgb;
    31.         bloom_sum1 += _MainTex(screen + float2(-1.5, -1.5) * radius1).rgb; //rearrange sample order to minimize ALU and maximize cache usage
    32.         bloom_sum1 += _MainTex( screen + float2(1.5, 1.5) * radius1).rgb;
    33.         bloom_sum1 += _MainTex( screen + float2(-1.5, 1.5) * radius1).rgb;
    34.    
    35.         bloom_sum1 += _MainTex( screen + float2(0, -2.5) * radius1).rgb;
    36.         bloom_sum1 += _MainTex( screen + float2(0, 2.5) * radius1).rgb;
    37.         bloom_sum1 += _MainTex( screen + float2(-2.5, 0) * radius1).rgb;
    38.         bloom_sum1 += _MainTex( screen + float2(2.5, 0) * radius1).rgb;
    39.    
    40.         bloom_sum1 *= 0.005;
    41.    
    42.         float bloom_sum2 = _MainTex(screen + float2(1.5, -1.5) * radius2).rgb;
    43.         bloom_sum2 += _MainTex( screen + float2(-1.5, -1.5) * radius2).rgb;
    44.         bloom_sum2 += _MainTex( screen + float2(1.5, 1.5) * radius2).rgb;
    45.         bloom_sum2 += _MainTex( screen + float2(-1.5, 1.5) * radius2).rgb;
    46.  
    47.  
    48.         bloom_sum2 += _MainTex( screen + float2(0, -2.5) * radius2).rgb;  
    49.         bloom_sum2 += _MainTex( screen + float2(0, 2.5) * radius2).rgb;
    50.         bloom_sum2 += _MainTex( screen + float2(-2.5, 0) * radius2).rgb;
    51.         bloom_sum2 += _MainTex( screen + float2(2.5, 0) * radius2).rgb;
    52.  
    53.         bloom_sum2 *= 0.010;
    54.    
    55.         float dist = radius2 - radius1;
    56.    
    57.         float3 HDR = (c_center + (bloom_sum2 - bloom_sum1)) * dist;
    58.         float3 blend = HDR + screen.rgb;
    59.         renderTex.rgb = HDR + pow(blend, HDRPower); // pow - don't use fractions for HDRpower
    60.    
    61.         return saturate(renderTex);
    62.            
    63.            
    64.            
    65.         }
    66.         ENDCG
    67.     }
    68.     FallBack "Diffuse"
    69. }
    70.  
    Does this give anyone errors?

    BTW: I have 3 more effects done!
     
  47. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    The new version is due to come out very soon, just be patient.
     
  48. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Does anyone need a depth of field effect? Also recently I've been noticing a hdr like effect with most every image effect with indie effects. Does anyone else notice this?
     
  49. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    I would love a new depth of field effect. one thing I would like out of this is both near and far depth.
    also see if you can make it less power hungry than fuzzys dof.
    -thanks
     
  50. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Well each script is essentially the same, except for the shader specific modifications, that means that fuzzy or anyone needs to optimize the actual base, or one needs to get an optimized shader. This can result in more fps. I'll try to port the pro dof, if I can't I'll try to find another shader. But I can't guarantee a less power hungry version.

    I also made a logo for this project! I hope you guys like it! :):):):D:D:D
     
    Last edited: Jul 6, 2014
    red2blue likes this.
unityunity