Search Unity

Volumetric Smoke Shader

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

  1. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    it is complaining about a missing file, a quick search online tells me to delete a bunch of folders and force unity to do a rebuild. I am building from a beta version of 5.5 so a switch to the latest version might make the building more stable.
    As for camera interaction its possible but I am not sure what it would add.
     
  2. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    would the new vulcan api make it run faster?
     
  3. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Camera rotation. Just hook camera parent rotation to input horizontal and vertical
     
  4. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    maybe, its running very fast at the moment. Unity's vertex lit particles have a single texture fetch and a single multiplication for each pixel fragment. for plain non emissive smoke my shader has a single texture fetch, 4 multiplications and 3 additions. there is not much room for optimization.
     
    Martin_H and yc960 like this.
  5. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Looking great, especially that first scene. Is Lit Smoke and Fire 2 an upgrade to the first package or separate? If separate, what's the difference?
     
  6. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    separate. Its a completely new way of rendering the particles, all the textures have been converted to a new format, there is a bunch of new tools and the texture creation process has changed. Everything is different and incompatible with the existing version so I am splitting it off and making a new version.
     
    yc960 likes this.
  7. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Rendered out this image sequence for the new logo.
    this is captured from in unity.
    LogoRender.gif
     
    Lex4art, wetcircuit, Griffo and 2 others like this.
  8. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
    what are the new features/improvements again? I want to plan my use for it.
     
    jack-riddell likes this.
  9. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    basically everything the old one did plus light probe support. Also it is a lot faster, renders smoke a lot better and supports as many lights as you want with minimal slow down.
     
    yc960 and Martin_H like this.
  10. yc960

    yc960

    Joined:
    Apr 30, 2015
    Posts:
    228
  11. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    89
    Hi, @jack-riddell, how's it going with the release? Any updates on ETAs? I hate all that ETAs, but I'm just trying to make a schedule.

     
  12. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Got a bit delayed with a lung infection and a bunch of other crap. the core code and art are done I am now just trying to put together all the art which is dragging on longer than expected. The big issue is the number of particle texture and colour combinations at the moment I am looking at around 50 flame effects but given the tools I am bundling with the package you could make hundreds of different effects by mixing and matching colour, texture and settings combinations.
     
  13. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    So the tools I am shipping with the package will allow you to combine any smoke normal map with any smoke transparency map with any emisive map with any flame colour with any smoke blur or contrast settings. so i have 5 smoke normals, 5 transparency maps, 12 emissive maps, the textures could be red green or blue and have high or low contrast, high or low transparency and be in optimized or non optimized mode. By my calculation that's 5 x 5 x 12 x 3 x 2 x 2 x 2 or 7200 possible smoke combinations and that's without factoring in blur options. Obviously I am not going to make seven thousand smoke effects but even if I boil it down to the best combinations there is still quite a few smoke effects I need to make.
     
    yc960 and John-G like this.
  14. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    just finished off the smoke effects. the package will ship with 60 game ready smoke/fire prefabs in red green and blue colors
     
    yc960 likes this.
  15. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Asset is going to be delayed again because I have to move house. Share house politics is bullshit.
     
    Martin_H, IronDuke and crudeMe like this.
  16. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    89
    Hope you are doing well :). Sorry for keep bugging, but any updates on release date?
     
  17. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    still trying to fix a few small bugs. shader works fine in shader model 3.0 mode but I want to get it to work reliably in shader model 2.0 before release. the big problem at the moment is that shader model 2.0 has a 256 instruction limit on the vertex shader and with all the settings turned up to max I am using 270 instructions so I need to do some optimization. I am working on a package you can use for testing which I should be releasing soon. I will have moved house by the end of the month at the latest so release should not be long after that.
     
    crudeMe likes this.
  18. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Moved in to my new place and back to work. Good news is I think I have solved the 256 instruction problem the bad news is I think I have to scrap the distance fade feature to get in under the 256 instruction threshold. Are people using the distance fading options and will this be a big inconvenience to you?
    I am planning on including the code in the shader anyway and just comment out the multi compile option that enables it. If you really need it then it should be easy enough to re enable.

    In other news I need some people to do some beta testing is anyone interested?
     
    Martin_H and John-G like this.
  19. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,332
    Is this for the DirectX version? If so, then I am interested.
     
  20. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    this version is both direct x and openGL and will run on any platform.
     
    Martin_H likes this.
  21. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Ok so the current error I am having trouble fixing is a Maximum Temp Register Exceeded error. the funny thing is the shader compiles fine when the blend mode is set to "Blend SrcAlpha OneMinusSrcAlpha" but if i send the blend mode to "Blend One OneMinusSrcAlpha" the shader compiler S***s the bed and spews "Maximum Temp Register Exceeded" errors. Does anyone have any insight into whats going on here?
     
  22. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    the shader compiler gods have decided that my shader will now work. The shader gods work in mysterious ways I do not presume to understand their reasoning I only hope my sacrifice of sleep and sanity has pleased them.
     
  23. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,966
    Indeed. The shader gods are fickle and often bicker with the leftover material keyword gods.

    So got any details about the new product? apart from a nice looking 2? :)
     
  24. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Unfortunately It has been delayed a week. one of my friends went through a rough patch and i had to move in with her for a week to make sure she didn't do anything stupid.
     
    Martin_H and yc960 like this.
  25. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Ok finally back to work hopefully without any more interruptions. I haven't slept in my own bed 3 nights in a row for the last month so i am looking to a period of stability. So I have a release candidate I am readying for release and am looking for people who want to do some testing If your interested comment below and I will send you a testing build.
     
    Martin_H likes this.
  26. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,332
    Count me in :).
     
    jack-riddell likes this.
  27. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    89
    Quite intense start of the year you've got there. I hope everything will settle more or less. Is there anyway I can buy your package prior assetstore approval? Later you can give me a voucher or something to update via assetstore. I'm just getting closer to deadline without proper smoke shader, and it seems like your might work out.
    Also, it might be that we need some specific cases of smoke sprite sheets. Are there any special ways of preparing art for the shader?
    Thanks!
     
  28. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    I will add you to the beta testing so you can get the latest version to play around with. as for the art production pipeline its a bit involved and I haven't had time to write a full step by step guide on it yet. The basic process is the same as in Lit smoke and fire 1 but I have made a bunch of tools to make it easier/higher quality.

    This is the old way to make the art assets for Lit Smoke and Fire 1. With Lit Smoke and Fire 2 the tools for combining the images into a sprite sheet, Normalizing the normal map and embedding the emissive have been added directly into unity so you nolonger need the nivida, sprite sheet maker or photoshop tools which simplifys the production pipeline.
    https://docs.google.com/document/d/...9GVoM2JS2vd12FT06A/edit#heading=h.cpilwkf0oza

    If I don't get the documentation done In time for you I am happy to walk you through the steps to make the artwork and help problem solve.
     
  29. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    My internet is currently capped until 1am at night so I have been working on the blender files and instructions on how to make your own particle effects while I wait. this explosion will be part of the instructions on how to make your own.
    ExplosionFireball1.gif
     
    John-G likes this.
  30. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Hello jack-riddel.

    I am currently considering buying your asset, as I am looking for a way to lit my particles and transparent materials.
    One question that is critical for me is : is there anyway to make your asset work with a custom shader (made with ASE)?
    I was wondering that because it seems that your asset uses a lot of codes, maybe is it possible?
     
  31. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    From my experience it is very hard to merge hand written code with code generated with a shader maker tool. Hand written shaders are like F1 race cars, every piece is precisely designed to fit together for maximum speed. Code generated with tools like ASE are more like a pickup truck, slow and inefficient but with plenty of room in the back for you to throw in whatever you like.

    The code in Lit Smoke and Fire 1 and 2 is commented and laid out logically so in theory you could copy across parts of the code generated by AES and make a new shader but the amount of work and knowledge needed to do that would be more than the amount needed to make the changes manually without copying across the AES code.

    If you could explain in more detail what you will be using the shader for and what features you need I may be able to tell you what code you need to change or even make a custom variant of the shader for you if the changes are not to great.
     
    arnoob and Martin_H like this.
  32. arnoob

    arnoob

    Joined:
    May 16, 2014
    Posts:
    155
    Thank you for the answer and sorry for the delay!

    Well, I was thinking about using it for dirty glasses, as well as transparent hairs, but it seems that I will have to stay on cutout shader then :-/ Anyway thank you for taking the time to respond! :)
     
  33. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    Lit smoke and fire 2 is finally released!
    no longer will you have to work around sub par smoke and fire. With Lit Smoke and Fire 2 you get all the amazing lighting quality of the original Lit Smoke and Fire but at a fraction of the performance cost.
    you can pick it up here https://www.assetstore.unity3d.com/en/#!/content/79694.
    If you can spare a few minutes to rate and review it that would be greatly appreciated.

    I hope working with this package is as rewarding as making it and I look forward to reading your feedback.
     
    chiapet1021 and siliwangi like this.
  34. umauj

    umauj

    Joined:
    Nov 20, 2011
    Posts:
    80
    Very Impressive Visuals! Can you give some performance benchmark on how fast it is? Also what drives the performance cost?
     
  35. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    I don't have the benchmarks on hand but performance is around 2 to 4 times more expensive per pixel than stock unity alpha blend particles on mobile platforms depending on the features enabled. Features like soft particles and emissive lighting push up the cost compared to the basic normal mapped smoke particle. Pixel to pixel cost comparisons don't tell the full story though. A normal smoke effect needs to be lumpy like in the image below.

    With normal vertex lit particles you use one particle per "Lump" which requires a lot of particles and creates a lot of over draw. Because of the normal mapped lighting in Lit Smoke and Fire 2 you can put a bunch of "Lumps" into a single particle and dramatically reduce the number of particles needed to achieve the same effect.

    To reduce the performance cost I have moved as many of the calculations as possible to the vertex as particle effects are almost always fill rate / pixel bound. Because per vertex calculations are almost free things like light counts or light probes have almost 0 effect on performance.

    The things that have the biggest impact on performance are frame blending which requires all textures to be sampled twice, emissive flame lighting which adds an extra texture to sample, soft particles which adds another texture lookup and light scattering which adds extra data transfers and calculations.

    I was targeting low end iPhone 4 era mobile platforms when I was developing this so high end graphics cards will blast through the shader like it isn't even there.

    I have left the profiling code in the package but removed all the testing scenes including the performance profiling scene which I might add back in in the next update.
     
    Martin_H likes this.
  36. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,332
    I can confirm, that's exactly how it felt in my project! I have a GTX 1060.

    Drone Swarm looks very promising!
     
  37. jack-riddell

    jack-riddell

    Joined:
    Feb 11, 2014
    Posts:
    326
    I have created an upgrade from Advanced Normal Mapped Particles to Lit smoke and fire 2.
    Unity does not want an upgrade from Lit Smoke and Fire 1 to 2 for some reason though
     
    Lex4art and John-G like this.
  38. Kalidor

    Kalidor

    Joined:
    Sep 13, 2017
    Posts:
    14
    Is your system VR suitable?
    With the Unity Particle System, you can see a strong rotation effect when moving the head.
     
  39. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,332
    I think that's a problem with particle systems in general. Maybe there's something to try in the face camera / face camera plane settings for particles. Don't quite remember where those were, but I think maybe under the quality settings.
     
  40. daterre

    daterre

    Joined:
    Jul 30, 2012
    Posts:
    41
    Hi, amazing work! At first I was very disappointed to find the shadow cast/receive had been removed but my heart skipped a beat when I saw you mentioned it was still there but commented out.

    I successfully restored the shadow casting code (working very well for my purposes), and am now trying to get shadow receiving to work. As far as I can tell you removed this part of the shader code completely. Is there any way to restore it? I'm currently attempting to shoehorn in the standard AutoLight system (TRANSFER_SHADOW and SHADOW_ATTENUATION, along with all the v2f stuff) but can't seem to get any data.

    I'll note here that I'm perfectly fine with whatever shortcomings it has as this is for a demo intended to be run on a specific high-end machine. Of course, PM welcome if this is out of scope on this thread - though I suspect many would appreciate the behind-the-scenes info :)
     
    Lex4art likes this.
  41. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,332
    If it's not much trouble I'd appreciate you sharing what needs to be done for that. Searching through the shader code I didn't see anything related to shadow passes.
     
    Lex4art likes this.
  42. daterre

    daterre

    Joined:
    Jul 30, 2012
    Posts:
    41
    I used the Advanced Normal Mapped Particles package. NormalMappedShader.shader has a shadow caster pass at the bottom of the file commented out, plus a "Shadow cast options" multi_compile directive at the top. The NormalMappedParticleShaderEditor.cs has some control properties commented out as well. Uncomment all those and the shadows work again.
     
  43. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,332
    Oh, I see. I'm using lit smoke and fire 2, so that explains why I didn't see the pass. Thanks for explaining!
     
  44. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    Hi! I just bought Advanced Normal Mapped Particles. It's looking great, but I noticed that the shadows/normals seems to change depending on the rotation of the camera, not just its position. This makes it difficult to use for slower, more stationary smoke, as the shadows change too much when you just look around. Is there something I can change to make this look better, and not take camera rotation into consideration? Thanks!

    EDIT: I'm not sure what I did, but the effect is not that apparent anymore. It's starting to look really good! However, now I'm struggling with how I can make billboards rotate towards camera position, but not follow camera rotation (which is the same problem as with the built-in Unity billboards).
     
    Last edited: Jan 23, 2018
unityunity