Search Unity

glareFX Dirt Lens Effect (Battlefield 3 like)

Discussion in 'Assets and Asset Store' started by reddotgames, Nov 26, 2012.

  1. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    Version 1.7 submitted on Asset Store

    • Added "Fastest Mode" in mobile shader.
    • Few optimizations in mobile shader to make it more faster.
    • Added Sample Scene for Mobile with mobile low res dirt texture
     
  2. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    very cool.
     
  3. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    i keep getting this error in my project
    Tiled GPU perf. warning: RenderTexture color surface (239x172) was not cleared/discarded, doing Camera.ImageEffects/Camera.ImageEffect/glareFxCheapMobile.OnRenderImage()
    UnityEngine.Graphics:BlitMultiTap(Texture, RenderTexture, Material, Vector2[])
    glareFxCheapMobile:FourTapCone(RenderTexture, RenderTexture) (at Assets/glareFX/glareFxCheapMobile.cs:64)
     
  4. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    ah it appears you named your shader the same as a built in asset, Standard Assets / Image Effects (pro only) / _ sources / shaders / BlurEffectConeTaps

    its first line is Shader "Hidden/glareBlur"
    which happens to be what you named your glare blur. causing errors.
     
  5. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    oh i just found out, the issue is caused by graphics emulation set to opengl es2, this happens if you switch the build mode to Android it will automatically turn on [edit] - > [Graphics Emulation] - > Opengl es2

    and your shaders are just not properly setup for opengl es2, the error in question shows in unity 4.2, it doesnt show in 3.x, they actually let you know now that it needs to be fixed in 4.2
     
  6. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    So all is correct now?

    Only shader that will work in opengl es2.0 is Mobile one :)

    Unity find out that those shaders are the same. I will fix that so Unity will import this shader as a separate.
     
  7. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    no unfortunately thats actually 2 issues, the first one is that you need to rename the string of the shader. which is ok i just deleted the unity's conflicting shader.

    but the second issue is that you must try your shader in 4.2 and turn on " [edit] - > [Graphics Emulation] - > Opengl es2" so it will tell you what you need to fix in your shader. but i turned off the emulation till its fixed, it does not seem to be a major impact on performance, but if you fixed it, i bet it will run faster on mobile nearly no effect on performance at all if you fix it.

    I will say this though the performance is pretty great on my htc tmobile g2 with 800mhz scorpion (snapdragon) processor and 512mb ram
     
  8. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    Also if you dont mind, before your next update, if you could rename your classes to start with a capitol letter, so they match conventions of "classes start with a capitol, variables start with a lowercase" that way we if we wanted to write a variable referencing glareFxCheapMobile, the class could have a capital G, and our variable would have a lowercase g. thanks.
     
  9. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    so great news after restarting unity several times, it now allows your glarefx to work on mobile, while being in emulation mode. it looks to be a shader import issue that it doesnt recognize that i switched it to mobile in the scene. very strange.
     
  10. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
  11. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    Congratulations on releasing game! I can see that you used this effect delicate so on static images its hard to notice it. But very good job!
     
  12. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    I had to temporarily remove this effect, could you please check this shader on galaxy s4, htc one, lg optimus g, sony experia z1, there may be an issue with lowp used in your shaders on the adreno 320/330, it works on nexus4 and nexus7 just not on any of those other devices i first listed.

    could you please test this?
     
  13. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    the issue is possibly related to Low Precision, lowp in shaders (xfloat), gllinkprogram in shaders, try/catch in classes, or certain uses of arrays in shaders. if any of these sound familiar for your mobile shader please test it on galaxy s4/htc one, or any other qualcomm quad core with adreno 320/330 except for amazon HDX and Nexus 4 /7, as these devices have proper fixes in place for this scenario.
     
  14. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    So you wanna me make shader that dont use lowp (fixed) only medp (half) ?
    In my different mobile asset I made special shader for adreno without using clip() function but I didnt know that you cant use lowp also ...
     
  15. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    so it turns out that by switching them all to mediump, instead of lowp, fixed the issue, however it seems to have flipped the screen around, i think this may be related to a different option but i dont have the device to test.

    i can tell you this though there are plenty of other post effects with the same issue crashing galaxy s4, including the mobile bloom shader going around, currently uses fixed/lowp and crashes galaxy s4. haven't tested unitys built in or its angry bots demo... i really wish i had a device to test.

    but this is the current situation, if you want my advice, make 2 versions of the shader, and just change it to mediump and call it _Adreno300 shader, with documentation, since you are already making clip() for it specifically. unless you can just detect if its adreno 3xx in the shader i dunno. but good luck to you.
     
  16. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    OK thanks for info I will make one and send you on PM to test it out.
     
  17. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    btw it all works perfectly fine on non adreno 320 devices. im sure its just a bug that hasnt yet been addressed, even dead trigger had this bug according to their forums. wish they would send us the solution =P
     
  18. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    PM sent
     
  19. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Any idea why my screen went purple after applying this? I can't see any of my scene, just solid purple.

    Edit: Turning DX11 off fixed it.
     
    Last edited: Mar 13, 2014
  20. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    If you wanna use effect uder DX11 - unpack zip with DX11 shaders and use those.
     
  21. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    Hello!

    2.1 submitted to Asset Store

    Whats news :

    - all shaders are now available with source so you can made your modyfications
    - fixed problems with flipped screen with AA
    - added new Classic Advanced shader with new type of rendering effect

    If you have any requests - please let me know
     
  22. Janith

    Janith

    Joined:
    Sep 1, 2014
    Posts:
    12
    i downloaded this how to use this ! i'm new to here
     
  23. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    There is readme.txt there :

    Usage
    -----
    Simply drag one of 3 scripts to your camera. Default settings will be provided. You can play with it to achieve desire effects.
     
  24. Janith

    Janith

    Joined:
    Sep 1, 2014
    Posts:
    12
    thanks ! :)
     
  25. Janith

    Janith

    Joined:
    Sep 1, 2014
    Posts:
    12
    can't use image filters (npot-RT are not supported or RT are disabled Completely ) i got this error ! :( i'm noob and donlt know what to do !
     
  26. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    You need Unity PRO for this plugin
     
  27. Janith

    Janith

    Joined:
    Sep 1, 2014
    Posts:
    12
    Nooooo ! i purchased this thing ?
     
  28. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    There is a description about PRO requirement. You can also make refund.
     
  29. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    Does this work with Unity5?
     
  30. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    We got some info that it dont works on Unity 5.x but we will update it today
     
  31. reddotgames

    reddotgames

    Joined:
    Apr 5, 2011
    Posts:
    707
    Version 3.0 submitted to review!
    Added support to Unity 5.x
    + fixed some issues (flipped screen etc)
     
    TanselAltinel likes this.
  32. droni

    droni

    Joined:
    Jul 25, 2014
    Posts:
    10
    Dirty Lens flares are really great but i dont got enough money D: :( i am only 15 years old good job continue making this kind of stuff
     
    Last edited: Jul 18, 2015
  33. nxtboyIII

    nxtboyIII

    Joined:
    Jun 4, 2015
    Posts:
    281
    Does this work for Unity 5.2? Someone said in a review that it doesn't. Thanks
     
  34. ofusion

    ofusion

    Joined:
    Dec 5, 2013
    Posts:
    27
    I use glareFxCheapMobile on my camera, the screen goes pink on iPhone6s, but works right on iTouch5.
    Then I log shader.isSupported, and the result is glareFxCheapMobile.shader is not supported on iPhone6s, but supported on iTouch5:eek:. I'm using Unity 4.6 and glareFX 1.7
     
  35. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    asset store link down? can't download it
     
  36. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,665
    Looks like it got deprecated for whatever reason. There's another asset called dirtFX by the same developer, but I highly doubt it will work with newer Unity versions (the latest update came out in December 2013).

    You could give SE Natural Bloom Dirty Lens a try - it went free and open source recently :)

    Alternatively, use the Post Processing Stack (install via the Package Manager) and enable Bloom. There should be an option for Lens Dirt (Dirtiness).
     
    Last edited: Jul 4, 2019
    friuns3 likes this.
  37. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    @Mauri others i tried only work with bloom, but i would like to have it only with flare when watch directly at sun.