• 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 /
This question was closed Mar 06, 2020 at 11:55 PM by TheDarkVoid for the following reason:

Problem is not reproducible or outdated. Solution is now built into unity

avatar image
0
Question by TheDarkVoid · May 10, 2014 at 05:23 PM · healthbar

Circular Textured Healthbar with transparent background

Before I state my question, I wan tot say that I already tried Eric5h5's solution using aplha cutoff and that does not give me the result I'm looking for.

Here is a screenshot of the texture I'm trying to turn into a healthbar: healthbar

I want to be able to mask out(somehow) parts of the texture based on a value. I've tried Eric5h5's solution which allows me to get a nice circular cutout but it doesn't allow me to have it textured, it would be nice to be able to apply the alpha culling of his solution to support using a textured base. I've tried a few shaders for masking textures but those don't allow me to control the mask the way I need to. Also I can't use a segmented healthbar, those don't look very good, I'd also like to avoid NGUI. Any solution is welcome no matter how complicated as long as it is properly documented and not inefficient.

capture.png (54.9 kB)
Comment
Add comment · Show 2
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 DMGregory · May 10, 2014 at 05:38 PM 0
Share

What leads you to believe that Eric5h5's solution does not allow you to have the ring textured? Have you tried using it with your desired textured look in the RGB channels and the angular gradient in the alpha channel?

avatar image TheDarkVoid · May 10, 2014 at 05:50 PM 0
Share

I'm not sure how to do that... I'm using the unlit/transparent cutout shader, amusing that's the right one. Edit: I figured out what you meant and that doesn't work, it creates the effect just fine but it causes discoloration of the texture since some of the information is lost to the alpha. alt text

capture.png (48.1 kB)

1 Reply

  • Sort: 
avatar image
0

Answer by robertbu · May 11, 2014 at 06:53 AM

How about a really simple AlphaTest shader:

 Shader "Custom/AlphaTest" {
     Properties {
         _MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}
         _Blend ("Blend", Range (0, 1) ) = 0.5
 
     }
     SubShader {
         Pass {
             AlphaTest LEQUAL [_Blend]
             SetTexture [_MainTex] { combine texture }
         }
     }
 }
Comment
Add comment · 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 TheDarkVoid · May 12, 2014 at 12:17 AM 0
Share

That results in a fading out effect and introduces noise to the texture as shown below: alt text

capture.png (31.0 kB)

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

21 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

Related Questions

enemy set to be prefab 0 Answers

Scrollbar Thumb Scaling 0 Answers

guitext and texture following gameobject, how to destroy and alternatives? 1 Answer

Manabar Pause Limit 2 Answers

How do I make overlapping Health Bars? 1 Answer


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