Author Topic: How to create atlas with correct transparency  (Read 5621 times)

rotasoft

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
How to create atlas with correct transparency
« on: October 17, 2014, 04:08:24 AM »
Hi, we want to use button in our atlas with correct transparency. I want to say that, image has transparency only at corners, not at image body. But after adding it to atlas, a little transparency added to image body. We don't want this. Atlas uses Unlit/Transparent colored. We tried some other shaders with no success. How can we show images with correct transparency? Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to create atlas with correct transparency
« Reply #1 on: October 17, 2014, 05:22:00 AM »
Whatever texture you choose gets added to the atlas as-is, unless your atlas is using a PMA shader (since you mention Unlit/Transparent Colored, it doesn't seem to). If the texture has transparency in the center, that transparency will be there in the atlas.

You can always test it by adding a UITexture (ALT+SHIFT+T) and choosing your original texture. It will match the sprite.

rotasoft

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: How to create atlas with correct transparency
« Reply #2 on: October 17, 2014, 06:14:16 AM »
What is PMA shader? My textures has no transparency at image body. Only background is transparent. To add texture to the atlas, I am selecting texture and using atlas maker of NGUI, adding to the atlas. I opened atlas texture to see it has transparency or not, I had seen that atlas image has no transparency. Atlas material shader cause this incorrect transparency. If I use diffuse shader, it will show transparency correct except corners and background because this shader doesn't support transparency. How I can I achieve images body with correct transparency and background and corners with transparency (my original texture is as this)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to create atlas with correct transparency
« Reply #3 on: October 17, 2014, 08:49:32 AM »
Try to attach an example of your picture here, then we can test it out locally. I would think that something might be changing the settings on your atlas, as they by default have transparency enabled. Think a preprocessor script or something like that.

Don't worry too much about PMA shader. The atlas material should use the one called Unlit/Transparent Colored.

rotasoft

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: How to create atlas with correct transparency
« Reply #4 on: October 17, 2014, 09:45:50 AM »
I have attached atlas texture and atlas settings' screenshots.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to create atlas with correct transparency
« Reply #5 on: October 17, 2014, 06:04:43 PM »
Where is the transparency added? There doesn't seem to be any thing wrong there. Is the sprite or a parent set to alpha less than 1?

rotasoft

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: How to create atlas with correct transparency
« Reply #6 on: October 20, 2014, 02:52:18 AM »
As you seen there is not any transparency at atlas texture. But at scene, it has a little transparency. All parents has alpha value 1. Why these atlas sprites have a little transparency at scene? If I change shader to diffuse or another shader transparency will be lost. But at this point edges and other transparent parts seen as black, not transparent.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to create atlas with correct transparency
« Reply #7 on: October 20, 2014, 06:02:51 PM »
Check the hierarchy if any of the parents of the sprite that are transparent for you have their alpha or color set to have lower than 255 alpha. If any of the parents have this, it will propagate down to the children making them all transparent. It's intended behavior, if this is the case. It is not a shader issue.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: How to create atlas with correct transparency
« Reply #8 on: October 21, 2014, 08:32:13 AM »
Used to happen to me.
Read this topic.

Quote
You should change a code line in NGUIEditorTools.cs, search for "alphaIsTransparency". You could have simply searched for "alphaIsTransparency = false" and change 'false' by true'.