These are Processing sketches that I used to create VFX particle textures in a Unity project.
Usage example:
Generates a simple disk particle.
| using UnityEngine; | |
| [ExecuteInEditMode] | |
| public class CreatePlaneStack : MonoBehaviour | |
| { | |
| public MeshFilter meshFilter; | |
| [Range(1, 64)] | |
| public int layers = 4; | |
| [Space] |
| float hash (float2 n) | |
| { | |
| return frac(sin(dot(n, float2(123.456789, 987.654321))) * 54321.9876 ); | |
| } | |
| float noise(float2 p) | |
| { | |
| float2 i = floor(p); | |
| float2 u = smoothstep(0.0, 1.0, frac(p)); | |
| float a = hash(i + float2(0,0)); |
| // Staggart Creations | |
| // http://staggart.xyz | |
| using UnityEngine; | |
| [ExecuteInEditMode] | |
| public class HeightmapToMesh : MonoBehaviour | |
| { | |
| public MeshFilter meshFilter; | |
| public Texture2D heightmap; |
| // unity ray marching with sphere marching : https://unitycoder.com/blog/2019/05/06/ray-marching/ | |
| // based on Ray Marching tutorial from The Coding Train https://www.youtube.com/watch?v=-6iIc6-Y-kk | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class RayMarchingSpheres : MonoBehaviour | |
| { | |
| // place spheres under this root gameobject |
| // NOTE DONT put in an editor folder! | |
| using UnityEngine; | |
| public class AutohookAttribute : PropertyAttribute | |
| { | |
| } |
| Shader "Custom/Circular Circles" { | |
| Properties { | |
| _CircleCount ("Circle Count", Float ) = 8 | |
| _CircleRadius ("Circle Radius", Range(0, 1)) = 0.18 | |
| _CircleSharpness ("Circle Sharpness", Range(0, 0.999)) = 0.95 | |
| _GroupRadius("Group Radius", Range(0, 1)) = 0.6 | |
| } | |
| SubShader { | |
| Pass { | |
| CGPROGRAM |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using UnityEditor; | |
| using UnityEngine; | |
| public class TextureCombiner : EditorWindow { | |
| //Input textures | |
| private Texture2D[] textures = new Texture2D[4]; |
| // original source: https://github.com/wlgys8/Sprites-Outline | |
| Shader "Sprites/Outline (Marching Ants)" | |
| { | |
| Properties | |
| { | |
| [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
| _Color ("Tint", Color) = (1,1,1,1) | |
| [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 |