Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 jaja1 · Dec 06, 2014 at 06:40 AM · texturealphacutoff

Strange texture background using Unlit Transparent Cutoff

I'm getting a weird background with my texture while using a plane and an unlit transparent cutoff type lighting. Its supposed to be for a round health display so there is an alpha channel attached. - I tried adding a background in photoshop but that did not help. - I also tried flattening the image. - I also tried both targa and png formats (32 bits RGBA/ARGB when importing to unity). - I also tried clamp as opposed to repeat wrapping. - I'm still getting this strange background as well as some white edges...checked alot of posts but nothing seems to work so far. And what is even stranger, when the alpha-cutoff is changed just slightly below 1, the background disappears and thats when I get the white edges.

Any ideas?

PS. Attached a screenshot of what I am experiencing.

untitled.png (95.4 kB)
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 quansatthu · Dec 06, 2014 at 07:48 AM 0
Share

Can you upload your texture?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by b1gry4n · Dec 06, 2014 at 09:58 AM

The "strange background" you are talking about, which probably looks like the edge of your image has duplicated its pixel either up or down in the image to the border, happens because you did not specify pixel data for the areas where the strange background occurs.

It is important when creating alpha transparent or alpha cutout images to create your transparency on an alpha channel of your image. Do not just leave the background layer in photoshop as blank (checker pattern).

To avoid the white border on your images, fill the background of your image with the same color as the border of your transparent image. By border I mean the "outline" of your image. For example, if I were creating leaves I would fill my background with the same color as the edge of the leaf.

Pro tip: If you fill your background with a darker color than the image edge, when combined with the correct alpha channel, you can create a semi-outline. This will make your transparent textures "pop", though it is not necessary

After youve made sure you have an alpha channel, you can export/save it as a regular psd file. I like doing it this way so I can edit textures much faster by just double clicking inside unity. Inside unity select your texture. In the texture import properties choose "Advanced" from the texture type drop down. Check the "Alpha is transparency" check box.

And what is even stranger, when the alpha-cutoff is changed just slightly below 1, the background disappears and thats when I get the white edges.

This happens because unity is creating the transparency for you, which limits your control. It takes the image and wherever you have not specified pixel data, it will make the alpha channel black. Wherever there is an image it will be white. When you move the slider it is raising/lowering the effect the alpha has on the transparency. Since the alpha channel created jumps from black to white, there is no "in between" and the background will pop in. Creating an alpha channel in your image fixes this and you can control the falloff by gradating the alpha colors from white to black. 50% grey = 50% transparent. This does not work with cutout shaders and the "jump" happens because cutout shaders have no gradating. It is either visible or transparent, nothing in between.

So to walk you through fixing your situation. In photoshop select your image (ctrl + click the layer), click channels, fill the selection with the alpha channel selected with white. go back to layers, fill your background with the same red color as your image. Save to your unity project folder. Find the texture in unity and change its properties to "Advanced" and check "Alpha is transparency"

Comment
Add comment · Show 8 · 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 jaja1 · Dec 06, 2014 at 09:18 PM 0
Share

I am still a bit confused...I tried what you recommended and now I'm getting a red background ins$$anonymous$$d of the strange background from before. I attached my psd and tga files in this comment so you guys can see what I did (I'm a bit new to the concept of alpha channels).

psd.zip (43.8 kB)
tga.zip (46.6 kB)
avatar image jaja1 · Dec 07, 2014 at 12:13 AM 0
Share

bump..........

avatar image jaja1 · Dec 07, 2014 at 07:16 AM 0
Share

bumping again...major interest...

avatar image jaja1 · Dec 08, 2014 at 03:09 AM 0
Share

bump............

avatar image b1gry4n · Dec 09, 2014 at 12:53 AM 1
Share

What is the shader you are using? Take a screenshot of your texture import settings as well. Your files are set up correctly

Are you trying to create a radial bar that fills up in a circle using the cutout shader? If so theres a nice thread here: http://forum.unity3d.com/threads/health-bar-ui.42813/

Show more comments

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

27 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

Related Questions

Is there a way to create an fading alpha-cutoff effect? 0 Answers

Do alpha cut off with seperate texture? 1 Answer

Texture Alpha cutoff + Photoshop 0 Answers

Set alpha cutoff value Unity3d 1 Answer

use Alpha from image in Fragment shader 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