Top Related Projects
Additional tools for Visual Effect Artists
Video glitch effects for Unity
Special Effects with Skinned Mesh in Unity
A first person multiplayer shooter example project in Unity
Creative coding library for Unity
Quick Overview
KvantSpray is a GPU particle system for Unity, designed to create spray-like effects. It utilizes compute shaders for efficient particle simulation and rendering, making it suitable for creating large-scale particle effects with minimal performance impact.
Pros
- High performance due to GPU-based computation
- Capable of rendering millions of particles in real-time
- Customizable particle behavior and appearance
- Integrates seamlessly with Unity's rendering pipeline
Cons
- Requires a GPU that supports compute shaders
- Limited documentation and examples
- May require some knowledge of shader programming for advanced customization
- Not actively maintained (last update was in 2019)
Code Examples
- Creating a KvantSpray instance:
using Kvant;
using UnityEngine;
public class SprayExample : MonoBehaviour
{
void Start()
{
var spray = gameObject.AddComponent<Spray>();
spray.maxParticles = 1000000;
spray.emitterCenter = Vector3.zero;
spray.emitterSize = Vector3.one * 5f;
}
}
- Customizing particle behavior:
void ConfigureSpray(Spray spray)
{
spray.direction = transform.forward;
spray.spread = 30f;
spray.minSpeed = 2f;
spray.maxSpeed = 5f;
spray.noiseAmplitude = 0.5f;
spray.noiseFrequency = 0.2f;
}
- Changing particle appearance:
void SetSprayAppearance(Spray spray)
{
spray.color = Color.cyan;
spray.scale = 0.1f;
spray.tail = 0.2f;
spray.randomSeed = 12345;
}
Getting Started
- Clone the repository or download the latest release.
- Import the KvantSpray folder into your Unity project.
- Add a Spray component to an empty GameObject in your scene.
- Configure the Spray component properties in the Inspector or via script.
- Press Play to see the particle effect in action.
Example setup code:
using Kvant;
using UnityEngine;
public class SpraySetup : MonoBehaviour
{
void Start()
{
var spray = gameObject.AddComponent<Spray>();
spray.maxParticles = 100000;
spray.emitterCenter = Vector3.zero;
spray.emitterSize = Vector3.one * 2f;
spray.direction = Vector3.up;
spray.spread = 45f;
spray.minSpeed = 1f;
spray.maxSpeed = 3f;
spray.color = Color.white;
spray.scale = 0.05f;
}
}
Competitor Comparisons
Additional tools for Visual Effect Artists
Pros of VFXToolbox
- More comprehensive toolset for visual effects in Unity
- Official support from Unity Technologies
- Regular updates and maintenance
Cons of VFXToolbox
- Steeper learning curve due to more complex features
- May be overkill for simple particle effects
- Requires more setup time compared to KvantSpray
Code Comparison
KvantSpray:
public class KvantSpray : MonoBehaviour
{
public int maxParticles = 100000;
public float emissionRate = 1000;
public float lifetime = 2.0f;
}
VFXToolbox:
public class VFXGraph : VisualEffectAsset
{
public VFXExpressionValues expressionValues;
public VFXOutputEventHandlerDesc outputEventHandlers;
public VFXSystemDesc[] systems;
}
The code snippets show that KvantSpray uses a simpler, component-based approach for particle systems, while VFXToolbox employs a more complex graph-based system with multiple interconnected elements.
Video glitch effects for Unity
Pros of KinoGlitch
- Focuses on post-processing effects for glitch and distortion
- Offers a variety of glitch effects like analog noise, digital glitch, and color drift
- Lightweight and easy to integrate into existing Unity projects
Cons of KinoGlitch
- Limited to glitch effects, less versatile than KvantSpray's particle system
- May require more manual tweaking to achieve desired visual effects
- Less suitable for creating dynamic, interactive visuals
Code Comparison
KinoGlitch (Analog Noise effect):
float u = Random.value;
float v = Random.value;
float amplitude = _amplitudeNoise.Evaluate(t) * _amplitudeNoiseAmount;
float dx = amplitude * (u * 2 - 1);
float dy = amplitude * (v * 2 - 1);
KvantSpray (Particle emission):
var p = _kernel.GetParticleData(i);
p.position = _emitter.GetRandomPoint();
p.rotation = Random.rotation;
p.velocity = _emitter.GetRandomVelocity();
_kernel.SetParticleData(i, p);
Both repositories showcase Keijiro Takahashi's expertise in creating visual effects for Unity. KinoGlitch excels in post-processing glitch effects, while KvantSpray offers a more versatile particle system for creating dynamic visuals. The choice between the two depends on the specific requirements of your project and the type of visual effects you want to achieve.
Special Effects with Skinned Mesh in Unity
Pros of Skinner
- Focuses on mesh deformation and skinning effects
- Provides more advanced character animation capabilities
- Offers a wider range of visual effects for character models
Cons of Skinner
- More complex to set up and use compared to KvantSpray
- Requires more computational resources for real-time performance
- Limited to character-based animations and effects
Code Comparison
KvantSpray:
public class KvantSpray : MonoBehaviour
{
public int maxParticles = 1000;
public float emissionRate = 100;
public Vector3 initialVelocity = Vector3.up;
}
Skinner:
public class Skinner : MonoBehaviour
{
public SkinnedMeshRenderer source;
public int frameRate = 60;
public float bufferTime = 1;
public bool fixTimeStep = true;
}
Both repositories are created by Keijiro Takahashi and are Unity-based visual effect tools. KvantSpray is a particle system generator, while Skinner focuses on mesh deformation and skinning effects. KvantSpray is simpler to use and more versatile for general particle effects, whereas Skinner provides more advanced character animation capabilities but is more complex and resource-intensive. The code comparison shows that KvantSpray deals with particle properties, while Skinner works with skinned mesh renderers and animation frame rates.
A first person multiplayer shooter example project in Unity
Pros of FPSSample
- Comprehensive FPS game template with networking and gameplay systems
- Extensive documentation and code comments for learning
- Regularly updated and maintained by Unity Technologies
Cons of FPSSample
- Larger project size, potentially overwhelming for beginners
- Focused solely on FPS genre, less versatile than KvantSpray
- Steeper learning curve due to complex systems
Code Comparison
KvantSpray (particle system):
[SerializeField] ComputeShader _compute;
[SerializeField] int _maxParticles = 1024 * 1024;
[SerializeField] float _emissionRate = 1e6f;
[SerializeField] float _lifeTime = 1.0f;
FPSSample (player movement):
public float moveSpeed = 8f;
public float runSpeed = 12f;
public float jumpForce = 20f;
public float gravity = -9.81f;
Vector3 velocity;
Key Differences
- KvantSpray focuses on particle systems and visual effects
- FPSSample provides a complete game framework for FPS development
- KvantSpray is more lightweight and easier to integrate into existing projects
- FPSSample offers networking and multiplayer capabilities out-of-the-box
Both repositories showcase different aspects of Unity development, with KvantSpray excelling in visual effects and FPSSample providing a comprehensive game template.
Creative coding library for Unity
Pros of Klak
- More comprehensive toolkit with a wider range of features for creative coding
- Includes utilities for input handling, math operations, and waveform generation
- Offers a modular approach, allowing for easier customization and extension
Cons of Klak
- Potentially steeper learning curve due to its broader scope
- May include unnecessary components for projects focused solely on particle systems
- Larger codebase to navigate and maintain
Code Comparison
KvantSpray:
public class KvantSpray : MonoBehaviour
{
[SerializeField] int _maxParticles = 1000;
[SerializeField] float _emissionRate = 1000;
[SerializeField] float _lifeTime = 2.0f;
Klak:
public class Waveform : MonoBehaviour
{
public enum Type { Sine, Triangle, Square, Sawtooth, Noise }
[SerializeField] Type _waveformType = Type.Sine;
[SerializeField] float _frequency = 1;
Summary
KvantSpray is a focused particle system for Unity, while Klak is a more extensive toolkit for creative coding. KvantSpray excels in simplicity and performance for particle-based effects, whereas Klak offers a broader range of utilities for various creative coding tasks. The choice between the two depends on project requirements and the desired level of complexity.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Kvant/Spray v2
Spray is a GPU accelerated object instancing/particle animation system for Unity.
Spray is part of the Kvant effect suite. Please see the GitHub repositories for further information about the suite.
System Requirements
Unity 5.1 or later versions.
Kvant effects require floating-point HDR textures to store animation state. Most of mobile devices don't fulfill this requirement at the moment.
No Backward Compatibility
This version (v2) is not compatible with the previous versions. You can't simply upgrade the previous implementation or use two different versions in the same project. Sorry for the inconvenience!
License
Copyright (C) 2015 Keijiro Takahashi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Top Related Projects
Additional tools for Visual Effect Artists
Video glitch effects for Unity
Special Effects with Skinned Mesh in Unity
A first person multiplayer shooter example project in Unity
Creative coding library for Unity
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot