Skip to content

Enables live authoring of curvy effects using Unity's Visual Effect Graph.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

krisrok/com.krisrok.vfxpath

Repository files navigation

com.krisrok.vfxpath

Enables using complex splines in combination with Unity's Visual Effect Graph to easily author effects with curves live in the Unity Editor:

spline-interaction.mp4

Rationale

Sometimes you might need huge amounts of particles but want to control their flow even more precisely as you traditionally can with flow maps or other techniques.

In VFX Graph there is already a SampleBezier node included (see here) but it is limited to just one segment and hard to handle.

Installation

Here are the easiest ways to install the package, choose either:

A) Using package manager

Open Package Manager, select "Add package from git URL..." and enter

https://github.com/krisrok/vfxpath.git

B) Edit manifest

{
  "dependencies": {
    "com.krisrok.vfxpath": "https://github.com/krisrok/vfxpath.git",
    ...

Dependencies

⚠️ There are two spline providers supported and you have to install (at least) one of them.

Preferred option: Unity's Splines

https://docs.unity3d.com/Packages/com.unity.splines@1.0/manual/index.html

Depending on your Unity version you might need to add the dependency manually to your manifest or you can just install it via Package Manager.

Tested with 1.0.1 and 2.1.0.

Also supported: SebLague's PathCreator

https://github.com/SebLague/Path-Creator

There are several ways to install it.

Usage

There are two parts to this: Providing the spline's data to the VFX graph (via VFXPropertyBinder) and enabling access to the data inside the graphs (via custom Nodes, or better Subgraphs).

Have a look at the included Samples for some more concrete usage pointers.

In general you need to:

  1. Add a Visual Effect component to your GameObject
    • Set or create a Visual Effect Asset configured to have the neccessary properties exposed
  2. Add a SplineContainer component (to the same or any other GameObject)
    • Create a spline using the scene view tools
  3. Add a VFXPropertyBinder component to the same GameObject
    • Add the Property Binding: + -> VfxPath/Spline
    • (If the SplineContainer is found on the same GameObject it will be automatically referenced, otherwise you have to manually reference it)
    • (If the Visual Effect Asset's properties are named correctly it will just work, otherwise you have to manually set the names you used)

VFXPropertyBinder

Use VFXGraph's own VFXPropertyBinder and add a VFXPath property binding. There are bindings available for SplineContainer and for PathCreator, but they will only show up if you correctly installed any of the dependencies, see above.

image

This will create small textures containing the spline's sampled positions and rotations, just like other point caches.

The bindings will also automatically transfer some meta info about the spline's bounds and the point count to the VFX Graph.

You can increase/decrease the Point Count to get a tighter/looser fit:

point-count.mp4

Set Draw Lines to true to display the sampled lines like seen in the video above.

Subgraphs

image

There are some subgraphs to simplify accessing and processing the spline's data to be usable.

Samples

There are a few simpler sample graphs included:

  1. Import the "Common Graphs" sample via Package Manager.
  2. Import the "Spline Scene" sample if you want to use Unity's Spline package and/or import the "PathCreator Scene" if you want to use PathCreator.
  3. Find and open the imported scenes below Assets\Samples\VFX Path
  4. Tweak the existing splines and graphs, create your own!

About

Enables live authoring of curvy effects using Unity's Visual Effect Graph.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Releases

No releases published

Languages