Best solution for fake shadow?

Hello Comm unity.

I have a 2D game and I need a fake shadow for a very simple (almost plane like) object.
The shadow does not need to be real-time.

The way I see it, there are 3 options:

  1. Use a projector.
  2. Use a shader.
  3. Make a copy of the mesh and make it black with a bit of transparency.

What Do you think is the best option (performance vs look).

Keep in mind, this is for mobile.

Thanks!

i don’t know how real the shadow needs to be. often it is enough to put a black circle on the ground and make it follow the player.

It’s not a player in my case.

It’s a 3D line I made.

You should provide more information as each solution has it’s own use case. Maybe you could post a screenshot so we can see what you want exactly.
Can’t you just create a similar 3D line, just as shadow?

@BIG BUG
Yes I can, that is listed as option number 3.

I’ll try to explain a bit more.

I have a 2D line (mesh) I made with code.

I do not want to use dynamic shadows to keep performance up (I will have many lines).

Imagine a Photoshop drop shadow effect, that’s what I want to try to accomplish.

Did you try lightmap baking?

The lines will be switched on and off, so that is not an option

So maybe you can use multiple materials? Multiple textures layered in a single mesh - Questions & Answers - Unity Discussions

Can you explain how can that be used to create “shadow”?

I don’t see how it’s related.

I mean, if you got a plane that has a texture on it, you can add a second material thats overlapping the first one with the shadow for example.

I don’t have any texture on the lines, just a color (using the solid color with transparency shader from the wiki).

But regardless, The only effect I can get by adding another material is, making the line look like something is casting a shadow onto it and not like the line is the one casting the shadow.

Yeah, i meant to use a material on the object thats receiving the shadow. Maybe you can upload your project or a small part of it to see, what you are trying to achieve

In TOB, I just raycast down. But I only do that for any model currently rising or falling, otherwise it already knows what height it should be. Then just draw stuff.

@asd234w4r5
The objects below the lines are also moving and there are many lines in different shapes, making it impossible to do it the way you suggested.

@hippocoder
Huh?
I don’t know what TOB is, but the height of my lines above the other stuff is always the same, so no reason to raycast.

Let me clarify something.
This is “flat” 2D, so I don’t really need the “shadow” to be on the objects under the lines.
It can easily be above the objects (still under the lines obviously) and still look the same.
Right now I’m leaning towards option number 3, but still looking.