For past few weeks I have been working on particle shaders designed for Shuriken particle system. Now, I am ready to present you Particle Shaders Volume 1 for Unity 5. The package features:
shadow casting
adjustable self-shadowing
HDR light emission
alpha blend & alpha erosion fade modes
soft particles support
support for all Unity 5 ambient modes (skylight, tricolor, flat ambient)
multi-light support (maximum lights per-system is defined by pixel light count in Unity quality tab)
If I may request an additional feature, it would be to add āClip Safeā functionality in the shaders (or make a separate set of shaders with this feature). The effect would be that particles fade to completely transparent, based on distance to camera. It is similar to what happens if you walk through smoke or mist - the density appears less intense right in front of your eyes than at a distance. Can be especially useful in a Virtual Reality experience, where experiencing large particle billboards being clipped right in your face, so to speak, is not desirable.
I like the idea. I will definitely put this on my roadmap (maybe I should create public Trello board with features planned for this shader pack with voting options?).
particles donāt receive shadows
[/quote]
This is an ongoing issue with particles in general. For example debris from an explosion in shadowed areas would be full bright - entirely stupid. Light probes canāt detect realtime shadows either. Smoke in shadows will be full bright and so on. Any ideas how to fix it? I understand shadows are screen space now so perhaps sampling depth might be an option.
Of course cutout works but then weāre left with nasty edges.
Finally: mild bug: black bits if light is shining through.
Catching other objectsā shadows is not the best idea. It is possible but the visual result wonāt be acceptable for professional use. The reason why transparent objects donāt receive shadows is that they are not taken into account in shadowing pipeline at all. And the reason behind this is really simple - performance. Proper transparent shadows are quite costly. There are a lot of approaches around the web so you can dig into this. But be warned - it is time consuming to get this thing working.
As for the bug - thanks for noticing. Iāll have that fixed in upcoming update.
1.0.1 update has arrived and should be available within few days. Changelist:
Fixed black spots which were showing when looking at light source
Added EMLighting.cginc file which contains all lighting models. Now all shared functions and parameters will be handled inside this file
I have also created a public roadmap with voting options so that I can focus more on features you wish to be implemented. You can also check what Iām currently working on (green indicates āwork in progressā, yellow is ānext upā and red is āsuspendedā).
@ctp Next update should contain distance fade for Virtual Reality users.
It works now. Looks great! Iām going to buy it!!
Also:
It is in my best interest to ask you if shadow support would be possible? I know this wouldnāt be easy, but to have sunrays through the particles would look Fantastic!
(Also point and spotlight support would be nice)
Might I suggest adding a blur filter to the edges of the pre-rendered cutout shader? That would get rid of the nasty edges, yet still support shadows. It obviously wouldnāt look good with high detail textures, but at least it would give the option for use of shadows. Just an idea. All around, LOVE THE PRODUCT!
About shadow receiving. I have many ideas about the future of the package. Unity have already announced receiving shadows on transparent objects that should be available somewhere during Unity 5.x cycle. But I think that I should develop my own solution anyways. Reasons for this:
-particles are not regular ātransparentā objects. They need special approach in order to be performant
-having own solution usually gives more possibilities
-there is no official release date for official transparent shadow receiving support
But these ideas could take few month for me to implement. Transparent objects with shadow receivers were always a tricky part of realtime programming. But yea, I am definitely heading towards this direction.
As for now, I am going to do something about these cutout shadows. One way is to implement Unity 5 transparent shadows but they are really ugly when you donāt use soft shadows in your light.
They look quite nice when you have soft shadows turned on but I cannot take for granted that everyone is using it. Soft cutout shadows is an option. I have to dig in into how exactly Unity is casting shadows and then Iāll start thinking about solving the problem in the best possible way.
Iām really happy that you, as a developer, are taking your customers suggestions for the future product! I havnāt seen too many others do that. Honestly, I like the product as it is. Iāve tried to achieve lit particles on my own but failed, you sir, are brilliant! And I hope your product goes a long way!
Iām really not up on what can / canāt be done with particles, but letās say you have rain occurring at night in a city with lots of lights (neon signs, car headlights, street lights). Can current falling rain particles be lit by a street light? My impression is they canāt, and no store plugin can help. With this plugin weād have to wait until point and spot lights are enabled before it will work.
I seem to have encountered a potential issue with my particular use-case for these particles.
Iām trying to set up particles (particularly a pale grey fog in this instance) that work seamlessly throughout a day-night cycle, but Iām finding that the ambient lighting does not update with the skybox, so the particles are still very bright at night (or dark during the day depending on the initial position of the sun). Initially the ambient lighting wasnāt updating for any object in the scene, but I solved that with one massive reflection probe that only renders the skybox. However it seems that the particles donāt react to the reflection probe, even when I can see that it is being detected under the āRendererā section of the particle system settings.
I may be wrong, but I assume this is something that would need to be taken into account in the shader itself. Is this something you would be able to support? Is this approach to ambient lighting for particles even remotely sensible?
Iām aware I could just update the particle colours or ambient intensity manually, but it would be a lot more convenient and likely yield better results to have the more automated solution that draws directly from the procedural skybox.
Nice work with these assets by the way! They produce a far nicer look than the built in shaders.
Hello Evil_Moo! I am happy that you like the shader pack, even though you have found some flaws.
I have to admit that I have not tested shaders with dynamic sky, my fault. Is it possible for you to send me a sample scene with dynamic sky that you are using? Or do you have any guidelines for recreating similar system? It would really help me determining whether it is possible for me to fix this problem in a reasonable way.
My set-up is fairly simple for the dynamic sky. Iām just using the built in procedural skybox shader with the environment lighting options in the Lighting window set to use skybox for both ambient and reflection sources, and a directional light for the sun. This will automatically update the ambient light to match the sky as you move the sun outside of runtime, but while the game is running objects seem to require a reflection probe to update ambient lighting and reflections.
Which is basically just making it update in realtime, while only rendering the skybox and making the size big enough to cover everything in the scene that needs the ambient lighting to update.
Then just add a few objects (probably with the standard shader) to make sure the reflection probe is working at all and the particles to test (in my case Iām mostly using the āLit Alpha Blend Softā shader). That should be everything you need to test this, as far as I can tell.
Again, Iāve no idea if this is a feasible approach in general, but it looks like the simplest way to get dynamic ambient lighting from the procedural skybox at runtime.