Shader "UltraCombos/Frozen/ParticleUnlitPoint" { Properties { _Emission("Emission", Range(0, 5)) = 0.0 _Size("Size", Range(0.0, 0.1)) = 0.01 } SubShader { Tags{ "RenderType" = "Opaque" } LOD 100 Blend OneMinusDstColor One //Blend One One Pass { CGPROGRAM #pragma vertex vert #pragma geometry geom #pragma fragment frag #pragma multi_compile_fog #include "../../ParticleWorks/Shader/Inc/Defines.cginc" #include "UnityCG.cginc" struct v2g { float4 vertex : SV_POSITION; float4 color : COLOR; }; struct g2f { float4 vertex : SV_POSITION; float2 uv : TEXCOORD; float4 color : COLOR; UNITY_FOG_COORDS(1) }; fixed4 _Color; half _Emission; half _Size; float4x4 model_matrix; #ifdef SHADER_API_D3D11 StructuredBuffer ssbo; #endif v2g vert(appdata_base v, uint vid : SV_VertexID) { v2g o = (v2g)0; #ifdef SHADER_API_D3D11 o.vertex = mul(model_matrix, float4(ssbo[vid].position, 1.0)); o.vertex.w = ssbo[vid].life; o.color = ssbo[vid].color; #endif return o; } [maxvertexcount(4)] void geom(point v2g input[1], inout TriangleStream OutputStream) { float3 position = input[0].vertex.xyz; position = UnityObjectToViewPos(position); float size = _Size * pow(saturate(1.0f - input[0].vertex.w), 1.0f / 2.2f); const int side = 3; g2f o = (g2f)0; o.color = input[0].color; float delta_a = UNITY_PI * 2.0f / side; for (int i = 0; i < side; i++) { float a = delta_a * i; float x = cos(-a); float y = sin(-a); o.vertex = mul(UNITY_MATRIX_P, float4(position + float3(x * size, y * size, 0), 1.0f)); o.uv = float2(x, y); UNITY_TRANSFER_FOG(o, o.vertex); OutputStream.Append(o); } OutputStream.RestartStrip(); } fixed4 frag(g2f i) : SV_Target { clip(0.5f / sqrt(2.0f) - length(i.uv)); fixed4 col = i.color; col.rgb *= 1 + _Emission; UNITY_APPLY_FOG(i.fogCoord, col); return col; } ENDCG } } }