You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.5 KiB

Shader "UltraCombos/ParticleWorks/ParticleViewer/UnlitParticle"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_Emission("Emission", Range(0, 5)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma geometry geom
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct v2g
{
float4 vertex : SV_POSITION;
float3 color : COLOR;
};
struct g2f
{
float4 vertex : SV_POSITION;
float3 color : COLOR;
UNITY_FOG_COORDS(1)
};
fixed4 _Color;
half _Emission;
float4x4 model_matrix;
#ifdef SHADER_API_D3D11
#include "Inc/Defines.cginc"
StructuredBuffer<Particle> ssbo;
#endif
v2g vert (appdata_base v, uint vid : SV_VertexID)
{
v2g o = (v2g)0;
#ifdef SHADER_API_D3D11
Particle p = ssbo[vid];
o.vertex = mul(model_matrix, float4(p.position, 1));
o.color = p.color.rgb;
#endif
return o;
}
[maxvertexcount(6)]
void geom(point v2g input[1], inout PointStream<g2f> OutputStream)
{
g2f o = (g2f)0;
o.color = input[0].color;
o.vertex = UnityObjectToClipPos(input[0].vertex.xyz);
UNITY_TRANSFER_FOG(o, o.vertex);
OutputStream.Append(o);
OutputStream.RestartStrip();
}
fixed4 frag (g2f i) : SV_Target
{
fixed4 col = fixed4(i.color, 1);
col.rgb *= 1 + _Emission;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}