Search Unity

Volumetric Smoke Shader

Discussion in 'Works In Progress - Archive' started by jack-riddell, Sep 30, 2015.

  1. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    That looks really nice! Any ETA for the initial release?
     
  2. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    302
    does the smoke collide with objects and disperse naturally?
     
  3. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    from what i understand they use a separate texture that is rendered out the same time as the shadow depth pass is rendered. Unfortunately to make that work efficiently i would have to re write the unity shadow system which I don't think i have access to. in the past i have written code to render out the shadows from particles to a separate texture but getting the particle shadows and the hard shadows to merge neatly where the edges of the 2 meet is not easy.
    i used that technique on a game called Torque Burnout but got away with a few errors because of the simplicity of the world.
     
  4. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Hmm you can use command buffer to access shadowMap
     
  5. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    probably but if i went down that rout i would need to replace all the standard shaders in unity to make use of it which is not something i have the resources to do at the moment. if i make enough money off this project its on my list of things to do.
     
  6. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    im fixing a few remaining technical issues (hard objects cause flickering when light direction changes at low resolution) but once that is done all that's left is paperwork, documentation and example scenes. I am hoping to be done by the end of the month or early next month.
     
    Martin_H and Seith like this.
  7. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    :cool:
     
  8. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    a look into the insides of my system
    FOM in action.png
     
    Martin_H and hippocoder like this.
  9. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Shadow flickering mostly fixed when the light direction is changing.
    SmokeShadowsTest11.gif
     
    John-G, SAOTA, ZJP and 2 others like this.
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    A lot of games probably don't actually need the shadow dynamic, perhaps that offers a way for you to optimise?
     
    ZJP, Martin_H and S4G4N like this.
  11. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    your still going to want it for dynamic objects like doors opening or walls being blown up.
    if your lighting direction is static you can get away with a low resolution shadow map (im using a 64 by 64 map in the earlier bridge post) but when the light direction changes the big shadow pixels causes popping artifacts.
     
  12. barker_s

    barker_s

    Joined:
    Jul 17, 2012
    Posts:
    29
    Great job, I'll certainly keep an eye on this one. If you could also make it so that the particles are lit by spot/point lights, that's an instant purchase for me. I kinda wish that Unity would support this out of the box, since properly lit and shaded particles help building the right atmosphere immensely (see Alien:Isolation). Any info on the price so far?
     
    Martin_H likes this.
  13. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    At the moment I am only doing one directional light for performance reasons. if the package sells well i have plans for a setup that can do unlimited lights at hopefully grater frame rates than other solutions available.
     
  14. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    So a bit of an update on the shader progress.
    The base mega shader had 10 different option categories like lighting quality normal mapping and shadow setting, each option has between 2 to 3 settings which has resulted in a total of 3456 different shader variations. i have written some code to help me generate some of the code for all these different versions but it is still slowing me down at the moment.
     
  15. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Latest version of renderer with soft particles added

     
    John-G and ZJP like this.
  16. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    It's seem you are ready now a release. :D
     
  17. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    that scene is one i have been working on for an example scene in the final release.

    all the base code is there and everything works fine on my computer but there is still a lot of things left to do like test on different platforms and develop documentation.
    Making things idiot proof takes a while.

    one of the things on my list of stuff to do is to run a beta test if your interested?
     
    John-G and S_Darkwell like this.
  18. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    If you need more than a single beta tester, I would certainly be interested.

    OS: Windows 10 Professional
    CPU: AMD FX-9370 Eight-Core Processor
    GPU: NVidia GeForce GTX980

    - S.
     
  19. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    I am, as i'm interested in the Windows desktop version only.
    3 Configs.
    a)
    OS : Windows 7 - 32B Pro
    CPU: AMD AMD Athlon II X2 270
    GPU: nVidia GeForce 9800GT :D

    b)
    OS : Windows 7 - 32B Pro
    CPU: INTEL C2Q Q8300 @ 3Ghz
    GPU: nVidia GeForce 470GTX

    c)
    OS : Windows 7 - 32B Pro & 64B - Pro
    CPU: AMD FX-8350
    GPU: Radeon HD7850
     
    Last edited: Dec 6, 2015
  20. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    is it just me or the particle fading doesn't working in your latest video?
     
  21. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    one of the problems i have been facing is how to test performance on the particle systems. my computer gets bottle necked on the cpu generating the particle clouds long before the shader performance becomes an issue so if anyone has a crappy computer especially one with an old graphics card (must be able to run Direct x 9) that would be a huge help
     
  22. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    The shadows in the first screenshots looked a bit angular but that seems fixed in the latest video. Looking fantastic so far.
     
  23. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I have a netbook that is reeeeally S***ty but should support dx9. I don't have unity installed on it though and I doubt it would run. If you have a compiled .exe or webplugin version that displays fps I'll be happy to run it.

    My primary system is an intel i7, GTX 670, Windows 7 64bit. If you want me to test something, just send me a PM.
     
  24. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Like my config 'a' :p:D
     
  25. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Just put together a new test scene which came out better than i was expecting. the key to getting the most out of my system it seems is having relatively small contained particle effects as opposed to large spaced out effects like long smoke trails or large volumes of mostly transparent fog.
     
  26. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
  27. Nyt0x

    Nyt0x

    Joined:
    Feb 3, 2014
    Posts:
    18
    Looks nice. :)
     
  28. Alabatross

    Alabatross

    Joined:
    Dec 15, 2012
    Posts:
    223
    That looks great!

    Do you mind posting a screenshot of the particle settings on your cannons? I'm curious how you got them to slow down like that after quickly shooting out and then lingering. It'd look great for some artillery I'm working on :D
     
  29. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    sure no problem although my settings are far from perfect, ideally you would want a script to intelligently spawn the particles in to get a more correct initial shape as opposed to the blunt nosed cone I'm getting.
    Cannon Smoke Settings.png
    Hope that helps, post some screen shots of how it turns out if you can.
     
    John-G likes this.
  30. Alabatross

    Alabatross

    Joined:
    Dec 15, 2012
    Posts:
    223
    I completely missed the dampen option! That's what it was, thanks!
     
  31. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Looking better and better :)
    Can you take a shot with the camera going through the smoke? just to see how it looks
     
    Martin_H likes this.
  32. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    ill see if i can get a gif of it but it wont look that much different than other particle systems.
     
  33. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
  34. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Look very nice, seem works pretty well, disponible even on DX9 and perfectly integrated to my Artistic Direction. "What else? :cool:
     
  35. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Thanks, yeah looks like it. Still looks great though :)
     
  36. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Prototype for the asset store icon made using my particle renderer in the unity editor. performance isn't the best but it kept a steady 40 fps while spewing out 10,000 particles per layer.
    IconPrototype.png
     
    FPires, eskovas, popupAsylum and 2 others like this.
  37. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Smoky sandwich... :p
     
    Martin_H likes this.
  38. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    How adaptable would your shader be to other types of lit particles -- dust, for example?
    - S.
     
  39. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    If we had access to a "density" value that lets us gradually change how intense the shadow casting of the particles is, that could probably make it easier to adapt the system to a greater variety of usecases.


    Edit: stumbled upon a reference photo that I liked. Would something like this be possible with the shader?

     
    Last edited: Dec 8, 2015
  40. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    my system might be able to reproduce that effect but it would require some tweaking, a lot of particles and a good particle sprite sheet. At the moment my system captures the volumetrics of the particle system at a fixed resolution
    the bigger the particle system or systems the lower the quality gets but it also has some functionality to fake the smaller details.
    This is the level of quality i normally get out of my particle renderer but the sprite I'm using is not very good and I'm sure a decent particle effect artist could do better.


    The shadow casting its an adjustable amount linked to the alpha of each particle kinda like in real life so you can have a dense cloud that doesn't block much light or you can have a mostly transparent cloud that blocks a lot of light but you cant have a cloud that goes from dense but not blocking light to transparent but blocking a lot of light but im not sure why you would want that.
     
  41. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Few more attempts at an asset store icon, if you have any ideas I'm all ears my art skills aren't my greatest strength.
    Smoke Renderer Icon Test 8.png Smoke Renderer Icon Test 4.png Smoke Renderer Icon Test 5.png
     
    Seith likes this.
  42. FPires

    FPires

    Joined:
    Jan 5, 2012
    Posts:
    151
    I like this one better. Simple and straight to the point.
     
  43. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    while working on icon ideas i made this which is sort of similar to the source image but the particle count is through the roof.
    Smoke Renderer Icon Test 9.png
     
  44. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    This is looking pretty good already. I'm looking forward to play around with it and try other particle sprites and animated spritesheets. I'm planning to do a smoke sim in blender and then maybe loop it in after effects.

    For the logo I like the cloud sandwich the most. I suggest to just use that as it is clear, simple and looks good.

    Have you decided on a price for the asset yet?

    And have you tested it with 5.3?
     
  45. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    i think im running the latest unity but i havent checked recently. at the moment my package is not backward compatible with unity 4 and versions of unity 5 that use the old shuriken shader format
     
  46. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I got the 5.3 announcement email yesterday. So unless you were in the Beta you probably are not up to date with your version.
     
  47. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    downloading it now. so have my eyes deceived me or have they added built in shadows to particle systems?
     
  48. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Someone correct me if i'm wrong, but i believe the shadow system they mention is what was already implemented in Unity. Meaning it only works for opaque shaders. You can check it by using a non particle type shader on the particle system, and those can cast and receive shadows.
    I don't see any mention on their docs about adding shadows to non opaque shaders like yours does.
     
  49. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    That was my first thought too, but why then mention it in the release log though?
     
  50. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    i don't think they have added volumetrics or proper transparent shadows otherwise they would be bragging about it i think they have just done what i have done to the shader and added dithered shadows.