Working on a VFX framework for Unity

TL;DR: I’m working on a framework to ease the authoring, previewing and integration of VFX within Unity. My goal is to use this as a foundation to author VFX packs for the Asset Store, but I’m thinking about open-sourcing the scripts so that anyone can use the system itself.
Thus I’m posting here to gauge potential interest in it!

Hey everyone,

I’m currently working on a VFX framework for Unity to go beyond the built-in Particle System and easily use other built-in parts for VFX.
The idea is to have an interface that resembles the Particle System one for Scene View preview, but that can preview more effects than just particles (e.g. material/light/objects animations, screen shake).

Here’s how it looks currently (here some particles + one material animation + slight screen shake, all previewed in the Scene View):

Goals:

  • Easily author effects composed of
    • particle systems
    • meshes with material animations
    • move/rotate/scale animations
    • any custom script that extends from the system
  • Full Scene View preview in editor mode
  • Prevent the clunkiness of working with AnimationClips
  • Possibly better performance than AnimationClips (I don’t know about that part, but it feels like direct objects/properties references would be better than sampling an animation clip that is based on properties names?)
  • Match Unity’s workflow (component based, works with Unity’s usual keyboard shortcuts, replicate the Particle System scene view window)

This is the core system, but I’m also working on several other scripts that can complement it, such as:

  • a palette system to easily change an effect’s colors
  • a catmull-rom spline script with Unity-like editing workflow
  • a “trail baker” that can create swoosh meshes based on an animation clip and using these splines

Eventually I want to use this framework to create effects and sell them on the Asset Store; but I’ll open-source the code itself and make it available to everyone.

Questions for you!

  • Would you be interested in testing/using this? (for free)
  • What do you currently use to make “advanced” effects within Unity? (e.g. to animate materials: custom scripts, animation clips, …)
  • How do you test these effects? (e.g. only in play mode, animation window scrubbing, …)
  • Any ideas of things that would make your life easier making VFX in Unity?

Let me know if you want details on the system.
Any kind of feedback is appreciated! (and that’s what I’d hope to get by open-sourcing it!)

I’ll eventually put it on GitHub, more or less soon depending on the interest I get from you! :slight_smile:
(I’ll need to clean up the code before ding so, which may take some time!)

Videos/Screenshot

Looped effect with fade out animations (mesh scaling, light intensity fade) when stopping the effect.
Also allows inspecting the effect from all angles in the scene view while it is playing (here the shader is fading between two meshes depending on the view direction).

Continous laser: the laser script is custom, but the buildup, shoot and impact effects all use the system (particles, mesh material anim, screen shake, light intensity pulse/curves)
(this is in Game view at runtime)

Same with projectile lasers (Game view, runtime)

This video shows the WIP trail baker tool, not user friendly but you can get the idea of the workflow (create splines from anim, and generate a mesh from these splines)
(Model from @RobbertWiggin from his game Neon Child)

Screenshot of the Effect inspector in its current form (with a “nested inspector” to edit values directly during preview)


Thanks for reading!
22 Likes

It looks great!
About the questions I’ll love to test it ^^. For advanced effects i usually use custom scripts and animated clips (if the effect have some variations depending of the situation).
Usually i test them on my own scene and them I check them into the level editor and I improve them until they look good.
To me, i think it’s important to have an easier way to include skinned meshes without using different animators and gameobjects. Also, have an integrated Field (similar to the unreal) and an attractor, maybe will be interesting to have RIBBONS. RIBBONS PLS ;_;.
Thanks for all and i’ll follow ur work, :kissing_heart:

1 Like

This is exactly the sort of tool I was thinking of creating for our next game.
Currently, I tend to use either animation clip or particle system to drive the timeline, depending on the situation. Then use scripts to update materials, or the custom vertex stream data.
I prefer tools which are quite open ended - they can be used and adapted in many different ways. Often plugins can lock you into doing things in a specific way, which can be a hindrance.
Great work so far, can’t wait to get my hands on it!

1 Like

That looks awesome! I’d certainly be curious about the performance difference between sampling anim curves manually vs an animation clip. As clunky as animation clips can be, multi-curve editing and dope sheet retiming are big things to give up.

Thanks for your answers (and likes!).
I’ll start cleaning that up to bring it to GitHub!


  • Skinned mesh: not sure how you want to avoid multiplying GameObjects, but I think it’s possible to sample an AnimationClip on a SkinnedMeshRenderer without any Animator/Animation component (although it looks to be less performant: AnimationClip.SampleAnimation); I do have a script that uses that interface (see below), so you can mix multiple skinned meshes into the same effect and preview easily
  • fields/attractor/ribbons: currently I’m not adding VFX features to Unity, it’s more of a tool for faster iteration using existing techniques (like built-in Particle Systems, material animations, etc.) even though I do have some addition such as the Catmull-Rom Spline script.

This is also part of my goals. I want to make the interface very simple to add more “animators”; for example this is currently what the AnimationClipAnimator script looks like:

	public class AnimationClipAnimator : FXAnimator
	{
		public GameObject animatedObject;
		public AnimationClip clip;

		//--------------------------------------------------------------------------------------------------------------------------------

#if UNITY_EDITOR
		public override string EditorName { get { return "Animation Clip"; } }
		public override void Editor_CacheState() { }
		public override void Editor_RestoreState() { }
#endif

		//--------------------------------------------------------------------------------------------------------------------------------

		void OnValidate()
		{
			if(clip != null)
				this.duration = clip.length;
			else
				this.duration = 0f;
		}

		public override void Stop()
		{
			clip.SampleAnimation(animatedObject, 0f);
		}

		override protected void UpdateAbsoluteTime(float absoluteTime)
		{
			clip.SampleAnimation(animatedObject, absoluteTime);
		}
	}

What this does is just to play an AnimationClip on a GameObject. With this script it integrates seemlessly into the whole system.
The Editor_CacheState and Editor_RestoreState callbacks are here for in-editor preview, in case you need to store/restore states (e.g. for a light, I’m keeping a copy of all its values to restore them after the preview).

Replicating these could be something to add in the long term. In the meantime, we can mix AnimationClips with this system (e.g. to easily play synchronized particle systems along with an animation).

谢谢分享!:slightly_smiling_face:

I’m still working on cleaning up the code, refactoring and fixing bugs along the way!

But here’s an early preview project I’ve made for those curious about the system:
https://assets.jeanmoreno.com/unity/StylizedFX/StylizedFX_Pillar.zip (Unity 2017.1.0+)

This single effect is included, and is using a lot of different functionalities from the framework:

No documentation yet though, but feel free to ask anything here!

3 Likes

Unrelated to anything in this conversation, but the forum is having a hard time pulling a thumbnail from your topic - you seem to have found a bug for me, so I just wanted to post in here that I’m going to take a look at why the preview thumbnail is broken for this topic.

Hey there, did anything ever end up coming from this? It looked great!

This is not cancelled, but I’ve had a busier year than expected so I haven’t be able to work on it as much as hoped.

I still plan to fully get back to it though, and I’m still writing notes on how to improve it!

Here’s a lightning effect using the system I made a few months ago (light & screenshake animations added in a few clicks and using simple animation curves):