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

RaindropFX - Realistic Camera Lens Rain Effect

Discussion in 'Assets and Asset Store' started by zhongtianhu, Feb 24, 2018.

  1. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    RaindropFX Pro : Asset Store Link | Lite Version : Asset Store Link | Online Document : Documentation

    Easy to use realistic camera lens raindrop animation post process effects.

    RaindropFX Pro is updated to Version 2.00
    RaindropFX Pro 2.0 for HDRP is released! If you have purchased standard pipe version (2.0), you can send me a email with your purchase number to get HDRP version for free!

    Added
    - Radial wind;
    - Tint color for droplets;
    - Accurate foreground droplet blur;
    - Stable object space version;
    - Better visual quality of object space version;
    - Batches are reduced by 5 from the previous version when there are no more droplets in the scene.

    Fixed
    - Error with null raindrop texture;
    - FPS dropping down even when there are no drops on screen;
    - Enabling HDR option of camera causes an error in object space version;
    - Object space version is now compatible with AURA2;

    Video










    ScreenShots



    objectSpaceVer.png radial.png screenFog2.png
    TintCol.png QQ截图20190220211706.png

    Please use this thread if you have any questions, comments, or requests for new features, I'll be happy to help.

    Hope you'll like it :)
     
    Last edited: Jun 17, 2020
    Mauri and Neviah like this.
  2. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    157
    SRP has same features with HDRP?
     
  3. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    RaindropFX PRO is integrated with Unity's Post Processing Stack (V2), so you can use RaindropFX PRO with same features in everywhere you can use Post Processing Stack (V2). You can try Post Processing Stack (V2) with your SRP(HDRP/LWRP/custom) first, if it works, RaindropFX PRO will works, too.
    Lite version (RaindropFX 0.5.0) does not support SRP (HDRP/LWRP/custom), it only support Deferred and Forward rendering and has fewer features (screen fog, wind turbulence ...), but it can work without Unity's Post Processing Stack (V2), and can work with older versions (5.3.4 or higher) Unity.
     
  4. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    51
    I am thinking about buying the lite version but does it also support waterdrops without a physics/fall /wind effect. so only the drops? thx :)
     
  5. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    There are two ways to achieve the desired results:
    1. Set the magnitude of gravity and wind to 0.
    2. Drops are divided into two types: static and dynamic. You can set the maximum number of these two kinds of droplets separately, so you can just set the number of dynamic droplets to 0, so that only static droplets can be generated in random positions on the screen.
     
    marcell123455 likes this.
  6. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    561
    Hey. Did you tried to pipe the rendertarget of the drops to an car paint shader or an glas shader? Could be a nice effect.
     
    razzraziel likes this.
  7. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    Thank you for your suggestions! Actually I've already finished a object space version plugin, use this version you can add RaindropFX effect to the surface of your 3D object with correct physical interaction, and here's the preview:



    But there's still a lot of limitations such as:
    1.Unity limits the maximum number of collider vertices to 255, so we can't apply the effect to complex models at present;
    2.In order to get the correct physical interaction, we need to do a lot of pre-calculations before running the game.

    So it's not easy to use at present. I'm still trying to breaking these limitations, but maybe I'll release a non-physical exact version first, so we don't need to consider the above limitations.
     
    keeponshading and razzraziel like this.
  8. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    157
    wow great feature but...

    this is insane. how many scripts, textures, materials and shaders are there? :eek:


    lets say i want to use this on windshield for a vehicle (with enough polys), how much process power does this need for that? (for dynamic rain drops in medium & heavy rain)
     
  9. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    This is a developing version, in order to achieve physical accuracy, we need to pre-calculate a large number of physical information of the model surface and store them to look up tables, so as to achieve real-time simulation. In release version I will make things as simple as possible, maybe just drag and drop a script to your object, and every thing is OK.
    As for simulation efficiency, if physical accuracy is not needed (droplets are directly generated in the random positions in the UV space and will not be converted into 3D droplets), simulation efficiency is independent of the number of model faces, only the number of droplets will have an impact on simulation efficiency. In the presence of 10,000 static droplets and 25 dynamic droplets, the frame rate is generally 350~400 FPS (i5-8400 CPU + GTX1050 GPU); But if physical accuracy is required (droplets are generated from a 3D particle system and are converted to 2D droplets in the UV space after collision with the surface of object. When they flow through the boundary of the object, they are converted back to 3D droplets), the increasement of model faces will lead to a huge reduction in simulation efficiency.
     
  10. Spiderwork

    Spiderwork

    Joined:
    Feb 1, 2018
    Posts:
    30
    @zhongtianhu
    When I use it in the editor in play mode everything works fine. However, when I create a build and start it, the whole scene isn't visible anymore (Only Canvas objects are visible). What could be the problem?
     
  11. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    561
    Hey. Do you have an ETA when we could try the ibject space version?
     
  12. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    I think here is the solution for your problem:
    1.The problem is mainly caused by the 'Shader.Find' API by Unity, custom shaders will not be included into the player build if nothing references it.
    2.So first you can try to go to 'ProjectSettings->Graphics' in your Unity editor then add all the 5 shaders of RaindropFX (located at : RaindropFXPro/Shaders/HDRP) to 'always included shaders', then rebuild your game and try it again.
    3.If you try to build an apk for Android platform, you can try to do the following:
    1) File -> Build Settings
    2) Click "Player Settings"
    3) Navigate to the Android tab
    4) Unfold the "Other Settings" menu
    5) Uncheck "Auto Graphics API"
    6) Remove OpenGLES2 and Vulkan graphics API's
    7) Set the Minimum API Level to be greater than Android 4.3.
    Hope it can help you :)

    problem_01.png
    problem_02.png
     
  13. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    I'll upload a preview version in the next month. But I don't have time for rigorous testing of this version now, so it may not be stable. If you already use RaindropFX in a formal project, upgrade carefully.

    Updates include:
    · Non-physical accurate version of the object space version solver;
    · Completely refactored raindrop solver core;
    · Batch image renderer, which can be used to render droplet sequences onto a set of user-defined input image sequence;
    · Online document.
    图片1.png
     
    Last edited: Oct 13, 2019
    keeponshading likes this.
  14. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    561
    That sounds great.
    Mark the object space version as beta.
    I am happy to support you with all kind of tests.

    Your object space version will be an addition for this one i am working on.
    This one is more for wheel interaction with wet ground.
    However i tried an whiper here to. See floor cylinder.)
     
  15. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    It's very kind of you to help me do the test! If you find any problems, you can post them here directly.

    Your test video looks great! The current version of RaindropFX to be released is a non-physically accurate version (completely based on UV space), when using this version, you need to pay attention to the UV of your wheel model (which will affect the flow direction of water droplets). I will elaborate on it later in the documentation.
     
  16. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    561
    Hi. That will be fun.
    I would like to combine your screenspace version the with the clearcoat of my carpaint and the windscreen glas.
    All exterior surfaces have clean uv s.
    The most fun will be the optimisation for larger surfaces.
    But there will be solutions.)
     
  17. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    561
    I have to methods in mind for allowing your simulated object space feature for larger scale. eg. complete car.

    1) have a look on the lod feature from crest ocean
    https://github.com/crest-ocean/crest/blob/master/USERGUIDE.md
    2) more fancy. doing everything with vfx graph and collide with sdf s generated from geometry.
     
  18. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    Thanks for your suggestions! That sounds interesting to add some LOD feature to RaindropFX, I'll try it.
    As for SDF, does it means to convert the model into voxels and then carry out collision detection? However, in this way, it may be difficult for us to get the UV coordinates of the model corresponding to the collision points, and for the objects with mesh animation, the voxelization consumption per frame will be relatively large.
     
  19. bnogalc

    bnogalc

    Joined:
    Apr 27, 2017
    Posts:
    9
    I am just looking videos..could be nice to add a couple of things to be able to use it with car windshield/ wipers

    Option to select an axis/point for wind split effect, so drops moves in a realistic way.

    Option to clean window with a wiper, record with an auxiliar camera the movement of the wiper, and store in a texture when the wiper object writes to the Z, setting a value to 0 and increase the value to 1 with the time...
    Use this auxiliar texture to filter effect, and clean it.

    I was trying to implement something like this, but i am busy with many others things :)
     
  20. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    Thanks for your suggestions! It's a great idea! I'll add it to my roadmap.
     
  21. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    431
    i have the original version from before the pro, is there a way to add a tint color to the rain in the
    original version as i need it to look green like slime
     
  22. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    Do you mean you hava the lite version? It's a little complicated to modify the lite version, but it can be done. I'm a little busy these days, so you can leave me an email and I'll send you a modified version later.
     
  23. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    431
    Hi , maybe it is the lite version now, but it was just called raindrop fx when i purchased it a while ago, i did email your gmail yesterday so if you would send it to me i would be very gratefull, thank you
     
  24. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    431
    I sent an email to you gmail account, thank you
     
  25. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    431
  26. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Just sent a new version to you ;)
    20200219115614.png
     
  27. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    431
    Thank you, will test when i get home, looks great in your picture
     
  28. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    Does this work with the standard Unity rendering? When I add the effect to my post process stack I get errors in your HDRP script.
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. RaindropFX.RaindropFX_HDRPRenderer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Assets/RaindropFXPro/Scripts/HDRP/Core/RaindropFX_HDRP.cs:210)
    Edit: Seems when you first add the effect there is no rain drop texture set which messes something up so even after you add the texture the errors still come, I had to restart Unity for the errors to stop and for it to start working, might be nice if you catch that for future users, unless I did something wrong?

    On another point is it possible to have the drops move off radially as if they are being blown of because the camera is moving forward. Can that be done with the wind and turbelence values?

    And another question, I can turn the effect on/off using the fadiue/fadein bool value which works fine but when the effect is faded out it still seems to be running in the background so slowing the FPS but contributing nothing to the visuals, is there a way to see what the current state is so I can totally disable the effect on the stack when its not doing anything?

    And finally is it possible to add raindrops from script, I would like to control when and where a drop is added and its velocity.
     
    Last edited: Feb 19, 2020
  29. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    I have another wee little problem :) All works fine in the edito and playmode, but when I do a build for PC build the Raindrop effect does not Init, it spits out a load of errors about the shader being null in the init method.
    Code (CSharp):
    1. ArgumentNullException: Value cannot be null.
    2. Parameter name: shader
    3.   at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
    4.   at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00007] in <945c24c342914372bc599495ca1ade0d>:0
    5.   at RaindropFX.RaindropGenerator.Init (UnityEngine.Texture2D raindropTex_alpha, UnityEngine.Vector2Int calcRainTextureSize) [0x000c9] in C:\Projects 2018.3\Ages of Speed\Assets\RaindropFXPro\Scripts\HDRP\Core\RaindropGenerator.cs:94
    6.   at RaindropFX.RaindropFX_HDRPRenderer.InitSys () [0x00001] in C:\Projects 2018.3\Ages of Speed\Assets\RaindropFXPro\Scripts\HDRP\Core\RaindropFX_HDRP.cs:219
    7.   at RaindropFX.RaindropFX_HDRPRenderer.Constraints () [0x00040] in C:\Projects 2018.3\Ages of Speed\Assets\RaindropFXPro\Scripts\HDRP\Core\RaindropFX_HDRP.cs:232
    8.   at RaindropFX.RaindropFX_HDRPRenderer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x00026] in C:\Projects 2018.3\Ages of Speed\Assets\RaindropFXPro\Scripts\HDRP\Core\RaindropFX_HDRP.cs:163
    9.   at UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderList (System.Collections.Generic.List`1[T] list, UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.String marker) [0x000a6] in C:\Projects 2018.3\Ages of Speed\Assets\PostProcessing\Runtime\PostProcessLayer.cs:745
    10.   at UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderInjectionPoint (UnityEngine.Rendering.PostProcessing.PostProcessEvent evt, UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.String marker, System.Int32 releaseTargetAfterUse) [0x0003d] in C:\Projects 2018.3\Ages of Speed\Assets\PostProcessing\Runtime\PostProcessLayer.cs:713
    11.   at UnityEngine.Rendering.PostProcessing.PostProcessLayer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x001ed] in C:\Projects 2018.3\Ages of Speed\Assets\PostProcessing\Runtime\PostProcessLayer.cs:688
    12.   at UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () [0x00368] in C:\Projects 2018.3\Ages of Speed\Assets\PostProcessing\Runtime\PostProcessLayer.cs:430
    13.   at UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () [0x00098] in C:\Projects 2018.3\Ages of Speed\Assets\PostProcessing\Runtime\PostProcessLayer.cs:292
    How do I fix this? Thanks.
     
  30. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    I had to move the Shaders folder into the Resources folder for this to work in a build. Is this a known issue or have I done something wrong somewhere to cause this?
     
  31. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    1.If you have not add raindrop texture, there will only print log "raindrop tex is null!" without error, so I think may be your other operations are wrong. Please follow the steps in the manual or video to reconfigure RaindropFX and try again.

    2.I will add radial wind in later versions to achieve this effect.

    3.When there are no more water drops on the screen, FPS will not be affected. If you think fade out is too slow, you can try to tick "Fast Mode", so FPS will recover quickly.

    4.It's OK to add water drops from the script. I added comments for each method in the source code. You can modify the code yourself.
     
  32. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    This problem is mainly caused by the 'Shader.Find' API, you can try to go to 'ProjectSettings->Graphics' in your Unity editor then add all the 5 shaders of RaindropFX (located at : RaindropFXPro/Shaders/HDRP) to 'always included shaders', then rebuild your game and try it again. (See my reply to Spiderwork in #12 for details)
     
    Last edited: Feb 20, 2020
  33. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    I tested the turning off of the effect. When I turn it off using the FadeOut/FadeIn switch the FPS for the simple test goes from 1100fps to 1250fps but if I then disable the effect entirely then it goes to 3100fps so it would be nice if there is a way to tell that there are no drops on the screen so I can disable it fully.
     
    Last edited: Feb 20, 2020
  34. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    Sorry, another question. Trying to use the Object Space version to get drops on a window, I created the material and set the shader to your shader. I added the Command Buffer Blur Refraction and the Material Linker, set the Material in each to the one with the shader on, all fine. I then try and set the Raindrop tex Alpha and as soon as I do I get this error spamming the console and the I dont see any rain on the surface.
    Code (CSharp):
    1. Dimensions of color surface does not match dimensions of depth surface
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    3.  
    If I remove the Material Linker component the error stops. What did I do wrong and how can I fix this problem? Thanks.
     
  35. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    You can simply turn on "Debug Log", then if there are no drops on the screen you will see "all droplets killed." at console.
    And the code is located at line 280 in RaindropGenerator.cs. lenS and lenD represent the number of static drops and dynamic drops respectively.
    debug.png
     
  36. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    A user who used AURA2 encountered the same problem before. May be the command buffer conflicts with other plugins. I rewritten a version based on grab pass, it works well with AURA2, you can try it.

    How to setup:
    1.add 'GradBlur.shader' to 'raindropfxpro/shaders/hdrp/surface'
    2.create a new material and assign it to your glass gameobject and 'target mat' in 'material linker' component attached to it
    3.change material's shader to 'custom/raindropfx/WetSurfaceGrab'
    4.delete 'command buffer blur refraction' component you have attached to your gameobject before, now we don't need it anymore
    Other settings are the same as before.

    newVer.jpg
     

    Attached Files:

  37. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    Tried that and that makes the drops show up in the game view but the scene view is still spamming the console with:
    Code (CSharp):
    1. Dimensions of color surface does not match dimensions of depth surface
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
  38. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    I'm so sorry, after testing, I found that the problems you mentioned before (error with null raindrop texture and FPS dropping down even when there are no drops on screen) did exist, and they occurred in version 2018.2+.

    Now these problems have been fixed, batches are reduced by 5 from the previous version when there are no more droplets in the scene.

    The error "Dimensions of color surface does not match dimensions of depth surface" is caused by the HDR option of the camera. I fixed it, but now you will need to run the game to see the water droplets.

    How to setup:
    Just download the attachment and replace the file with the same name ;)

    微信截图_20200222124719.png 微信截图_20200222124659.png
     

    Attached Files:

  39. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,177
    Thanks for the help seems to be working now. Couple of things, your PDF says to add the WetSurface shader where it should be WetSurfaceGrab shader. Second would be nice if there was a mask/wetness texture option. I quickly added it myself :)
     
  40. abidnipun

    abidnipun

    Joined:
    Mar 15, 2018
    Posts:
    1
    Hi I recently buy
    RaindropFX Pro. I can't use it in LWRP pipeline.Can you help?
     
  41. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Just replied to your email :)
     
  42. asemenov

    asemenov

    Joined:
    Jan 13, 2014
    Posts:
    11
    Hi! I have a question, what version of HDRP currently supported?
     
  43. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi!
    Since Unity 2018.4, HDRP and URP using their built-in post-processing stack instead of PPV2, so current version of RaindropFX is not supported.
    Separate versions of RaindropFX will be released soon to support new versions HDRP. (screen space version for HDRP 7.1.8+ is finished, but I'm still working on object space version for new HDRP)
     
  44. Ophtalmic

    Ophtalmic

    Joined:
    Jan 19, 2015
    Posts:
    12
    Very good asset. Please add the note in the main document about fx shaders list, define symbols. If you don't add all rain fx pro shaders to "always included shader list" and "RAINDROPFX" tag in define symbols, fps is drops dramatically down and effects not working. Cheers.
     
  45. Bartolomeus755

    Bartolomeus755

    Joined:
    Jun 20, 2013
    Posts:
    249
    Since I have upgraded to HDRP I can't no longer use this great asset. So can't wait for a compatible version for newer HDRP's. ;)
     
  46. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    I'll add it to the manual. Thank you very much for your suggestion!
     
  47. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Thank you for your support and love! Object space version for HDRP is finished, I'll submit it for release in recent days ;)
     
    Bartolomeus755 likes this.
  48. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    264
    Hi.

    Very good work and of high quality.

    My question:

    Is it possible and easy (for a novice) to achieve a rain "wipe" effect? (Clean with a cloth, by hand, or, for my game, with a car wiper)

    Any advice?

    It would be great to introduce some script in the asset !!! ;):)
     
  49. zhongtianhu

    zhongtianhu

    Joined:
    Jan 27, 2018
    Posts:
    23
    Hi Barritico,

    I've added a mask feature to RaindropFX Pro 2.2 Version (not published yet), but currently the cull mask is static and cannot achieve wipe animation effect. I can send you a new version to test if you are interested with it. (Currently you can use another script to change the mask in runtime for a temporary dynamic wipe effect)

    I will implement dynamic wipe effect in the future update.
     
    Barritico likes this.
  50. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    264
    Okay.

    I will buy the current version.

    This effect is very important to my game. Unfortunately I am a "management" and not an "effects" developer, so making the mask will be almost impossible without help.

    I eagerly await that update.

    Many thanks.

    EDIT:

    Buy it!!!
     
    Last edited: Jun 15, 2020
unityunity