Particles not rendering when enters in projector area (639970)

Hi, I have particles system of Nitro…When it enters onto projector ,it gets invisible.

Anyone knows why this may be the case?

EDIT

I am using projectors for shadows…When I use particles for bike speed up i.e., nitro speed the particles get cutout by those shadows…

Here is screenshot of it,

Here is my shader code of projectors ,

Shader "Projector/Projector Multiply Black"
{
    Properties
    {
        _ShadowTex("Cookie", 2D) = "gray" { TexGen ObjectLinear }
    _ShadowStrength("Strength",float) = 1
    }

        Subshader
    {
        Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+100" }
        Pass
    {
        ZWrite Off

        //Fog { Mode Off }

        Blend DstColor Zero

        CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"


        struct v2f
    {
        float4 pos : SV_POSITION;
        float2 uv_Main     : TEXCOORD0;
    };

    sampler2D _ShadowTex;
    float4x4 unity_Projector;
    float _ShadowStrength;

    v2f vert(appdata_tan v)
    {
        v2f o;


        o.pos = mul(UNITY_MATRIX_MVP, v.vertex);

        o.uv_Main = mul(unity_Projector, v.vertex).xy;


        return o;
    }

    half4 frag(v2f i) : COLOR
    {
        half4 tex = tex2D(_ShadowTex, i.uv_Main);
        half strength = (1 - tex.a*_ShadowStrength);
        tex = (strength,strength,strength,strength);
        return tex;
    }
        ENDCG

    }
    }
}

Here is my particle code,

// Simple additive particle shader.

Shader "Custom/Particle additive"
{
Properties
{
    _MainTexture ("Particle Texture (Alpha8)", 2D) = "white" {}
}

Category
{
    Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    Blend SrcAlpha One
    Cull Off Lighting Off ZWrite Off Fog {Color (0,0,0,0)}

    BindChannels
    {
        Bind "Color", color
        Bind "Vertex", vertex
        Bind "TexCoord", texcoord
    }

    SubShader
    {
        Pass
        {
            SetTexture [_MainTexture]
            {
                combine primary, texture * primary
            }
        }
    }
}
}

Transparent+100 makes it ontop?

1 Like

I tried that on both shader…one of both shaders…but same happening

hmm

Change the fog from “Color (0,0,0,0)” to “Mode Off”.??

… is the multiply Blend mode operation on the projector the cause? maybe an idea
but perhaps Blend DstColor Zero causes destination = 0 ; source = source * destination

could that shadow be black using frag computation instead of blend mode? RGB = 0, Alpha = 1
///Blend One OneMinusSrcAlpha///…could that work?

1 Like

I able to solve that problem by adding two cameras, one for only rendering particle and other for rest of stuff…It did work pretty good.

I will check it out your solution soon and update you with same.

Thank you so much for your replies. :slight_smile:

As mentioned in your other thread this was a bug with projectors rendering twice (in this case once at the correct queue before the particles, and once at the end of the queue over the particles).

It’s listed as a fixed issue in the 5.4.2 release notes, so I suggest you upgrade to that.

  • Graphics: Fixed the issue of projectors rendering twice if transparent objects are in the scene. (814282)
2 Likes