• 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 /
avatar image
0
Question by jonselin · Jun 11, 2014 at 11:07 PM · 2dshadermeshsprite

Shader for mesh to project onto sprite?

I have a 2D project where I have a sprite game object with an irregular shape, and a square mesh sitting on top of it with a simple shader to use the color and alpha of the mesh. It's easiest to think of the mesh as applying a highlight/gray out to the sprite, however the actual use case is a bit more complex than that.

I'm completely new to shader programming, is there some way to make the mesh only be applied where there is no alpha on the underlying sprite, instead of showing the entire square?

Edit: If there is any further information I should provide to make my question clearer then please let me know.

Comment
Add comment · Show 1
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 GrahamReeves ♦♦ · Jun 17, 2014 at 02:15 PM 0
Share

you can do tests in the pixel/fragment-shader and NOT draw a pixel, so this might well be easy. Are the square mesh and the sprite two seperate objects? If you can post your current shader code this might help and we might be able to suggest a simple change

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

22 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

Related Questions

Shader vs Sprites - Sorting layer (ZWrite Off not working) 1 Answer

Render sprite only on top of a specific sorting layer 1 Answer

How to fix this kind of shader error? 0 Answers

Sprite Renderer Missing Material after running 1 Answer

Texture type -> Advanced -> Mesh type: how it works? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges