Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 O.Macchiato · Apr 01, 2016 at 06:34 AM · shaderspriterenderingtransparency

Shader for 2D Sprite "Always Rendered on Top" Problem

I was advised to start a new question by @BaraKrossteig, so here it is.

Original Post: http://answers.unity3d.com/questions/1162194/2d-sprite-transparency-rendering-problem-with-illu.html#comment-1162753

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

The following is the illustration that I will be using as reference for the explanation:

http://postimg.org/image/7orvk44v3/

Here are some pointers to the illustration:

The leaf is the sprite

Polygonal shape encasing the leaf is how Unity renders transparent sprites

What happened:

I have a Sprite, just like the leaf, at the bottom of another GameObject. However, the Sprite was rendered on top. When the sprite is rendered on top this way, it also renders what was in the encasing polygon, which is the Unity blue background. The result is as follows:

http://postimg.org/image/lmntixlld/

In case it is hard to recognize from the image, the layers of yellowish brown colors is the GameObject that is on top of the Sprite. So what probably happened here is that:

1) the Sprite is at the bottom

2) it renders the Sprite

3) the transparent area renders the Unity blue background

4) the Sprite is brought to the top of all GameObjects along with the Unity blue background

(I am sorry that I cannot display too much of the content of the game.)

Regardless, my guess is that it is a shader problem, so it will help me greatly if someone who is good at shaders can take a guess on what I did wrong for my shader. I did write my own shader with limited knowledge so I might have missed out some crucial settings in the script or something.

Thanks in advance!

TL;DR: Sprite is rendered on top of all GameObjects along with the Unity Background in the Sprite Mesh. I do not want it to be on top all the time as the sprites will cover the UI elements. Most likely Shader problem. Shader help please.

Additional Research Items:

http://forum.unity3d.com/threads/spritesharp-sprite-mesh-optimizer.327997/

The Tree example in this link illustrates how Unity renders sprites with transparency

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 meat5000 ♦ · Mar 31, 2016 at 12:17 PM 0
Share

What is your actual question?

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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

Sprite not visible from behind 0 Answers

Create a shader using mask for sprite 1 Answer

How to capture sprites on Camera Opaque Texture? (Universal Rendering Pipeline) 0 Answers

Render texture above something else 1 Answer

GrabPass and Transparent geometry 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