Skip to main content
Version: 4.55.1

3D Hand VFX

The 3D Hand VFX Template uses 3D Hand Tracking and the VFX graph to create interactive experiences which can be beautiful to watch and engaging to play with.

Guide

This template has 3 VFX examples to explore around. Each uses a unique aspect of 3D Hand Tracking and the VFX graph. This is a great example for learning more about 3D Hand Tracking and the VFX graph and finding some inspiration on how to combine the two.

  • Fish Swarm Example - Using left & right hands as repelling & attracting force to influence a swarm of sardines.
  • Bioluminescence - Using acceleration of hands to add color highlight and force to a VFX graph.
  • Flower Shooters - Using joint positions to give direction to the VFX graph which creates a 'shooting' effect.

The Fish Swarm Example

The Fish Swarm example allows you to influence a fish swarm created in the scene with your left and right hand. Our right hand attracts the fish swarm and left hand repels it. You can explore the Fish Swarm graph to see how the sardine swarm effect is made.

Double-click the Fish Swarm asset inside the VFX folder in the Resources panel

In the green comment boxes are parameters modified by external scripts, such as:

  • IsAttracting: a boolean parameter determining whether an attracting or repelling force is applied to the swarm.
  • isIdle: a boolean parameter determining whether there is external influence on the fish swarm.
  • InfluencePosition: position input for influencing the force of the fish swarm.

All these parameters are affected in real time in the scripts attached to the Fish Swarm object.

For example, the tracked 3D Hand position is changing the InfluencePosition of the VFX graph with the HandPositiontoVFX script.

This script can be used to assign any joint position to any parameters of a VFX graph, try using it with your own custom VFX graph!

You will find more customizable parameters of the Fish Swarm VFX asset in the Inspector panel.

Here in this example, we are using the same texture (checked by theUse Same Texture checkbox) for both attracting and repelling examples.

Color A to E is a set of gradients that you can apply to the texture when the repel action is happening.

The Bioluminescence Example

The Bioluminescence example mimics bioluminescent creatures in our oceans. It uses SimplexNoise as an influence force to create a beautiful boids movement of thousands of small circles.

Similar to the Fish Swarm example, data from external scripts are found inside the green box in the VFX graph. It includes:

  • isIdle: a boolean parameter determining whether there is external influence on the fish swarm.
  • Velocity: velocity of hands movement from external script.
  • Position: position input for the influencing force of the fish swarm. This is applied in the script HandPositionToVFX with tracked 3D Hand position.

In this example, we are using the velocity of our hand in CustomVFX_Bioluminescence to add velocity influence to the graph. See this script to learn how it works.

Right-click on a script in a Script component and choose Select to find that script in the Resources panel. Then, double-click on the script to open it.

The Flower Shooter Example

The Flower shooter example shoots out flowers and grass from the index finger.

The HandPositionToVFX is used to assign a custom position to the VFX graph.

In both the Flower Emitter and Leaf Emitter VFX graphs, there are SpawnPosition and DirectionPosition input parameters. The HandPositionToVFX script assigns the index tip’s position to SpawnPosition and the index middle’s position to DirectionPosition so that the shooters always shoot to where the index finger is pointing. Feel free to change these parameters and see what happens.

The Flower Emitter and Leaf Emitter graphs have similar configurations. Just like the other VFX examples in this template, you can find all external inputs inside the green box on the graph, including the following:

  • SpawnPosition: position of origin of the VFX.
  • DirectionPosition: opposite direction of where the VFX is shooting at.
  • PauseSpawn: if Determines whether or not a particle should spawn or not (this is set to active when hand tracking is lost)
  • Noise Texture: noise texture to be applied to randomize movement of the VFX.
  • Main Texture: main texture (flipbook) of the VFX.

Feel free to edit these parameters to further customize this VFX!

Previewing Your Lens

You're now ready to preview your Lens experience in Snapchat! To do so follow the Pairing to Snapchat guide.

Was this page helpful?
Yes
No