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

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    Problem with Asset Store publishing is that it takes forever to update. So if it is a free asset it is just a waste of time to put in on the asset store. GitHub or just posting a .unitypackage is the best option.
     
  2. mitchtheriault

    mitchtheriault

    Joined:
    Aug 4, 2013
    Posts:
    26
    This is just so handy
     
  3. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @mitchtheriault: How does this work for you? Like to hear how you use this! :)
     
  4. kaarme

    kaarme

    Joined:
    May 1, 2014
    Posts:
    177
    My gui disappears with this.
     
  5. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    It does? Give me a look at it! :D

    Actually... if the GUI script isn't attached to your camera, that might cause render order problems, so try placing your GUI script after the indie effects one on your main camera.

    Or you could download the github version: it was given the ability to use the old texture system, of which worked flawlessly with GUI elements.
     
    Last edited: Aug 29, 2014
  6. kaarme

    kaarme

    Joined:
    May 1, 2014
    Posts:
    177
    Didn't work. I it's part of RTP 3 so I can't show.
     
  7. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Why? You don' t need to give us the files but just the screenshot.
     
  8. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    What's RTP3? (Please don't kill me for this one... :D :eek:)

    And I am surprised the GitHub version didn't work. did you make sure to enable the old texture system option? o_O

    @Eric2241: Have any of you actually tested 0tacun's contrbution? I smell a rat... :D
     
  9. kaarme

    kaarme

    Joined:
    May 1, 2014
    Posts:
    177
    Last edited: Aug 30, 2014
  10. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Heh... :D well, you could try changing the texture size to 256 (or 512, for sharper image) to start with! ;)

    And I am surprised I didn't pick up that acronym straight away! :) I have definitely heard of the Relief terrain pack! ;)
     
  11. Berenger

    Berenger

    Joined:
    Jul 11, 2012
    Posts:
    78
    You are using the new UI system of 4.6 right ? Looks like the canvas is being drawn before the monobehaviour OnPostRender function, so indie effect is drawing on top of the UI, whereas the GUI.Label stuff is still drawn after. That's problematic.
     
  12. kaarme

    kaarme

    Joined:
    May 1, 2014
    Posts:
    177
    I am not using 4.6.
     
  13. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    No, haven't gotten the time yet, though I believe he should have tested it. Sorry. :(
     
  14. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Wait, 4.6 is out?
     
  15. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @Berenger: We will probably have to wait another month for 4.6 to be out. So no new GUI. Yet... :D

    @Eric2241: don't feel too bad, the truth is, I should have tested it, but being a Yr11 student... :D
     
    Last edited: Aug 31, 2014
  16. Berenger

    Berenger

    Joined:
    Jul 11, 2012
    Posts:
    78
  17. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Yeah school is the top priority, my school starts on 9/3. I'll be going in the 9th grade in USA.
     
  18. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    Ha. I am like that too. They are popping out so fast it is scary. I have not downloaded the beta. Am going to wait to download the real thing.
     
  19. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    High School. Cool man. Do you think you will still be able to have time to work on your game?
     
  20. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Maybe, though i'm supposed to have 5+ hours of hw per night, of course I also have bunch of extra-curricular activities. Which should take me to about 11pm which will be the estimated sleep time. So dev will definitely be MUCH slower.
     
  21. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    Im already in school:( and in 9th grade. And so far I have only had at least 1-2 hours to work on my game.
     
  22. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    That stinks.
     
  23. yellowelephant

    yellowelephant

    Joined:
    Aug 7, 2014
    Posts:
    7
    Do you think it is possible to port this glitch shader (https://github.com/staffantan/unityglitch) to indie ?
    I'm not a coder and I don't fully understand what exactly is going on in the code, so I wonder if it would be even possible to port the shader ?
     
  24. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I've ported that over to indie effects on page 13-14.
     
  25. yellowelephant

    yellowelephant

    Joined:
    Aug 7, 2014
    Posts:
    7
    Wow, thank you very much!
    I'm going to check it out asap :)
     
  26. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    No problem.
     
  27. VGViddy

    VGViddy

    Joined:
    Sep 1, 2014
    Posts:
    1
    I can't seem to get any of this to work. My screen either turns completely green or gray when I activate any of the effects, except for AA and motion blur, which both just makes it laggy.
     
  28. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Motion blur... is actually broken at the moment... Unless 0tacun's recent pull request fixed that.

    either way, a grey screen is a sign you didn't set the texture size to something above 0x0. (Wait, another person with this problem?!) try setting the texture size to something like 256x256. highest to work with, unless you have a HD screen, is 512x512. (full HD, theoretically, could use 1024x1024, but that would also be very laggy... ;))

    Also, another thing to check: did you make sure to add the base script?
     
    thetoxicuser and Eric2241 like this.
  29. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    I don't remember where it was, but I remember seeing a comment about someone who uses linux with unity. I just got a new computer that is using linux and was wondering if unity works with it.
     
  30. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @thetoxicuser: Actually, whoever was using Unity with Linux was probably using WINE, which is the little compatibility layer you can install to run windows apps, of which most work ok, except for some recent software, such as Office 2013.

    So if you just got a linux lappy, well done! I suggest giving WINE a try with Unity, if you wish to develop games with it. Of course, once UT turn their attention to a linux editor... ;)

    Which linux do you use? I can help with some things, since I use Linux on my Dell Mini 9, and know my way round a bit. :)

    2017 edit: For quite some time now, there has been a Linux Editor build! It is in the experimental features section as far as I know
     
    Last edited: Apr 6, 2017
  31. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Yeah, crossover is the better more polished Wine, I would highly recommend it. Though I am an advocate through the advocate program so I do get it for free so I may be a little biased
     
  32. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @Eric2241: And what's the bet CodeWeavers got all the info to code Crossover properly from Microsoft... That would explain why it's a paid product! ;)
     
  33. mightybob

    mightybob

    Joined:
    Mar 23, 2014
    Posts:
    75
    Hey, thanks so much for all this awesome stuff, but when I import your package your scripts they have loads of errors. One of them being about the rootBone. Any idea why its doing this?
     
  34. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    I'm using linux mint: http://www.linuxmint.com/download.php

    and my sister somehow managed to delete windows off her laptop and gave it to me so i just decided to try linux and it worked. my high school lets us use laptops and tablets in the library so I thought I could use unity and blender on it just to work on my game.
    thanks for replying quickly.
     
  35. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @thetoxicuser: Well, unlike Unity, Blender works fine on Linux, they have a Linux version. You can install it from your package manager, or directly unzip a .gz from the website. And your sister wiping laptops... Tsk, Tsk! ;)

    As for Unity, Like I said last post, see how it performs in WINE, and if you can dev projects like a boss, go for it! :)

    @mightybob: Hi there. you say there's a problem with rootBone? please show me your setup! :)

    And that error might actually be your project, not this pack.

    EDIT: HANG ON! Go to the scripts folder, and delete the folder inside. (It's probably named "per-object blur" or something like that) that's where the "rootBone" error is coming from! After deleting this, it should work! That folder is for when I finally implement a proper motion vector map shader.
     
    Last edited: Sep 5, 2014
  36. mightybob

    mightybob

    Joined:
    Mar 23, 2014
    Posts:
    75
    Thank you @FuzzyQuills, I will try that :)
    Also, I am certain it is not coming from my project because I am using your Test Scene.
     
  37. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Oh, really? I had no idea! :D

    If something still doesn't work, do a full screen capture of Unity, so I can check over the window to further diagnose further problems. basically, have the inspector, the game tab actively running the game, and the console window all open at the same time before doing a screen capture. This way, I have enough info to go on, should I need to. ;)
     
  38. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    Can i ask why did you make the render texture be square? i modified it to use Width and height according to a resolution scale float ranging from 0 to 1 and round it's product , and it works fine with no performance drop :)
     
  39. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    I did it to try and maximise performance, as using NPOT textures has some overhead.

    Perhpas you can demonstrate your findings to me? Any way to boost performance on a range of machines is acceptable, and of course, the best way to go. ;)

    A script example would also be nice. atm, I have the old "directly capture the screen" system, (resurrected byn 0tacun! :D) along with the square texture system, and I can also add yours if you can give me some demonstration code. :)
     
  40. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    I Get 30 FPS using 0.6 Resolution Scale , the 1X Resolution is 1054X614 , so it renders at 632X368 (30K pixels less than 512²) , and 28 FPS using 512X512 , yet the 632X368 looks better , i think it's because it fits the aspect ratio , anyway
    here's what i did
    (i use c# , i'll send u the code if you want)
    first add an int that is named TextureSizeW
    and add a float called Resolution Scale and make it a range between 0 and 1
    Add an awake void and add this :
    Code (CSharp):
    1. if (ResolutionScale > 0)
    2.         {
    3.             textureSizeW = Mathf.RoundToInt((Screen.width * ResolutionScale));
    4.             textureSize = Mathf.RoundToInt((Screen.height * ResolutionScale));
    5.         }
    then simply go to all functions that use textureSize and make the width textureSizeW
     
  41. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    by the way the scene has 1116 Drawcalls , in case you wanted to know ^_^
     
  42. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    A Comparison between both (ignore the framerate in the 512² picture , it's 28 FPS but the snipping tool lowered it)
    http://imgur.com/a/R1z81
     
  43. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @TrollHachem: Interesting... :)

    BTW, I need you to upload to different host, as School blocks imgur.com! :(
     
  44. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Also, try sending me your screen capture code, as I don't know if you are using old method, or new method! :)

    C# is okay, I can understand it enough to convert to JS.
     
  45. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Huh, the performace actually isn't bad! I am surprised this works! :)

    I did realise I should probably optimize the script, as the script takes 13 milliseconds to execute.
     
  46. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    i think that the NPOT textures only have a performance impact on the GPU , which currently isn't the problem
    anyway , here's the full script :
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. /*
    5. ----------Indie Effects Base----------
    6. This is the base for all other image effects to occur. Includes depth texture generation
    7. */
    8.  
    9. /*[RequireComponent(typeof(Camera))]
    10. [AddComponentMenu("Indie Effects/IndieEffectsBase C#")]*/
    11. public class IndieEffects : MonoBehaviour
    12. {
    13.     //base effects
    14.     [HideInInspector]
    15.     public Texture2D RT;
    16.     [Range(0f, 1f)]
    17.     public float ResolutionScale = 0;
    18.     public int textureSizeW;
    19.     public int textureSize;
    20.     public bool capture;
    21.     public Shader DepthShader;
    22.     public Texture2D DNBuffer;
    23.     public bool DNRequire;
    24.     public GameObject DepthCam;
    25.     [Range(0f, 0.04f)]
    26.     public float latency;
    27.  
    28.     public bool useOldVersion; //enable old rendering method
    29.     public Camera myCamera; //cache camera and transform component for
    30.     private Transform myTransform; //performance
    31.  
    32.     void Awake()
    33.     {
    34.         if (ResolutionScale > 0)
    35.         {
    36.             textureSizeW = Mathf.RoundToInt((Screen.width * ResolutionScale));
    37.             textureSize = Mathf.RoundToInt((Screen.height * ResolutionScale));
    38.         }
    39.     }
    40.  
    41.     public static void FullScreenQuad(Material renderMat)
    42.     {
    43.         GL.PushMatrix();
    44.         for (var i = 0; i < renderMat.passCount; ++i)
    45.         {
    46.             renderMat.SetPass(i);
    47.  
    48.             GL.LoadOrtho();
    49.             GL.Begin(GL.QUADS); // Quad
    50.             GL.Color(new Color(1f, 1f, 1f, 1f));
    51.             GL.MultiTexCoord(0, new Vector3(0f, 0f, 0f));
    52.             GL.Vertex3(0,0,0);
    53.             GL.MultiTexCoord(0, new Vector3(0f, 1f, 0f));
    54.             GL.Vertex3(0,1,0);
    55.             GL.MultiTexCoord(0, new Vector3(1f, 1f, 0f));
    56.             GL.Vertex3(1,1,0);
    57.             GL.MultiTexCoord(0, new Vector3(1f, 0f, 0f));
    58.             GL.Vertex3(1,0,0);
    59.             GL.End();
    60.         }
    61.         GL.PopMatrix();
    62.     }
    63.    
    64.     public static void FullScreenQuad(Material renderMat, int pass)
    65.     {
    66.         GL.PushMatrix();
    67.         for (var i = 0; i < pass; ++i) {
    68.             renderMat.SetPass(i);
    69.             GL.LoadOrtho();
    70.             GL.Begin(GL.QUADS); // Quad
    71.             GL.Color(new Color(1f, 1f, 1f, 1f));
    72.             GL.MultiTexCoord(0, new Vector3(0f, 0f, 0f));
    73.             GL.Vertex3(0,0,0);
    74.             GL.MultiTexCoord(0, new Vector3(0f, 1f, 0f));
    75.             GL.Vertex3(0,1,0);
    76.             GL.MultiTexCoord(0, new Vector3(1f, 1f, 0f));
    77.             GL.Vertex3(1,1,0);
    78.             GL.MultiTexCoord(0, new Vector3(1f, 0f, 0f));
    79.             GL.Vertex3(1,0,0);
    80.             GL.End();
    81.         }
    82.         GL.PopMatrix();
    83.     }
    84.  
    85.     public static Texture2D screenGrab( Texture2D rt, Rect camRect )
    86.     {
    87.         float asp = Camera.current.pixelWidth / Camera.current.pixelHeight;
    88.         GameObject dom = new GameObject("capture", typeof(Camera));
    89.         dom.camera.aspect = asp;
    90.         dom.camera.pixelRect = camRect;
    91.         dom.transform.position = Camera.current.transform.position;
    92.         dom.transform.rotation = Camera.current.transform.rotation;
    93.         dom.camera.Render();
    94.         rt.ReadPixels(camRect, 0, 0);
    95.         rt.Apply();
    96.         Destroy(dom);
    97.  
    98.         return rt;
    99.     }
    100.  
    101.     public Rect prevRect;
    102.     public float asp;
    103.     public GameObject dom;
    104.     public void OnPreRender ()
    105.     {
    106.         if( !useOldVersion )
    107.         {      
    108.             asp = camera.pixelWidth/camera.pixelHeight;
    109.             if (!DepthCam)
    110.             {
    111.                 DepthCam = new GameObject("DepthCamera", typeof(Camera));
    112.                 DepthCam.camera.CopyFrom(camera);
    113.                 DepthCam.camera.depth = camera.depth-2;
    114.             }
    115.             if (!dom)
    116.             {
    117.                 dom = new GameObject("capture", typeof(Camera));
    118.                 dom.camera.CopyFrom(camera);
    119.                 dom.camera.depth = camera.depth-3;
    120.             }
    121.             if (capture && DNRequire)
    122.             {
    123.                 DepthCam.transform.position = camera.transform.position;
    124.                 DepthCam.transform.rotation = camera.transform.rotation;
    125.                 DepthCam.camera.SetReplacementShader(DepthShader, "RenderType");
    126.                 DepthCam.camera.aspect = asp;
    127.                 DepthCam.camera.pixelRect = new Rect(0,0,textureSizeW,textureSize);
    128.                 DepthCam.camera.Render();
    129.                 DNBuffer.ReadPixels(new Rect(0, 0, textureSizeW, textureSize), 0, 0);
    130.                 DNBuffer.Apply();
    131.             }
    132.             if (capture)
    133.             {
    134.                 dom.transform.position = camera.transform.position;
    135.                 dom.transform.rotation = camera.transform.rotation;
    136.                 dom.camera.aspect = asp;
    137.                 dom.camera.pixelRect = new Rect(0, 0, textureSizeW, textureSize);
    138.                 dom.camera.Render();
    139.                 RT.ReadPixels(new Rect(camera.pixelRect.x, camera.pixelRect.y, textureSizeW, textureSize), 0, 0);
    140.                 RT.Apply();
    141.             }
    142.    
    143.         } else
    144.         {
    145.             if( DNRequire )
    146.             {
    147.                 //for old rendering method
    148.                 if (!DepthCam){
    149.                     DepthCam = new GameObject("DepthCamera", typeof(Camera));
    150.                     DepthCam.camera.CopyFrom(myCamera);
    151.                     DepthCam.camera.depth = myCamera.depth-2;
    152.                 }
    153.  
    154.                 DepthCam.transform.position = myTransform.position;
    155.                 DepthCam.transform.rotation = myTransform.rotation;
    156.                 DepthCam.camera.SetReplacementShader(DepthShader, "RenderType");
    157.                 DepthCam.camera.aspect = myCamera.aspect;
    158.                 DepthCam.camera.pixelRect = myCamera.pixelRect;
    159.                 DepthCam.camera.Render();
    160.                 DNBuffer.Resize(Mathf.RoundToInt(myCamera.pixelWidth), Mathf.RoundToInt(myCamera.pixelHeight), TextureFormat.RGB24, false);
    161.                 DNBuffer.ReadPixels(myCamera.pixelRect, 0, 0);
    162.                 DNBuffer.Apply();
    163.        
    164.             }
    165.        
    166.         }
    167.     }
    168.  
    169.     public void OnPostRender()
    170.     {
    171.         if( useOldVersion )
    172.         {
    173.             RT.Resize(Mathf.RoundToInt(myCamera.pixelWidth), Mathf.RoundToInt(myCamera.pixelHeight), TextureFormat.RGB24, false);
    174.             RT.ReadPixels(myCamera.pixelRect, 0, 0);
    175.      
    176.             RT.Apply();  
    177.         }
    178.     }
    179.  
    180.     public IEnumerator Start ()
    181.     {  
    182.         myTransform = transform;
    183.         myCamera = GetComponent<Camera>();
    184.    
    185.         if( !useOldVersion )
    186.         {      
    187.             capture = true;
    188.             RT = new Texture2D(textureSizeW, textureSize, TextureFormat.RGB24, false);
    189.             RT.wrapMode = TextureWrapMode.Clamp;
    190.             DNBuffer = new Texture2D(textureSizeW, textureSize, TextureFormat.ARGB32, false);
    191.             DNBuffer.wrapMode = TextureWrapMode.Clamp;
    192.  
    193.             while(Application.isPlaying)
    194.             {
    195.                 capture = true;
    196.                 yield return new WaitForSeconds(latency);
    197.             }
    198.    
    199.         } else
    200.         {
    201.             //old approuch
    202.             //possible for splitscreen too
    203.             RT = new Texture2D(Mathf.RoundToInt(myCamera.pixelWidth), Mathf.RoundToInt(myCamera.pixelHeight), TextureFormat.RGB24, false);
    204.             //RT.wrapMode = TextureWrapMode.Clamp;
    205.             DNBuffer = new Texture2D(Mathf.RoundToInt(myCamera.pixelWidth), Mathf.RoundToInt(myCamera.pixelHeight), TextureFormat.ARGB32, false);
    206.             yield break;
    207.         }
    208.     }
    209. }
    And the screenshots , i'll upload them here : (settings included)
     

    Attached Files:

  47. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Yes NPOT do, unity likes POT sized textures such as 512
     
  48. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    Did more tests , this time i tried to get an approximation of a resolution in the game's aspect ratio to 512X512 pixel count , So 512² has 262144 pixels while my approximation have 262361 (which doesn't really affect the image) , Both have the same framerate and the 671X391 (the approximation) Still looks way better , here's a comparison

    EDIT : 671X391 Actually is 1 FPS better than The 512² :eek:
     

    Attached Files:

  49. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Hm interesting could you push that to the github repo?
     
  50. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    i posted the c# script in the comments
     
unityunity