Hi every one
What the secret in this vdeo?
(no compute shader no geometry shsader) just pixel and vertex shader
GPU particles should be able to do that.
Perhaps even with normal cpu particles you can reach similar number of particles if that is all you’re rendering. I haven’t tried though so I might be wrong.
Looks like trail/line renderers.
Ah, yes! Now that you said it that definitely looks like dotted texture and trails instead of particles.
Yes,You are right.
Take your gift
using UnityEngine;
using System.Collections;
public class FO : MonoBehaviour {
// Use this for initialization
Transform my;
public float t1, t2,S,r1,r2;
float tt,ttt;
Vector3 dir,OLD;
void Start () {
my = GetComponent<Transform>();
tt = Random.Range(t1, t2);
ttt = tt;
OLD = my.localPosition;
dir = Random.onUnitSphere * Random.Range(r1, r2); ;
}
// Update is called once per frame
void Update () {
my.localPosition = Vector3.Slerp(dir, OLD, tt / ttt);
tt -= S*Time.deltaTime;
if (tt < 0.0f)
{
ttt=tt = Random.Range(t1, t2);
OLD = my.localPosition;
dir = Random.onUnitSphere * Random.Range(r1, r2); ;
}
}
}
And the shader
Shader "Games/Circle2" {
Properties {
c1 ("r b", Color) = (1,0,0,1)
c2 ("r e", Color) = (0,1,0,1)
c3 ("a b", Color) = (0,0,1,1)
c4 ("a e", Color) = (1,1,0,1)
cn ("number of circle", Float) = 24
}
SubShader {
Pass {
Blend One zero
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma debug
#pragma only_renderers d3d11
#pragma target 5.0
#include "UnityCG.cginc"
float4 c1,c2,c3,c4;
float cn;
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert (appdata_base v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = v.texcoord.xy;
return o;
}
half4 frag (v2f i) : COLOR
{
float x=i.uv.x;
i.uv.x=frac(i.uv.x*cn);
i.uv-=float2(0.5f,0.5f);
float b=dot(i.uv,i.uv)*4.0f;
if(b<=x)
return lerp(c1,c2,b)+lerp(c3,c4,x);
else
discard;
return (float4)0;
}
ENDCG
}
}
Fallback "VertexLit"
}
7 particles.
How did you count them?
For mobile, this is incredibly slow, possibly unusable vs just having a particle system with fastest possible shader.
I was thinking perhaps it was just pulling vertex coords from a texture which had totally precalculated paths
for particles to follow, because although the camera was moving it didn’t seem like the particles were really moving.
You can make gpu-driven particle systems without compute shaders or dx11… you can get millions of particles just using rendertextures and reading/writing vertex coordinates in a shader.