Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Kenny-Designs · Jul 22, 2015 at 06:47 AM · shaderunity 2dalphadiffusestretching

Unity2D: Stretching Where Alpha Should Be

I'm working on this game in 2D where everything you see I drew in ballpoint pen. I photographed the results and cleaned it up in Photoshop so that some bits are transparent. That's all fine and dandy when using the Sprites-Default shader which looks like this:

alt text

It works but I wanted to make use of real-time lighting on some assets to help give it a little extra depth. I switched the material to the Default-Diffuse shader and ended up with this problem:

alt text

Everything looked great but then I noticed all of the stretching between the wood and curtains.

I'm thinking to just make the curtains separate in Photoshop and place them on back on top of the wood in Unity so that they appear seamless. Problem is, I'm worried that this could get very tedious if I were to make something that is much more complex. Is there a better way?

example-1.png (352.9 kB)
example-2.png (378.3 kB)
Comment
Add comment
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

· Add your reply
  • Sort: 
avatar image
0

Answer by Paulius-Liekis · Jul 22, 2015 at 11:33 AM

This looks like filling of transparent areas of texture (i.e. areas with alpha=0). Unity does that to get better mipmaps, i.e. to avoid black lines on edges on lower mipmaps.

Your problem is that these pixels area showing for some reason. Did you change shader or something like that? Did you use Phong shader, in which case alpha is interpreted as reflectiveness of the surface instead of alpha?

Comment
Add comment · Show 2 · 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 Kenny-Designs · Jul 22, 2015 at 06:16 PM 0
Share

The surrounding area is nothing but alpha and works just fine. That's sort of why I'm confused. I did scale it down within Unity but the problem persists with the larger version too.

I did indeed change the shader from Sprites-Default to Default-Diffuse where the former worked just fine but the latter stretched the inner alpha bits.

This is how it looks within Photoshop so that you can see which parts have alpha and which don't:

alt text

anotherexample.png (382.2 kB)
avatar image Paulius-Liekis · Jul 22, 2015 at 06:35 PM 0
Share

It sounds to me that Sprites-Default has transparency, and Default-Diffuse does not. What kind of color do you expect transparent pixel to be? It's kinda undefined...

$$anonymous$$aybe you could try fixing your issue by changing import settings, maybe one of the import settings doesn't affect transparent pixels.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

All objects are getting transparent ? 1 Answer

Color To Alpha shader for android not working 0 Answers

Blend two texture diffuse shader with alpha 0 Answers

Separate Alpha and Color Textures for CutOut Shader 1 Answer

A Detail Diffuse shader with alpha for the detail texture? 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