The question is answered, right answer was accepted
How to draw sprite graphic over specific objects?
Hello everyone, and thanks for taking time to read my question. When it comes to simple scripting like in C# or Java I feel rather comfortable, but when it turns to being artistic and handling shaders, I simple go down.
I'm trying to accomplish a kind of "shadow" effect on sprites, which would only draw over specific objects, giving a sense of depth. I've tried a few different ways to do this, but nothing have worked. Underneath I've uploaded a picture, as an example of how the effect is suppose to look.
Example:
When the shadow sprite is over specific layers or objects it's suppose to be drawn, but edge if it extents over the object. If you'd have any idea or solution on how to approach and or accomplish this, it will be very much appreciate it.
Regards and have a pleasant day.
Answer by TBruce · Apr 06, 2016 at 03:55 AM
@GnomenxD Is this what you are looking for?
Take a look at this example video 2D selective shadow .
You can not do this using SpriteRenderer. You need to use a quad with a transparent/cutout shader instead.
Here is how I achieved this:
3 textures 1. Ship 2. Tarmac/Ground 3. Grassy area
All 3 textures setting are set to advanced. The ship has transparency so "Alpha is Transparency" is checked.
3 materials (one for each image) 1. Ship a. Albedo is set to image of ship b. Standard shader c. Rendering mode - Cutout 2. Grassy area a. Albedo is set to image of Grassy area b. Standard shader c. Rendering mode - Cutout 3. Tarmac/Ground a. Albedo is set to image of Tarmac/Ground b. Standard shader c. Rendering mode - Fade
Here are the inspector settings for the 3 objects:
Please click the tick to accept the answer if your question was answered. If you need more information please feel free to ask.
Follow this Question
Related Questions
Something wrong with the cut out feature of the standard shader? 0 Answers
Just Cause 3 Volumetric Explosions 1 Answer
Moving MANY objects together 0 Answers
Mesh & Shadow crash on Android platform build 0 Answers
Why Internal-Colored shader working in SetPass posteffect while others are not? 0 Answers