Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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
    Update 1.1.0 is live and ready to download on Asset Store.

    Next stop: point & spot light support.
     
  2. adventurefan

    adventurefan

    Joined:
    Jan 17, 2014
    Posts:
    230
    I'm curious as to how those features will work. Are they going to combine with directional light or replace it? And will one particle system support multiple moving lights, etc?
     
  3. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I have not yet decided how to approach this problem. It should be possible to enable/disable multi light support so that mobile users could build cheapest shader version possible and PC/consoles could benefit full-dynamic light support.

    Current implementation is based on per-particle lighting model. The cheapest option is doing all calculations per-vertex. For PC and consoles it should be possible to tessellate each particle to increase vertex density and improve lighting quality.
     
    DrewMedina, adventurefan and punk like this.
  4. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I'm off on vacations until 9th August so all requests, questions or bug reports will have to wait.
     
  5. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    Anyone tried to take a build with the plugin?
    It gives bunch of errors that are related to included UnityEditor namespace. I had to include them in #if so I could take a build.
     
  6. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Could you send me these error messages?
     
  7. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    EMGenerateCamMatrix.cs file had reference to UnityEditor which does not allow me to take a build. I put it inside in #if UNITY_EDITOR clause to get around it and still let it work in editor.
     
  8. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Yea, that should do the trick.

    There are some major changes in particles inside Unity 5.2. They are now generated in world space instead camera space! Specular particles are now possible and all light calculations are going to be soooo much easier!

    Because of this awesomeness new version of Particle Shaders won't have EMGenerateCamMatrix script as it will no longer be needed. Support for pre Unity 5.2 will be dropped.
     
    elbows and hopeful like this.
  9. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Version 1.2 has been uploaded and should be live within few days. Changelog:
    • dropped support for Unity versions older than 5.2
    • done some slight optimizations (4 to 2 max instructions per vertex depending on the platform)
    • half-lambert lighting is now properly implemented
    • Thickness factor can now be set from 0 (blackest shadows) to 1 (no visible shadows at all)
    • EMGenerateCamMatrix is no longer needed (Distance Fade works out of the box)
     
  10. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Would Unity 5.2 allow for particles to receive shadows now ?
    I'm asking because particles are now generated in world space instead of camera space ?
     
  11. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Hi, I've seen you're cigarette particle but how can I slow speed of smoke? it's fast and I need to slow down particle speed but I can't do that
     
  12. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Not yet but it simplifies this task.

    You need to decrease Velocity Over Lifetime and Speed values and increase Lifetime value. This way they will be slower but staying on the scene longer.

    Point&Spotlight update.
     
    led_bet, overthere, elbows and 2 others like this.
  13. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    @varfare : Cool :) So, do you think this will be something to be added ? Shadows on particles ?
     
  14. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Well, it's on my roadmap but I don't know when I am going to add it exactly - a lot of research needs to be done in this area. I am currently working on multi-light support.
     
    led_bet and elbows like this.
  15. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I'm keeping an eye on this. Particles with soft edges and able to receive shadows would be really sweet to make more realistic smoke effects.
     
  16. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Oh yeah, I vote for receiving shadows on particles too
     
  17. dzq1ru

    dzq1ru

    Joined:
    Aug 13, 2014
    Posts:
    2
    Very nice shader, thank you! I'm wainig for multi-light and shadows reciever too.
     
  18. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    This looks great, it is certainly on my purchase list :) One question is it possible when I have made the purchase that the 3ds max file can be shared that was used to animate the smoke, would really like to be able to tweak the animations?
     
  19. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Well, I did not use pure 3ds max to animate the smoke. I simulated it with FumeFX plugin. If you have it I can send you the file but I need to check if it's still on my HDD.
     
  20. overthere

    overthere

    Joined:
    Jun 28, 2013
    Posts:
    110
    Hi would this shader work with Particle Playground assets? Or does PP's extension of the Shuriken system preclude that?
    In relation to shadowing PP's documentation shows that particle shadowing information for shaders can be exposed if thats relevant.
    Thanks
     
  21. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I have not tested my shaders with PP. If it allows you to assign custom material then you should be good to go.
     
    overthere likes this.
  22. overthere

    overthere

    Joined:
    Jun 28, 2013
    Posts:
    110
    Tested and it works with Particle Playground assets in case anyone else needs to know :)
     
  23. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Hi there, any update on multi light support or shadows on particles? Thanks
     
  24. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Yes. It should be included in the update which will available next month.
     
    overthere likes this.
  25. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Ok great, thanks.
     
  26. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Any other new features or improvements coming in the next update?
     
  27. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Multi-light + some video tutorials (after the release).
     
  28. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Version 1.3 has been submitted for Asset Store approval. 1.3 brings multi-light support!
    You can download PC demo here.
    This will be the last version which supports DX9. All new versions are going to be DX11 only.

    Some pics:





    New version should be available on the Asset Store within a few days.

    Next stop:
    - static shadows receiving
    - per-vertex lighting (heavy optimizations)
     
    ksam2, hopeful, chiapet1021 and 4 others like this.
  29. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Version 1.3 is now available on the Asset Store!
     
    TanselAltinel, overthere and hopeful like this.
  30. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Looks great, thanks for the update!
     
  31. StRaToX

    StRaToX

    Joined:
    Jul 21, 2015
    Posts:
    3
    cant wait for shadow receiving
     
  32. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I would like to request that spotlight shapes have a min and max cone radius or support funky shapes if that's at all possible, plus info on best practises for performance.... any info welcome! Anything that would avoid having to do too many light passes in deferred.

    Maybe cookie support from light could reduce it a bit. Got a lot of car headlight stuff.

    Any plans on optimisation as I imagine its pretty heavy?
    Thanks :)


    edit: just bought and it doesn't seem to play too well with deferred or my settings at the moment. Having a hard time trying to get the light to only affect particles and so on...
     
    Last edited: Mar 4, 2016
  33. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Could you tell me what quality&player settings do you have? Could you also tell me a little bit more about your problems?

    About the optimization. Current version does per-pixel light calculations. I am working on per-vertex lighting which will reduce shader costs significantly. Here's the catch: it will be dx11 only because I have to tesselate the particles in order to get better light "resolution". I will also add per-vertex mode for mobiles but, as you can imagine, it will only sample light at the corners of the particle. Another limitation is going to be the number of supported lights. Because of Unity's Forward Path limitations it would only support maximum of 4 light per particle system.
     
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's just deferred/linear/hdr I'm using. I probably didn't make a good job of integrating it, will have another shot in future :)
     
  35. IDsmaugsFire

    IDsmaugsFire

    Joined:
    Mar 10, 2016
    Posts:
    1
    Hi! I purchased this to try it out in my project. I have the shader on a cloud in the sky and when it casts a shadow... the shadow flickers on and off in certain angles.... ie: if I run the character around on the ground under the cloud... the shadow of the cloud is only visible from 180 degrees...

    This really doesn't work for me as cloud shadows are pretty much what I really wanted to use it for... (and casting spotlights through a fog bank).

    Any ideas? I played around with the particle billboarding, this seems to change the shadow, but no setting I found fixed the issue for me.

    I'll hold off voting on the asset till I hear back/resolution is made.

    Thanks! :)
     
  36. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I think you might be better off using light cookies for that, why don't you use those?
     
  37. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I know that there was a similar bug in Unity some time ago (in 5.1) - particles were not rendered at certain angles. I remember that setting particle system from local space to world space was a temporary fix for this. Could you try this and tell me if it worked?

    Also, if you don't need to see the clouds but you want some cloud shadows, you should take a look at other solutions. I know that my package is capable of doing this but I know from experience that particle clouds are a huge performance bottleneck. There is a reason why you don't see this in games a lot. If you need just few clouds here and there, you'll be fine. But if you want to cover a whole sky with particles then you are probably going to kill your graphics card.
     
  38. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    @varfare:

    Hello, sir!

    I am attempting to use your shader in a Unity v5.4.0b12 DX11 project with a Windows (x86) build target and am receiving the following errors:
    Code (CSharp):
    1. Maximum number (128) of shader keywords exceeded, keyword SOFTPARTICLE_ON will be ignored.
    2. Maximum number (128) of shader keywords exceeded, keyword DISTANCEFADE_ON will be ignored.
    3. Maximum number (128) of shader keywords exceeded, keyword EMISSION_ON will be ignored.
    4. Maximum number (128) of shader keywords exceeded, keyword ALPHAEROSION_ON will be ignored.
    Any assistance with resolving these errors is greatly appreciated.

    Thank you in advance!
    - S.
     
  39. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I have sent you an email so please, check your mailbox.
     
    S_Darkwell likes this.
  40. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    I've received it.

    Thank you!
    - S.
     
  41. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Unfortunately, this issue is related to some kind of internal Unity 5.4 bug. Many users are reporting exactly the same issues as these which you have encountered (you can go to this thread to read about it: http://forum.unity3d.com/threads/shader-errors-block-build-in-5-4b13.396496/ ). Because Unity 5.4 is still in beta and there is no official information whether it is a bug or a feature there will be no updates for Particle Shaders
     
    S_Darkwell likes this.
  42. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    Thank you for the response. It seems the recent Unity betas have a number of shader issues, even beyond this one.

    Hopefully they will patch these soon.

    Thank you and be well!
    - S.
     
  43. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi, I recently bought another package which has less features than yours, and I'm interested in purchasing it.

    One thing that I'm really not sure on how to handle it is the normal map generation.

    Is it hard to do? How do you make it if you start with a hand-drawn - or anyway, non-3D rendered - particle texture?

    Thanks for your time :)
     
  44. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Hi NeatWolf! Thanks for your interest in my product!

    In reply to your question - you don't have to generate anything at all. Normals are taken directly from Shuriken's "particle normal" feature (it's just a slider with a 0-1 value hidden inside Rendering Tab). There is no need for a special normal map texture. In fact, it is not even possible to assign your own normal map. The workflow is exactly the same as with built-in Unity particle shaders. You simply create a material, select Lit Particle Shader, assign your texture (it can be generated, hand drawn etc.) and voila! You're done.
     
  45. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    Hi, I am interested in your product. Does it support HDR? And does it work with unity's SSRR?
     
  46. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    I have not tested it with SSRR yet but I do not see any reasons why it won't work. I'll try to find some time to test this out this week.

    Emission is LDR but I am going to add a small update which allows you to set HDR emission (and HDR additive particles).
     
    hopeful likes this.
  47. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    470
    Hi varfare, do you know if would I be able to light these particles with objects which use standard shader emission?
     
  48. varfare

    varfare

    Joined:
    Feb 12, 2013
    Posts:
    227
    Hi Shizola. Emissive light receiving is not possible. There is no performance-wise method that I am aware of which would allow this type of effect. Cheers.
     
  49. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    470
    Ah that's a shame, thanks anyway.
     
  50. MalboM

    MalboM

    Joined:
    Apr 29, 2013
    Posts:
    66
    Hello!
    I just bought the plugin, but I see all the shaders violet (I think missing shader)
    do you know what could it be?
    I have unity 5.4.0 pro