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

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
  2. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    And how did you get theat fog, is it normal fog? Did you think of the tone mapping techniques by your self?
     
  3. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    Its normal Fog, and the tonemapping techniques isint thought by my self, its a new technqiue called haijdawson. in the unity tonemapper, its called optimizedheijdawson. it looks much more nicer then hable which hable (uncharted 2 tonemap) is good for preserving colors, the new tonemapp actualy instead of preserving the colors and giving a milky image, it give it contrast and looks far more nicer, however when using it on the sky it did wash the sky out a little bit. and in that image i have been using the hable tonemap, but in the other images i use the heijdawson.
     
  4. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @Frostbite23: Just asking, but how did you modify the ambient lights? I wish I knew... ;)

    EDIT: hang on, wouldn't it be possible to mix a cubemap with the actual ambient light setting? maybe that's how you did it! :)
     
  5. kaarme

    kaarme

    Joined:
    May 1, 2014
    Posts:
    177
    Doesn't work. :/
     
  6. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    What problem are you having?
     
  7. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    Im having a problem with the other image effects(other than ssao) when in use, they all make the screen go to a very low resolution. is there any way to fix this?

    EDIT: added a photo of the problem and a nice ssao with sun rays image

    http://imgur.com/xdGz8WF <-----problem
    http://imgur.com/14zwfxK
    http://imgur.com/APgC1uD
    http://imgur.com/MLLpSbE
     
    Last edited: Aug 9, 2014
  8. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    I think he just uses a cubemap, set by script.
     
  9. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    Am having this too. Can not use the bloom or AA because everything becomes very low resolution. Do not know if it is because of a scale down for performance. Also having major performance drops compared to the previous bloom and AA.

    Yea pretty sure he is implementing Image Based Lighting into the ambient lighting. Sounds great. Using Lux so it is kinda the same thing except Lux IBL only works on Lux or edited shaders. What I am dying for is a way to implement dynamic IBL. Like different cubemaps blend so using a time of day and/or weather script you can change the cubemap without any noticeable "pop" when the cubemap changes.
     
    Last edited: Aug 8, 2014
  10. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    I don't use cubemaps, however I use Hemispherical Ambient Lighting. So right now I have 2 light vectors, one for skylighting, and one for bounced or ground lighting. However I would like to thank willywill (from, armedunity) who actually found out how to do it in the unity engine. you can read his post here - http://armedunity.com/topic/8446-improving-the-visual-fidelity-of-your-games-advanced/ - Now obviously his way is modifying the internal pre-pass which is what I'm using right now but you can get the same exact effect with surface shaders or vertex shaders because well you cant modify unitys forward render (I wish you can).

    However the only drawbacks you have when making it in surface and vertex shaders is that it isint applied globally to every object in the scene, and you have to create your own lighting model. But you can get the same results in both ways.

    And yes you can mix cubemaps with ambient lighting if you wish but it would be more like IBL, willywill has already made that possible

    He has done many other things you can check out on his channel, I recommend looking at his skylighting video because he uses Hemispherical Ambient Lighting and with that you can get some really nice results, as well as with some ambient occlusion he made.

    Now to sum up the ambient lighting, unitys ambient lighting system only uses a constant color like most games use, however when you use Hemispherical Ambient Lighting, the ambient lighting looks much more realistic and proper then just a flat out constant color. If you want an example you can have a look at farcry 3's ambient lighting system.
     
    Last edited: Aug 8, 2014
  11. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    That is incredible. I first thought skylighting but then I was like no it is too good to be true. Really awesome:).

    So let me get this straight. Sorry for my delayed understanding. Too exited:D. Is this a shader effect or a lighting system? To get it working in Unity Indie what is needed?
     
    Last edited: Aug 8, 2014
  12. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    Well since most of you here use unity indie the only way and the best way you can do it right now is through surface or vertex shaders. Its pretty easy to do actually. But if you want to know how to do it, I recommend reading willywills topic http://armedunity.com/topic/8446-improving-the-visual-fidelity-of-your-games-advanced/ - now that is his way of doing it which actually is dynamic but colors change a bit unrealistically. Right now im using the same technqiue but modified so i have a ground vector and no its not dynamic because i dont really need it. Now you can take the idea of that and apply it to your lighting model you have in your shader, dont copy paste. now if you do not know shaders then dont read that tutorial, do not copy and paste you wont learn by copying and pasting.

    So anyways you can do it with vertex and surface shaders
    You can do it in pre-pass lighting (Pro Only)
    Or you can do it with directional lights but that is a bit of a costly methoad depending how many you use. and the results you get wont get as close as you will with shaders.

    fyi im not the one who came up with this and did it in the unity engine, the one you should give credits to is willywill who is the shader god. so you can go to him and thank him for his service!
     
    Last edited: Aug 9, 2014
  13. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    Alright cool. Thanks for the info.
     
  14. Cyrien5100

    Cyrien5100

    Joined:
    Oct 17, 2012
    Posts:
    145
    As far as i know, Far Cry 3 uses a Pre Computed Radiance Transfert, which allows very good quality Global Illumination/Skylight
    However, Unity 5 will have an ambient cubemap system.
    Mixing diffuse cubemap with ambient lighting is not physically plausible, because Diffuse cubemap is ambient lighting.
     
  15. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Oh wow, where can I read up on how create it?
     
  16. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    Last edited: Aug 9, 2014
  17. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I though you used some specific site anyways, is it a pro image effect? And did you buy pro?
     
    Last edited: Aug 9, 2014
  18. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    yes I bought pro, and which image effect are you meaning? the tonemapper? ive already ported one to indie effects, im working on this tonemapper. and no most of the papers i find are sperate, but there is a great website called Vterrian and it contains a bunch of papers that i highly reccomend you check out
     
  19. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I saw that though no mention of heijdawson, and a yahoo search turned up nothing, wait so is it even an image effect?
     
  20. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    it is but its a technqiue, not an image effect. its a technqiue you use in an image effect.
     
  21. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    That took me way too long to realize, alright time to find out how to do that with my 30 or so days left int the trial ( they gave me an extra 45 days!!!)
     
  22. AlphaGarg8447

    AlphaGarg8447

    Joined:
    Jul 28, 2013
    Posts:
    20
    Fuzzy, can you make a specularity bloom? I would like to have one of these in my game.

    Example: Look at a car in daylight. See the sun reflection? So, see how it glows in a bloom? That's the effect i want. A bloom that only affects the specular materials.
     
  23. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Use a reflective specular shader for the material and it's most likely impossible to create a bloom for only specular material, as it's an image effect though you could replicate it by increasing the light intensity on the material.
     
  24. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    444
    now if I understand correctly your looking for the kind of bloom that seus 10.1 has

    That would work best with any kind of bloom with a high threshold and with a decent bloom curve.
    You can use my bloom which has a threshold and a bloom curve, however I noticed that the bloom curve isint added but if you want it, go to the shader, go to the float4 frag function (not the blurX or blurY, those are the blurring functions), and put this above the return function (Pudeso Code)
    Code (CSharp):
    1. bloomIntensity = bloomCurve(bloomIntensity);
    now those arrent the real varibles but replace the names like the bloom curve with the actual function name and the bloom intensity to the actual varible name.

    and also if you dont want any limtations on the bloom script like the intensity go to the script and remove the
    Code (JavaScript):
    1. @range( value, value )
     
    Last edited: Aug 9, 2014
  25. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @Baldinoboy: How bad are the performance drops? I thought Power-Of-Two had better performance, it did with me... o_O
    And I was thinking of removing the AA, as having the scaled-down textures (default size is supposed to be 256x256...) makes it virtually useless.

    @thetoxicuser: yes, this is because you have the texture resolution set a bit low, try a larger one. also make sure the the size doesn't exceed the horizontal (or vertical) resolution (640x480, etc...) you plan to target. BTW, what resolution is that in the editor?

    @Frostbite23: IS THAT A HD MINECRAFT CLONE?! :eek:

    EDIT: Looked it up, it's not... :D But I definitely will be getting this for my minecraft install! :)
     
    Last edited: Aug 10, 2014
  26. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,457
    With any effect besides DOF and SSAO it is about double the frame rate loss than before 2.0. On my pc anyway. So before 2.0 adding bloom will bring the fps to 15-20. With 2.0 it is about 6-9. Not worried because I am still having fun with the SSAO;).

    Was wondering if there is a way to get the SSAO working in Dx11?
     
  27. NightHawk954

    NightHawk954

    Joined:
    Aug 10, 2014
    Posts:
    1
    This package is truly awesome but i have a small problem. Unity editor crashes when i adjust the resolution above 256. And on 256 it looks really bad, any advice on how to adjust the resolution. Thanks
     
  28. Gogin

    Gogin

    Joined:
    Nov 9, 2013
    Posts:
    60
    NightHawk954:
    I got same problem. I guess its slow PC. Try it clean and build - then try it!
     
  29. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    looks better but is still to low of a res
     
  30. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    I made a quick draft for an old version option in the base script. It can be found in the github repo. Maybe it works for you, but depth normal texture rendering is not correctly usable.

    It is a copy of my workaround for splitscreen setups.
     
  31. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Wait! So no additions to current scripts to make the effects work, sorry I haven't taken a look at the updated version yet?
     
  32. camis

    camis

    Joined:
    Aug 7, 2014
    Posts:
    2
    Thank you Fuzzy! It worked!
     
  33. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @0tacun: can I review this please? :)

    @thetoxicuser: yes, I am sorry about the poor quality, it's something I had to compromise on when trying to boost performance. how about I add an NPOT option that uses native res? :) that way, i don't have to scrap FXAA... ;)
     
  34. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @NightHawk954: Um, it shouldn't do that... check your display res is turned up bigger than the texture size: even ONE pixel different will work! Also, what unity version? if it isn't at least 4.5.0, it won't work.
     
  35. thetoxicuser

    thetoxicuser

    Joined:
    Jan 11, 2013
    Posts:
    34
    yes that would be great! thank you. however I do enjoy 512 res with ao, since it doesn't change the actual screen res. it very runs smoothly. one other question: what is the Otacun ssao? I plugged it in but nothing happened.
     
  36. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @thetoxicuser: Oh, that was the old one I was going to add in, but the new depth buffer broke it. ;)

    @0tacun: you will need to explain the code in your pull request to me: i have no idea where it's supposed to go in the main script!
     
  37. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    @Eric2241 : What do you mean? The bloom effect should work, depth of field etc. currently not with my draft as the DN-texture is drawn on top of every thing.

    @FuzzyQuills :

    Here is my draft I submitted to the repo:
    Code (JavaScript):
    1. #pragma strict
    2. /*
    3. ----------Indie Effects Base----------
    4. This is the base for all other image effects to occur. Includes depth texture generation
    5. */
    6.  
    7. @script RequireComponent(Camera);
    8. @script AddComponentMenu("Indie Effects/IndieEffectsBase")
    9.  
    10. //base effects
    11. @script HideInInspector var RT : Texture2D;
    12. var textureSize : int;
    13. var capture : boolean;
    14. var DepthShader : Shader;
    15. var DNBuffer : Texture2D;
    16. var DNRequire : boolean;
    17. var DepthCam : GameObject;
    18. @Range(0,0.04)
    19. var latency : float;
    20.  
    21. var useOldVersion : boolean; //enable old rendering method
    22. var myCamera : Camera; //cache camera and transform component for
    23. private var myTransform : Transform; //performance
    24.  
    25. static function FullScreenQuad(renderMat : Material) {
    26.     GL.PushMatrix();
    27.     for (var i = 0; i < renderMat.passCount; ++i) {
    28.         renderMat.SetPass(i);
    29.         GL.LoadOrtho();
    30.         GL.Begin(GL.QUADS); // Quad
    31.         GL.Color(Color(1,1,1,1));
    32.         GL.MultiTexCoord(0,Vector3(0,0,0));
    33.         GL.Vertex3(0,0,0);
    34.         GL.MultiTexCoord(0,Vector3(0,1,0));
    35.         GL.Vertex3(0,1,0);
    36.         GL.MultiTexCoord(0,Vector3(1,1,0));
    37.         GL.Vertex3(1,1,0);
    38.         GL.MultiTexCoord(0,Vector3(1,0,0));
    39.         GL.Vertex3(1,0,0);
    40.         GL.End();
    41.     }
    42.     GL.PopMatrix();
    43. }
    44.  
    45. static function FullScreenQuadPass(renderMat : Material, pass : int){
    46.     GL.PushMatrix();
    47.     for (var i = 0; i < pass; ++i) {
    48.         renderMat.SetPass(i);
    49.         GL.LoadOrtho();
    50.         GL.Begin(GL.QUADS); // Quad
    51.         GL.Color(Color(1,1,1,1));
    52.         GL.MultiTexCoord(0,Vector3(0,0,0));
    53.         GL.Vertex3(0,0,0);
    54.         GL.MultiTexCoord(0,Vector3(0,1,0));
    55.         GL.Vertex3(0,1,0);
    56.         GL.MultiTexCoord(0,Vector3(1,1,0));
    57.         GL.Vertex3(1,1,0);
    58.         GL.MultiTexCoord(0,Vector3(1,0,0));
    59.         GL.Vertex3(1,0,0);
    60.         GL.End();
    61.     }
    62.     GL.PopMatrix();
    63. }
    64.  
    65. static function screenGrab ( rt : Texture2D, camRect : Rect ) {
    66.     var asp = Camera.current.pixelWidth/Camera.current.pixelHeight;
    67.     var dom = new GameObject("capture", Camera);
    68.     dom.camera.aspect = asp;
    69.     dom.camera.pixelRect = camRect;
    70.     dom.transform.position = Camera.current.transform.position;
    71.     dom.transform.rotation = Camera.current.transform.rotation;
    72.     dom.camera.Render();
    73.     rt.ReadPixels(camRect, 0, 0);
    74.     rt.Apply();
    75.     Destroy(dom);
    76.     return rt;
    77. }
    78.  
    79. var prevRect : Rect;
    80. var asp : float;
    81. var dom : GameObject;
    82. function OnPreRender () {
    83.     if( !useOldVersion ){
    84.        
    85.     asp = camera.pixelWidth/camera.pixelHeight;
    86.     if (!DepthCam){
    87.         DepthCam = new GameObject("DepthCamera",Camera);
    88.         DepthCam.camera.CopyFrom(camera);
    89.         DepthCam.camera.depth = camera.depth-2;
    90.     }
    91.     if (!dom){
    92.         dom = new GameObject("capture", Camera);
    93.         dom.camera.CopyFrom(camera);
    94.         dom.camera.depth = camera.depth-3;
    95.     }
    96.     if (capture && DNRequire) {
    97.         DepthCam.transform.position = camera.transform.position;
    98.         DepthCam.transform.rotation = camera.transform.rotation;
    99.         DepthCam.camera.SetReplacementShader(DepthShader, "RenderType");
    100.         DepthCam.camera.aspect = asp;
    101.         DepthCam.camera.pixelRect = Rect(0,0,textureSize,textureSize);
    102.         DepthCam.camera.Render();
    103.         DNBuffer.ReadPixels(Rect(0,0,textureSize,textureSize), 0, 0);
    104.         DNBuffer.Apply();
    105.     }
    106.     if (capture) {
    107.         dom.transform.position = camera.transform.position;
    108.         dom.transform.rotation = camera.transform.rotation;
    109.         dom.camera.aspect = asp;
    110.         dom.camera.pixelRect = Rect(0,0,textureSize,textureSize);
    111.         dom.camera.Render();
    112.         RT.ReadPixels(Rect(camera.pixelRect.x,camera.pixelRect.y,textureSize,textureSize), 0, 0);
    113.         RT.Apply();
    114.     }
    115.    
    116.     }
    117. }
    118.  
    119. function OnPostRender() {
    120.     if( useOldVersion ) {      
    121.         if( DNRequire ) {
    122.             //DN-Texture generation not ready
    123.             if (!DepthCam){
    124.                 DepthCam = new GameObject("DepthCamera",Camera);
    125.                 DepthCam.camera.CopyFrom(myCamera);
    126.                 DepthCam.camera.depth = myCamera.depth-2;
    127.             }
    128.  
    129.             DepthCam.transform.position = myTransform.position;
    130.             DepthCam.transform.rotation = myTransform.rotation;
    131.             DepthCam.camera.SetReplacementShader(DepthShader, "RenderType");
    132.             DepthCam.camera.aspect = myCamera.aspect;
    133.             DepthCam.camera.pixelRect = myCamera.pixelRect;
    134.             DepthCam.camera.Render();
    135.             DNBuffer.Resize(myCamera.pixelWidth, myCamera.pixelHeight, TextureFormat.RGB24, false);
    136.             DNBuffer.ReadPixels(myCamera.pixelRect, 0, 0);
    137.             DNBuffer.Apply();
    138.        
    139.         }
    140.         RT.Resize(myCamera.pixelWidth, myCamera.pixelHeight, TextureFormat.RGB24, false);
    141.         RT.ReadPixels(myCamera.pixelRect, 0, 0);
    142.      
    143.         RT.Apply();  
    144.     }
    145. }
    146.  
    147. function Start () {
    148.    
    149.     myTransform = transform;
    150.     myCamera = GetComponent(Camera);
    151.    
    152.    
    153.    
    154.     if( !useOldVersion ){
    155.        
    156.     capture = true;
    157.     RT = new Texture2D(textureSize, textureSize, TextureFormat.RGB24, false);
    158.     RT.wrapMode = TextureWrapMode.Clamp;
    159.     DNBuffer = new Texture2D(textureSize, textureSize, TextureFormat.ARGB32, false);
    160.     DNBuffer.wrapMode = TextureWrapMode.Clamp;
    161.     while(true) {
    162.         capture = true;
    163.         yield WaitForSeconds(latency);
    164.     }
    165.    
    166.     } else {
    167.         //old approuch
    168.         //possible for splitscreen too
    169.         RT = new Texture2D(myCamera.pixelWidth, myCamera.pixelHeight, TextureFormat.RGB24, false);
    170.         //RT.wrapMode = TextureWrapMode.Clamp;
    171.         DNBuffer = new Texture2D(myCamera.pixelWidth, myCamera.pixelHeight, TextureFormat.ARGB32, false);
    172.        
    173.     }
    174. }

    It just fine coexists with the new method. Also I have cached the transform and camera component for performance reasons. Furhtermore I am using the myCamera.pixelHeight/Width to make sure that it is useable for splitscreen setups.

    All in all it is just your old rendering method.

    Let me know any issues.

    Just noticed this file was probably reverted in the repo.
     
  38. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Well, itcould have been that the pull request showed only the edited lines... that's what it looked like to me. ;)

    Well, nonetheless, create new pull request if required, and I will get Eric to move it to the repo.
     
  39. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Nevermind my previous statement.
     
  40. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    I updated the files with the changes.
     
  41. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    Cool.
     
    Eric2241 likes this.
  42. Tarifeno

    Tarifeno

    Joined:
    Aug 14, 2014
    Posts:
    1
    Hi!
    I have this error.

    Assets/IndieEffects/Classes/MotionblurModern/ObjectBlur.js(15,55): BCE0019: 'rootBone' is not a member of 'UnityEngine.Renderer'.

    Anyone knows how to fix it?

    Thx
     
  43. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
  44. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @Tarifeno: Just delete the related script for now, as Per-Object motion blur hasn't been achieved yet... that was what the script was for. it is currently unused at the moment, so feel free to delete it.

    @Eric2241: From the plane, I guess? :D
     
  45. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    Yep, flying to Beijing. :D
     
  46. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    YOU LUCKY BUGGER!!! :) :D :eek: o_O

    (EDIT: Those faces went there once, I am sure... ;))
     
  47. Eric2241

    Eric2241

    Joined:
    Dec 2, 2012
    Posts:
    642
    :):cool::D
     
  48. Squirrelche_2014

    Squirrelche_2014

    Joined:
    Aug 16, 2014
    Posts:
    1
    So the motion blur is currently not working? If it is I can't seem to figure it out. I'm not seeing any difference here.
     
  49. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,875
    @Squirrelche_2014: No it isn't, the new texture system broke it. But since 0tacun added an option to use old texture system, I may be able to re-do the old motion blur.
     
  50. DeathWish0987654

    DeathWish0987654

    Joined:
    Aug 17, 2014
    Posts:
    1
    My game is very pixlelaided what do i do???
     
unityunity