Convert Figma logo to code with AI

keijiro logoSmrvfx

Skinned mesh sampling with VFX Graph

1,081
153
1,081
0

Top Related Projects

1,337

Point cloud importer & renderer for Unity

Quick Overview

Smrvfx is a Unity package that provides a set of visual effects (VFX) tools and utilities for creating immersive and realistic virtual reality (VR) experiences. It includes a collection of pre-built VFX assets, as well as a framework for creating custom VFX using Unity's Particle System and VFX Graph.

Pros

  • Comprehensive VFX Library: Smrvfx comes with a wide range of pre-built VFX assets, including fire, smoke, explosions, and more, which can be easily integrated into VR projects.
  • VFX Graph Integration: The package seamlessly integrates with Unity's VFX Graph, allowing developers to create custom VFX with a visual programming interface.
  • Performance Optimization: The VFX assets in Smrvfx are optimized for VR performance, ensuring smooth and efficient rendering in immersive environments.
  • Customization and Extensibility: Developers can easily customize the existing VFX assets or create their own using the provided framework and tools.

Cons

  • Unity Version Compatibility: Smrvfx is primarily designed for older versions of Unity, and its compatibility with the latest versions may not be guaranteed.
  • Limited Documentation: The project's documentation could be more comprehensive, making it challenging for new users to get started with the package.
  • Dependency on Unity: As a Unity-specific package, Smrvfx is not applicable to projects using other game engines or development platforms.
  • Potential Performance Issues: While the package is optimized for VR performance, some VFX may still cause performance issues, especially on lower-end hardware.

Code Examples

Example 1: Creating a Fireball VFX using VFX Graph

// Create a new VFX Graph asset
var vfxGraph = ScriptableObject.CreateInstance<VFXGraph>();

// Add a Particle System Spawn block
var spawnBlock = vfxGraph.AddChild<VFXSpawnerBlock>();
spawnBlock.SetSettingValue("Rate", 100f);

// Add a Particle System Attribute block
var attributeBlock = vfxGraph.AddChild<VFXAttributeBlock>();
attributeBlock.SetSettingValue("Lifetime", 2f);
attributeBlock.SetSettingValue("Size", 0.5f);
attributeBlock.SetSettingValue("Color", new Color(1f, 0.5f, 0f));

// Connect the blocks
spawnBlock.outputContext.Connect(attributeBlock.inputContext);

// Create a new VFX Asset and assign the VFX Graph
var vfxAsset = ScriptableObject.CreateInstance<VisualEffectAsset>();
vfxAsset.SetGraphVersion(vfxGraph);

This code example demonstrates how to create a simple fireball VFX using Unity's VFX Graph. It sets up a Particle System Spawn block to control the rate of particle emission, and a Particle System Attribute block to define the lifetime, size, and color of the particles.

Example 2: Integrating a Smrvfx VFX Asset into a VR Scene

// Load the Smrvfx VFX asset
var vfxAsset = Resources.Load<VisualEffectAsset>("Smrvfx/Explosion");

// Create a new VFX component and assign the asset
var vfxComponent = gameObject.AddComponent<VisualEffect>();
vfxComponent.visualEffectAsset = vfxAsset;

// Set the VFX transform to match the game object's transform
vfxComponent.transform.position = transform.position;
vfxComponent.transform.rotation = transform.rotation;

// Play the VFX
vfxComponent.Play();

This code example shows how to integrate a pre-built Smrvfx VFX asset into a VR scene. It loads the VFX asset, creates a new VisualEffect component, and assigns the asset to the component. The VFX transform is then set to match the game object's transform, and the VFX is played.

Example 3: Creating a Custom VFX using Smrvfx Utilities

Competitor Comparisons

1,337

Point cloud importer & renderer for Unity

Pros of Pcx

  • Broader application: Pcx is a point cloud importer for Unity, useful for various 3D visualization projects
  • Simpler implementation: Focuses on point cloud rendering without complex facial tracking
  • More accessible: Easier to integrate into existing Unity projects for general point cloud visualization

Cons of Pcx

  • Limited functionality: Lacks the specific facial motion capture features of Smrvfx
  • Less dynamic: Primarily works with static point cloud data, unlike Smrvfx's real-time capabilities
  • Narrower scope: Doesn't offer the advanced visual effects and particle system integration of Smrvfx

Code Comparison

Pcx (Point cloud rendering):

public class PointCloudRenderer : MonoBehaviour
{
    public Mesh mesh;
    public Material material;
    private void Start() => GetComponent<MeshFilter>().mesh = mesh;
}

Smrvfx (Facial motion capture and particle system):

public class FacialMotionParticleSystem : MonoBehaviour
{
    public OVRFaceExpressions faceExpressions;
    public ParticleSystem particleSystem;
    private void Update() => UpdateParticlesBasedOnExpression();
}

The code snippets highlight the different focus areas of each project, with Pcx centered on point cloud rendering and Smrvfx on facial motion capture integrated with particle systems.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Smrvfx

gif gif

Smrvfx is a Unity sample project that shows how to use the skinned mesh sampling feature with VFX Graph to emit particles from animating characters.

System requirements

  • Unity 2021.2
  • HDRP/URP 12.0

About this repository

Previously, this repository contained a custom package called Smrvfx that implemented a mesh sampling feature as VFX Graph didn't provide the feature at the time.

The built-in skinned mesh sampling feature was implemented in HDRP 11.0, so I changed the main aim of this repository to provide an example of the built-in feature.