Hi, here we come with yet another question.
We are coding some custom faked "per-object" motion blur. We don't want a blur effect that affects the whole camera, but one that only applies to specific gameobjects. Since our game is 100% sprite based, we've came up with a peculiar solution.
When a gameobject is moving with certain velocity, we instantiate 4 sprite objects that have the same sprite as the original, give them a tiny X-Axis offset from the original position and -20% alpha each, so this creates an illusion of a "trail" that progressively fades when a object is moving fast.
This works and creates a rather nice visual effect, however all the sprite clones are rendered OVER the original sprite due to perspective issues, and we want them to be rendered behind it. Since our camera is special, we can't just displace them in the Z-Axis to hide them. To control the drawing order of the camera, we assign each "layer" of a scene a unique "Transparent" shader (Transparent+1, Transparent+2...), so the grater ones are drawn later.
So, when instantiating the sprite copies, we assign them a material shader that's 1 layer behind the original sprite material's shader to keep it drawn behind, but it instantly changes into the original's material, so the copies are drawn over the original again due to those perspective issues. Is there a way to prevent this from happening? e.g. copy a sprite, keep the original sprite but change the copy's material shader.
Sorry about the lame explanation, I know it's hard to understand. If you need it I can post a screenshot later. Thanks.