Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Help!! Curved Particle Additive shader

Discussion in 'Shaders' started by Dharma_raj, Jul 28, 2014.

  1. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109
    Hi,

    Can anyone help me out on adding the additive particle shader to a curve shader. I am attaching both the shaders below.

    Thanks

    // Particle additive shader
    Shader"Mobile/Particles/Additive" {
    Properties {
    _MainTex ("ParticleTexture", 2D) = "white" {}
    }
    SubShader {
    Tags { "QUEUE"="Transparent""IGNOREPROJECTOR"="true""RenderType"="Transparent" }
    Pass {
    Tags { "QUEUE"="Transparent""IGNOREPROJECTOR"="true""RenderType"="Transparent" }
    BindChannels {
    Bind"vertex", Vertex
    Bind"color", Color
    Bind"texcoord", TexCoord
    }
    ZWriteOff
    CullOff
    Fog {
    Color (0,0,0,0)
    }
    BlendSrcAlphaOne
    SetTexture [_MainTex] { combinetexture * primary }
    }
    }
    }




    // Curve shader
    Shader"CurvedHorizon" {
    Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _QOffset ("Offset", Vector) = (-40,0,0,0)
    _Brightness ("Brightness", Float) = 2.48
    _Dist ("Distance", Float) = 140.0
    }

    SubShader {
    Tags { "Queue" = "Transparent"}
    Pass
    {

    BlendSrcAlphaOneMinusSrcAlpha
    CGPROGRAM
    #pragmavertexvert
    #pragmafragmentfrag
    #include "UnityCG.cginc"



    sampler2D_MainTex;
    float4_QOffset;
    float_Dist;
    float_Brightness;

    structv2f {
    float4pos : SV_POSITION;
    float4uv : TEXCOORD0;
    float3viewDir : TEXCOORD1;
    fixed4color : COLOR;
    };

    v2fvert (appdata_fullv)
    {
    v2fo;
    float4vPos = mul (UNITY_MATRIX_MV, v.vertex);
    floatzOff = vPos.z/_Dist;
    vPos += _QOffset*zOff*zOff;
    o.pos = mul (UNITY_MATRIX_P, vPos);
    o.uv = v.texcoord;
    returno;
    }
    half4frag (v2fi) : COLOR0
    {
    half4col = tex2D(_MainTex, i.uv.xy);
    col *= UNITY_LIGHTMODEL_AMBIENT*_Brightness;
    returncol;
    }
    ENDCG
    }
    }

    FallBack"Diffuse"
    }
     
  2. Dharma_raj

    Dharma_raj

    Joined:
    Jun 21, 2013
    Posts:
    109