• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Jul 25, 2017 at 07:15 PM by GnomenxD for the following reason:

The question is answered, right answer was accepted

avatar image
Question by GnomenxD · Apr 06, 2016 at 02:17 AM · shadergraphicssprites

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: alt text

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.

example1.png (72.5 kB)
Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by TBruce · Apr 06, 2016 at 03:55 AM

@GnomenxD Is this what you are looking for?

Ship

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: alt text


inspector.png (95.1 kB)
ship.png (49.0 kB)
Comment
art_man

People who like this

1 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TBruce · May 30, 2016 at 07:21 PM 0
Share

@GnomenxD

Please click the tick to accept the answer if your question was answered. If you need more information please feel free to ask.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

76 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Using Sprite As Mask For Shader 0 Answers

My map turns blue red and green always! 0 Answers

Glow shader flickering when moving character horizontally 1 Answer

my standard shader assets turn pink in runtime 0 Answers

Receive Shadows after vertex transfrmation 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges