Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Particle Shaders Vol. 1 - Including Lit Particles

Discussion in 'Assets and Asset Store' started by varfare, Apr 20, 2015.

  1. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Hi MalboM. Could you send me the console logs and screenshots on PM? Thanks!
     
  2. Quiet-Pixel

    Quiet-Pixel

    Joined:
    Aug 23, 2013
    Posts:
    44
    Your example scene and scripts have grown stale. They do not compile and run correctly in Unity 5.5.0f3.

    In the ExampleControllers.cs class, the following type instantiations have to be changed from:

    Instantiate(m_Examples[m_CurrentExample].Prefab,Vector3.zero,Quaternion.identity)asGameObject;

    to

    Instantiate(m_Examples[m_CurrentExample].Prefab.gameObject,Vector3.zero,Quaternion.identity)asGameObject;

    In the LightRig.cs class, the Update function is querying the state of a button that is not defined:

    if(Input.GetButtonDown("AnimateLight"))
    ToggleLightAnimation();


    The demo does not show the particle effects, or allow you to switch between them.
     
  3. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Thanks for letting me know. I'll update the package as soon as possible. Cheers!
     
  4. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Sample scene fix for Unity 5.5 will be slightly delayed (few days max). This is because I decided to implement few new features. One of them is HDR emissive color. You can use it in conjunction with Bloom/Glow image effect to get some... glow :)
     
  5. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I also implemented an experimental transluscency lighting mode. It's using an alpha channel to generate light transmission ramp. It is also dependent on the Thickness factor so the thicker your material is, the less light is being transmitted to the back.

    These images are showing a smoke column seen from the back. The light is placed behind it and has a blue tint just for the sake of making the effect more visible on the screenshots.

    Backlight turned on


    Backlight turned off (old behavior)
     
    gurayg, chiapet1021 and CaptainMurphy like this.
  6. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Another feature that will be added in upcoming update: smooth frame blending. This is the same technique which is available in Anim Alpha Blend shader which is built-in into Unity 5.5 ( https://docs.unity3d.com/Manual/PartSysVertexStreams.html ). There are better alternatives such as optical flow (
    ) but this one is really cheap and does not require any additional authoring.
     
  7. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    376
    Everything broken in 5.6 :(
     
    Gua and CaptainMurphy like this.
  8. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    361
    There's a problem in Multi Light Shader on 5.6

    Shader error in 'Ethical Motion/Particles/Lit MultiLight': Too many texture interpolators would be used for ForwardBase pass (9 out of max 8), try adding #pragma target 3.0 at line 27
     
  9. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I tracked down the issue. I'll be submitting a fix tomorrow so it should be available for you guys within next few days. Once I'll have the final code ready, I'll send you guys a temporary fix on PM.
     
  10. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Ok, so here's the quick fix:
    1. Open EM_Particles_Lit_MultiLight.shader
    2. Replace line 29 with this: #pragma target 3.0
    3. Save and you are done

    Fix will be available within few next days after Asset Store approval.
     
  11. CosmosBear

    CosmosBear

    Joined:
    Aug 2, 2012
    Posts:
    60
    Hi!
    I have already notified Unity but there is a crash when graphics jobs are enabled and in a standalone build
    when using too much dynamic light and particles (Lit Multi in our case).

    You can get the small project/example scene here:
    https://drive.google.com/open?id=0B0VEjM4cPGfHOG1wLXM5OGdvLVU

    Here is the repro I sent to Unity:

    1. Open the project
    2. Notice in the scene, there is a GO called "Object Group". Now there is a bunch of particle and light in it.
    3. Now make a build
    4. If you haven't crashed yet, it's because "Object Group" is deactivated, press "A" to activate it
    5. If you haven't crashed yet go back to the project and duplicate more "Vfx Spawn_Base" from "Objetcs group"
    6. Now repeat from 3

    Cheers!
     
  12. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Hey, thanks for a great repo steps. I'll take a look at that. I am not sure if this has anything to do with my shader as I am using standard Surface Shader as a foundation or is is just something that graphics jobs are doing wrong (this is still experimental) but obviously something is wrong here.

    Which Unity version are you using exactly? I recently made a build on 5.6.0 with graphics jobs enabled without any problems.
     
  13. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,057
    Got any guess when you'll have shadow-receiving working?
     
  14. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    As you probably figured out this is taking much more time than it should. I think I will only create static shadow receiving for this version of the package. I need to rewrite the whole shader in order to get new functionalities. I am using surface shaders as a base so there a lot of limitations here. I'll try to push better lighting and static shadow receiving this year. I know this sounds like a lot of time but I am developing this package in my free time. Cheers!
     
    hopeful likes this.
  15. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,057
    Thanks for the update, and I understand about time constraints -- I don't really need this until early next year. And static shadow receiving is all I need, so I'll hope you can figure it out!
     
  16. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    New update (1.5) uploaded. Should be live withing few days. Documentation was updated too. Changelog:
    • Refined diffuse lighting model (energy conservative)

    • Improved backlighting feature

    • Fixed material editor GUI undo/redo

    • Fixed material editor backlight toggle which was disappearing after untoggling

    • Minimum allowed Thickness is now 0.01 in order to avoid 0 division issues
     
    punk and hopeful like this.
  17. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,251
    I would like just thanks for such great asset.

    Here is some my experimenting with it. Which I am quite happy for results at this stage.



    I allow myself to copy my review, form asset store (version before 1.5)
    "
    Works perfectly fine with Unity 2017 beta.

    Was looking for cloud solution with shadow casting, well for a while. This provided what I needed. At least, haven't noticed major flows (yet) ;)

    At first when I started asset scene, I looked at fps. And surprisingly were very low, as of almost empty scene, with few objects. But soon realised, the scene was field with additional fancy stuff. After disabling these, fps runs between 1000 and 4000 fps, on my 5 years old PC rig.

    Managed to adopt cloud system with over 500 particles and even 1000 and shadow casting. Works great. I think even better than initially expected. Been worried, that shadow casting will eat fps. But runs smoothly, almost like idle scene.

    Many thanks for providing it.
    "
     
    overthere, Alverik and varfare like this.
  18. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Hah, this is great! I'd like to see more of this in the future :) Also, if you have any feature requests for you system - give me a shout. If it will feel interesting enough I could implement something new.

    Also, 1.5 is live for Unity 5.5. Version for 5.6 should be available pretty soon too.
     
    Last edited: Jul 9, 2017
  19. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,251
    Sure, I will update on progress, when time comes, along with progression of my project.
    For now is a bit slow, as I fight with number of challenges at once ;)

    Cloud asset is quite flexible already, hence it allows for high variety of applications as it is now.

    But I got few suggestions. Let us know, if any feels feasible, or/and interesting to you. Mind, I may be wandering outside of the scope of your project.

    1. Fog control.
    In my prototype, i got value, which determines strength of the cloud weather, from light cloudy to heavy thunder storm. At the moment I am utilising inbuilt Unity fog system. When is stormy and camera is entering under (for most generic applications, other than planetary weather system) the clouds, fog is thickening. And if exiting, fog is fading out. Personally I need more work on that, as mostly fog is on off, even meant go smoothly on off. Perhaps lerp method can be used, or other sort of function. I haven't researched following yet, but maybe there is useful shader for that job, to get best effect result?

    2. Tornado
    Any thoughts, what would be the best approach to form spinning clouds alike tornado? I guess external forces?
    Is this something that could be looked at your clouds asset itself? In particular I am interested on view from top, rather than twister itself hitting the ground, as this may require different approach.

    3. Thunder Lightning Bolt
    Another thing, I would like to investigate later, is thunder lightnings bolt from clouds. I got flashing lights, as you can see on video, but atm. I guess, there should be object, which can be attachable to such flashes, which would allow to 'generate' thunder bolts. But again, this may be out of scope of cloud asset?

    These are quick thoughts out top of my head atm. if I came up with more relevant suggestion I shall drop the line or 2.


    Edit:

    Just to add, in respect to my point 3. It could be interesting, to see for example fantasy fire, where bolts shooting in different directions from the smoke. Or maybe some form of energy.


    Thx,

    Anty
     
    Last edited: Jul 12, 2017
  20. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    1. I think you can just drive the fog strength in code to get some smooth results. Lerping is one way to go here
    2. Depends on a tornado. There are numerous of ways to approach this effect. In the past I made tornado with custom shader on a mesh. If you want to use particle approach, I would bake twisting motion to the texture and use many particles with distance sorting.
    3. I am going to do some emission module improvements for sure. Let's just say you have an explosion. Typical scenario is that you have smoke and fire in one texture. What you want is to alpha blend the smoke and use additive blending with HDR values for fire. My plan is to allow a user to put one texture for the alpha blended background and another one for additive HDR foreground. This way you could bake lightning glow in texture sheet and play it inside shuriken.
     
  21. gaiastellar

    gaiastellar

    Joined:
    Nov 8, 2013
    Posts:
    47
    Hi. Does this support being lit by emmisive materials? I have a situation where emmisive particles (stars in my case), need to light surrounding nebula/ gas/ fog?

    Thanks
     
  22. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    You can use light module to cast actual light on other particles to lit them up but receiving emissision from material only is not supported. This would have to be baked into realtime GI and somehow sampled in particles but that is quite costly.

    So yes, this is possible with a proper approach.
     
  23. redemprez

    redemprez

    Joined:
    Aug 14, 2017
    Posts:
    29
    Great asset, bought today, I really like that I can finally lit my particles with point lights :) I would like to use DOF on them too, so I would like to ask: is there an estimated date of arrival of cut-out particles shader?
     
  24. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Cut-out particles are not hard to implement but it is currently not on the top of my list. It might appear somewhere at the beginning of next year tho.
     
    redemprez likes this.
  25. Firgof

    Firgof

    Joined:
    Mar 7, 2013
    Posts:
    3
    Isn't working on my end. I put an enormous 15.16 Intensity RT point light right next to one of your example particle systems and it isn't affected at all. I'm on 2017.2.0f3.



    Edit: Changed some of my test-settings a bit as well as the particle itself. If it's not pure black and I put the light far away from it then it does get slightly lit - but it doesn't handle close-in lighting well it seems.

    Edit 2: After changing various settings and working with particularly-set lights that only light the particle systems themselves, I've achieved the results I was looking for more or less.

     
    Last edited: Oct 24, 2017
  26. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    There are few things which might be causing some issues:
    • Try increasing pixel light count in project's quality settings window (this sets how many lights can affect each object rendered in forward transparent pass before they start being sampled per-vertex)
    • Could you select each of my shaders one by one in project window and tell me if there are any warnings/errors? (you will see a dialog window in inspector after selecting a shader file)
    • Which shaders are applied to materials used in this effect? I know you said that this comes from provided examples but maybe Unity changed things after importing to your project
     
  27. redemprez

    redemprez

    Joined:
    Aug 14, 2017
    Posts:
    29
    Thanks. I hope it will not be long time till you implement this. DOF on particles looks great in Unreal, I would like to create similar effect in Unity :D
     
  28. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I have some bad/good news.

    Next week I will be removing my package from the Asset Store. It will be released free of charge on git without any guarantee of future updates.

    I can't focus on developing the package as much as I would like to and I simply can't charge anyone knowing that I'm not capable of providing bug fixed and new features on time.
     
  29. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    7,251
    Oh no :( That superb project in my opinion, should deserve for more attention. I really hope, somebody will pick up on this and fork, to improve. Anyway, thank you for such great asset and all the best. ;) I just hope, it will not break anytime soon.
     
  30. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Believe me, it's not that I don't want to develop the package any further but I just don't have enough time to keep it up to date and improve it at the same time. I am not working in Unity anymore so this was more of my side project. Maybe one day I'll go back to full-time Unity development and I'll release new version of this package. But in the meanwhile, you can grab the package for free and use as is - I just submitted it to the Asset Store for approval so it should be live within couple of next days. Will be submitting to GIT later on.
     
    Antypodish, hopeful and Alverik like this.
  31. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @varfare Let me just say, that as a paying customer and appreciator of your assets, I really like the route of turning the asset open source in lieu of just not supporting and/or updating it. I despise when authors would rather just stop supporting and deprecate their assets instead of letting their work become appreciated as an open source project, so kudos to you for choosing a route that lets your work be appreciated beyond the ones that have paid for it in the past.
     
    hopeful and Alverik like this.
  32. Zergling103

    Zergling103

    Joined:
    Aug 16, 2011
    Posts:
    286
    I have a problem with the shader - the lighting fades out completely in the distance (which is where the lighting is needed) and makes it look like flat shaded terribleness. (This is distinct from the alpha fading that fades out opacity - this just fades out the lighting itself.) Where in the shader is this fading out of lighting happening so I can kill it?
     
  33. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    317
    Thanks for such a great work been done. Exactly what I been looking for, and it works perfect in Unity 2018/2019.
    The only issue I found is that using a grayscale texture for particles, the edges are dark, not like normal Additive shader do render. Maybe someone found how to fix it?
    Would be a great idea to create a git repo allowing community to edit and improve it.
     
unityunity