Puffy Smoke - Particles with a volumetric look

Hi, I’m proud to finally present my smoke effect to you :slight_smile:

Puffy Smoke is a particle system with a special render setup which displays a faked volumetric smoke on classic billboard particles, using a directional light as reference.
Its primary purpose is to emit smoke trails behind moving objects, but it can be used to also make clouds or any other smoke effect.

The smoke texture details are animated, so it doesn’t looks like a row of static and identical textures, all particles looks different.
Also, to get a more realistic feeling, the particle lifetime can be randomized. This way, the trails doesn’t looks like a ribbon attached to the moving objects.
To prevent gaps in the particles trails with fast moving objects, the particles are created at a fixed (and customizable) interval, in order to always get a consistant smoke.
For a nice volumetric effect, the particles are also reacting to the specified directional light orientation, intensity and color, in real time.
The shadowed side of the smoke is also reacting to the ambient color or the camera background color, and you can also specify a custom shadow color.

Multi-threading is used to improve performances, and you get one extra draw call every 16000 particles (so only 1 draw call for less than 16000 particles)
NOTE : Change since version 1.11 => Now a new mesh is generated every 4096 particles (so one more draw call each time), to take advantage of the multi-threading sooner, in some parts of the meshes update process.
NOTE : version 1.12 : Now you can tweak the number of particles per mesh with the “Mesh face count” parameter.

Limitations :

  • Only one directional light can affect the smoke.
  • This smoke is not self shadowing and doesn’t project shadows on other meshes
  • Since Shuriken doesn’t provide enough particles data, this effect cannot be plugged on it properly

Try it here : Web demo
This demo shows debug informations about the time taken by each step in the smoke generation process.

Get it : on the Asset Store for only $15 :wink:


History :

30/01/2016 - Version 1.13:

  • THIS WILL BE THE LAST ITERATION OF THIS VERSION. THE NEXT ONE WILL BE A COMPLETE REWRITE, WITH UNITY 5.3.x

  • Switch to Unity 4.3.0

  • New unified multi-compile shader for smoke and clouds, with more options

  • Unity Threading Helper replaced by ThreadPool class : same speed performances, less (no more?) GC hick-ups \o/

  • Switching off Unlimited particle now displays a Max particles count value. This number of particles will be preallocated in memory.

  • Bug fix : when disabling threads, a wrong number of particles where used when too many of them were present

  • The “Use Threads” checkbox is back on the Puffy_Emitter script, since it may be useful to be able to disable it on some mobile devices.

  • Tweak on the maximum Mesh Face count value to prevent max vertices allocation error, this parameter has also been renamed as “Particles per mesh”

  • Some corrections in the Cloud Shader : the sharpness parameter wasn’t properly applied

  • Presets added in the editor menu “GameObject/Create Other/Puffy Smoke”, note that you’ll have to manually set the Light and Material to be used by the Puffy Renderer

  • Disabling a Puffy_Emitter script or its GameObject will now hide all related particles from the Puffy_Renderer script

  • Some memory optimizations

  • Readme file updates to reflect all changes.

  • Puffy_Renderer script *
    New features :
  • New parameter “Ambient intensity” to control how much the ambient color affect the particles
  • New parameter “LOD start distance” defines the start point for the Auto LOD option. So the LOD effect will happend between this point and the “Max render distance” value
  • Threaded optimization added on the mesh build function
  • Small performance improvements on the Frustum Check.
  • Puffy_Renderer script : “Sub mesh count” parameter added, to tweak the internal split of mesh data in order to optimize the amount of data sent to the gpu when a big face count is defined and few particles are visible. (higher value = more sub meshes = more memory comsuption)
  • Puffy_Renderer script : “Warm up” and “Warm up mesh count” added, to pre-build meshes and define how many are needed at start (good for mobile).

Changes and bug fixes :

  • Cores Setup restricted to values Medium/High/Maximum, since lower values may lead to crash when dealing with a huge count of particles.
  • Screensize near clipping max value raised to 4
  • The Ambient color parameter state was affecting all renderers at once, it’s now properly working individually on each one.
  • Puffy_Emitter script *
    New features :
  • Puffy_Emitter script : when “Assign to first renderer” is off, a “Renderer” input is displayed to pick the Puffy_Renderer to use with this emitter
  • Puffy_Emitter script : if no renderer is assigned to the emitter, gizmos wire spheres will be displayed for each particle
  • Puffy_Emitter script : Warm up added, to pre-fill the particles array

Changes and bug fixes :

  • The “Direction” vector is now normalized before being applied to the particles motion
  • “Auto assign to renderer” renamed to “Assign to first renderer”, and “Auto assign to” input removed
  • Internal changes to support multiple ShapeSpawners or MultiSpawners at the same time
  • Gradient End Time parameter moved to the Puffy_Gradient script
  • Bug fix in the particles recycling process (wasn’t really noticeable, but needed to be fixed)
  • Particles are now stored in a List instead of an Array, allowing more internal flexibility and no real performance hit
  • The “chunk size” parameter is no more needed and has been removed
  • Puffy_Cloud script *
    New feature : OnDestroy method added to remove particles when the cloud gameobject is deleted

  • Puffy_MultiSpawner script *
    Bug fix : the Max Gap setting processing (taken from the emitter) for fast moving objects was not working properly

  • Shaders :
    Bug fixes :
  • Scattering effect was not computed properly, and this parameter is renamed to “Light Scattering” to be more relevant.
  • Fog is now properly handled

New features :

  • Multiple lights support ! :slight_smile:
  • Perlin Cloud demo script + 3D Perlin Noise class

27/02/2014 - Version 1.12:

  • First iteration of mobile support (iOS Android) \o/
    IMPORTANT : depending on your mobile hardware (problem found on Android devices) you may have to disable the “Use Threads” option to improve performances.
    I’m trying to figure out what’s the problem here…

  • Many shaders optimizations

  • Fake volumetric textures modified to be square images

  • Default internal ambient color set to black

  • Materials clean up, now you have 3 materials with different qualities :

  • “PuffySmoke Low” : no details, only the base volumetric effect. This shader is recommended for mobile gpu !
  • “PuffySmoke Medium” : 1 texture allowed for details
  • “PuffySmoke High” : 2 textures allowed for details, the first is displayed at the particle birth, and gradually fade to the second until the particle death.

Note : All shaders are working on mobile gpu, but those with details textures may have poor performances

Changes in the Puffy_Render Script :

  • Auto LOD option, exclude some particles from rendering based on distance to camera :
  • every 4th particle with distance > MaxRenderDistance/4
  • and every 3rd particle with distance > MaxRenderDistance/3
  • and every 2d particle with distance > MaxRenderDistance/2
  • NearClipping + fading to fix fillrate issues on low gpu :
  • Screensize Near Clipping : value from 0 to 2, is the maximum % of screen space the particle is allowed to fill before starting to fade out (a value of 0 will hide all particles)
  • Near clipping fade range : from 0 to 1, is the range allowed to let the fade occur (also expressed in % of screen space), a value of 0 will pop out particles while 1 will fade them gradually
  • ForceOnePass removed and replaced by PassMode, now you can specify how the processing is spread over frames :
  • Auto : let the script decided, using the Update threshold value
  • One : will force everything to be done in one frame
  • Multiple : will force every step to be done on multiples frames (3)
  • Render checkbox no more needed (disable the script instead)

  • Inspector clean up

  • New price :wink:

04/12/2013 - Version 1.11:

  • Bug fix and code optimization in the particle emitter for the particles recycling
  • Some tweaks in the particles renderer, to improve performances on low hardware
  • Particles can now be immortal (set lifeTime to -1)
  • The particles age is no longer stored in the color alpha channel, so now the alpha can be modified within the color gradient
  • Particles can now have a Luminosity value, the homing missiles demo is updated with this new parameter
  • Position variation added to the particle emitter, this allows a random position offset on particles spawning
  • Multi threads added for meshes data generation and part of the meshes updates
  • New clouds demo added, with a dedicated shader
  • Project exported from Unity 4.0.0f7, since it’s the minimal version to get it to work

28/10/2013 - Versions 1.08 to 1.10:

  • Rewrite of the particle emitter process to get a particle per seconds rate, working properly with any TimeScale value
  • Code simplification and new emitter classes to extend (mesh or multi emitter).
  • “Trail mode” removed (no longer needed), and behavior replaced by the “Max gap” value
  • New demo scenes.
  • New noise textures
  • New shaders

12/10/2013 - Version 1.07

  • Added “Auto Assign” option on the emitter script, to let it find a renderer
  • Added “Assign to renderer name” on the emitter script, to specifiy which renderer must be used if multiple are available.
    If the name is left empty, the first renderer found will be used.

15/09/2013 - Version 1.06

  • Speed improvements : almost x2 on the benchmark scene with 50k particles
  • MaxRenderDistance added to the Puffy_Renderer script
  • Tweak on the shader to cast raw shadows on other objects (no self shadowing).
  • Added the intermediateRatio parameter to the SpawnRow function in the Puffy_Emitter class

07/09/2013 - Version 1.05

  • Speed improvements on the meshes rebuilding and updates (+50% speed for this part)
  • Tweaks in the shader on the details animation parameter
  • New material + new texture for a first attempt at making a cartoon smoke look (not convincing yet)
  • New parameters on the homing missile script (craziness and some random offsets tweaks)

03/09/2013 - Version 1.04

  • Speed improvements : overall refresh rate multiplied by around 3
  • Some changes in the smoke color of the missiles demo (end color = start color, instead of white)
  • Launch count added to the missile launcher script
  • Some corrections in the readme file

27/08/2013 - Version 1.03

  • Tint color as been removed from the shader
  • Changes on the shader and lighting options : the smoke now reacts to the light color and intensity, and to the scene ambient light color
  • Two new parameters in Puffy_Renderer : “Use Ambient color” and “Camera Background Color as Ambient Color”

26/08/2013 - Version 1.02

  • Cleanup in the package (old test files were added)

26/08/2013 - Version 1.01

  • Homing missile demo updated with cleaner code

21/08/2013 - Version 1.0

  • First release.
1 Like

Interested in this effect and considering the purchase. Two questions though:

You say this is not a shuriken effect, so with respect to clouds or other static smoke effects, can you keep the smoke from animating (I would assume your cloud would look roiling/bubbling if it was stationary and animating without dissipating)?

Two, can you pause the effect (or is it dependent on Update(), etc). I have a pause function in the project I’m working on, so I would need to freeze all particles on command (hopefully without manually iterating through each billboard) while a missile is in mid-flight without actually setting the global timestep to zero. How easy is this to do (simple command: smoke.Pause(), or some coding necessary)?

Hi,

This package includes 2 scripts : one to emit particles and another to render them.
The emitter script has a “freezed” boolean property which allows to do what you want, you can even test it in the web player demo : hit P key to pause/unpause the smoke animation, you’ll still be able to move around and see the effect properly, since the renderer is not paused.

Let me know if you need any extra tweaks :wink:

EDIT : you also have a static bool “globalFreeze” to freeze all emitters at once :wink:
The emitter script can emit particles one by one, where and when you want. So you can create a custom function to define the shape of your clouds, and add particles with a function like this :

SpawnParticle(Vector3 start_position, Vector3 start_direction, float start_speed, float start_lifetime, float start_size, float end_size, Color start_color, Color end_color)

Awesome work. Can you tell me it’s work in ios or android or can i make this type of effects.
Here is link.
Duration is 2.00 light effects on smoke.

Ive created a missile AI a while back and added the unity particle emitter which ended up being a performance killer. This looks perfect for my missiles and any smoke effects in general. Going to give this a try.

Picked up this package. Could use some documentation. From glancing at the examples, it seems like there’s a single renderer I need to put somewhere (like on a gamecontroller), that I have to register my emitters with? While the demos give me an example to work with, it would be nice to know exactly what interfaces I have available… Is any documentation forthcoming?

Otherwise, this looks to do exactly what I want. I do like the ability to freeze everything with one boolean.

For now my effect only reacts to a single directionnal light source… I’m trying to find some solution to take more lights in account, but this is not for soon.
iOS or Android support is difficult to do for me since I don’t have a mac to compile and test on iOS, nor an Android device to test it, I’ll try with some emulators…

Thanks :slight_smile:

Yes, exactly.

Yup, I’ll work on this in the days to come, a more detailed documentation should be online next week.

Some quick stuff :

In the Puffy_Emitter class, interesting function are :

SpawnParticle() to create a new particle, all parameters are self explanatory

SpawnRow() to create a row of particles between two given point in space, using a step value to define the distance between each particles. For now only the last particle created will get the specified lifetime and size, inbetween particles will get onlyf half the life time and half the size, for performance purpose, but this may become optionnal in the next update.

Random variations defined in the emitter parameters are always applied to any new particle, only at its creation time, any change to the emitter parameters after a particle is created will not affect it.

The “freezed” boolean parameter is used to toggle the particles animation.

Good :slight_smile:

Of course, I’m open to any suggestion to improve or add functions you may need :wink:

Hi,

Here is an updated version of the readme file with more informations about scripting :

http://www.alesk.fr/PuffySmoke/PuffySmoke.pdf

This is for the last version which is not sent to the asset store yet (my windows system is not working properly since one week, and I can’t upload it yet :frowning: )
And for some more fun, I have to undergo surgery tomorrow and would not be able to be online until next week…

I’ve tried to put the most important informations in the pdf, if you think something important for you is missing, tell me and I’ll add it when I’ll be back.

Sorry for this delay :frowning:

Hi,

Back to life (and code) again :wink:
After some inquiries from the nicest people ever, who already bought this asset, I’m rewritting some part of the particles spawning to get something more consistant according to timescale changes, and also to get more options about the emitter shape : the current version only allows emission from one point, I’m working on something more sophisticated, like emission from meshes vertices.

Still some issues with the timescale stuff to fix, and I’ll be ready to send an update to the asset store :slight_smile:

Me again,

After a long struggling and headaches with timings issues, I’m glad to announce that now the smoke particles are perfectly reacting to timeScale variations :slight_smile:

I’m confident to send the new update to the asset store this week, I think you’ll like the changes… more informations soon :slight_smile:

Wonderful, can’t wait to try it out.

For those interested, you’ll find a new demo here :

5 Scenes to test :

  1. simple emitter, randomly orbitting
  2. mesh emitter using vertices as particle source + vertices colors as particles colors
  3. big array of particles for a little stress test
  4. homing missiles, for a bigger stress test… if you launch a lot of missiles :wink:
  5. Fart guy :slight_smile:

Note : the white sphere at the bottom of the screen is here as a light direction reference.

I’m finishing somes tests and writing updated docs now.

Really love this smoke :slight_smile:

My project involves Djinn/Genies, So ive been on the lookout for some very pretty smoke :slight_smile:

By any chance, could I suggest a 5th demo? Would it be possible to have a 3rd Person Controller, we smoke on the end? Just to see how the smoke trails behind naturally before I modifies it for my own means.

ok, fifth demo added

enjoy :wink:

Thanks :slight_smile:

Yep ill have to somehow modifies it, so that the smoke flows “down” rather than up.

Any ideas?

Also, I cant stop laughing XD

The emitter can be easily edited to let you define the flow direction as you wish, by default it’s following the emitter orientation + an optionnal offset direction vector
here is a screen grab of the current parameters of the 5th demo :

Thanks :slight_smile:

Do you have the smoke emitter attached to a bone? It appears you do, for when he walks, the smoke moves with the movement with his butt.

This might be really useful for me, because that means I can animate the smoke moving through reverberation of a specialized bone :slight_smile:

Ill see how this works out, and send you results :smile:

yup, it’s attached to a bone

I first have to send this update to the asset store before you can try it :wink:
I still have work to do on the documentation…

Update submitted to the asset store… waiting for approval :slight_smile:

Update accepted and available on the asset store :slight_smile:

Let me know if you have any question or suggestion with this new version !