Author Topic: Default texture setting  (Read 4701 times)

castor76

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Default texture setting
« on: August 11, 2014, 02:58:07 AM »
I would like to have "alpha for transparency" setting ticked on for default NGUI texture setting.
We use the textures as is for our custom editor purpose so we want to have setting with above option to be ticked on by default?

Is there way? or do I have to hack some code into? ( I assume so..)

If I need to change some code, where should I look at?

Thanks in advance!


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Default texture setting
« Reply #1 on: August 12, 2014, 12:11:19 AM »
It's the default texture setting when the scene is set to 2D mode. It's not an NGUI thing.

castor76

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Default texture setting
« Reply #2 on: August 12, 2014, 12:23:32 AM »
Perhaps I have not explained clearly.

When you select a texture and open Atlas maker, I can click on Add/update to include selected texture into atlas.

When this happens, the texture import setting changes , but I would like the import setting to have "Alpha Is Transparency" option checked on as well.

At the moment , resulting atlas is correct, but the texture import setting is such that it's transparency is not visble in Unity. We use these textures somewhere else as well.

It doesn't matter if my scene setting is 2D or not.

castor76

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Default texture setting
« Reply #3 on: August 12, 2014, 12:24:59 AM »
And I am not talking about the resulting atlas texture, it's the import setting for original textures.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Default texture setting
« Reply #4 on: August 12, 2014, 06:54:44 AM »
"Alpha is transparency" is automatically used when the atlas is not using a PMA shader. Line 608 of UIAtlasMaker.cs. This is on the atlas texture.

Original textures are not important here. NGUI will turn off alpha is transparency on source textures and change other things as well to make the texture be as "natural" as possible before it goes into the atlas.

castor76

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Default texture setting
« Reply #5 on: August 12, 2014, 07:09:03 AM »
"Original textures are not important"

Well, that is not true in my case. Original texutres are IMPORTANT for me.

I don't think having "Alpha is transparency" for original textures are not going to affect making of the atlas texture.

I do want the original texture's "Alpha is transparency" setting to be turned on.

Where can I hack in so I can test this? For my textures (pngs with alpha in opacity" is not "natural" if it is not set as "Alpha is transparency". At least for my project and my usage of source textures. I do use source textures else where.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Default texture setting
« Reply #6 on: August 12, 2014, 07:28:56 AM »
From visual aspect, there is no difference between enabling alpha is transparency on the source texture and doing so on the atlas texture. Whatever is drawn should have it enabled. If the transparency is enabled on the source texture, when reading back the texture's data its not the same as when transparency is disabled -- at least that was the case back when I coded it in 4.2 beta days.

NGUIEditorTools.cs, search for "alphaIsTransparency". Line 449 in particular.

P.S. You could have simply searched for "alphaIsTransparency = false" in the project and found it. It's just 1 line.

castor76

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: Default texture setting
« Reply #7 on: August 12, 2014, 07:55:39 AM »
Thanks.

I have done this now and tried to update textures with "alpha is transparency" setting turned on.
The resulting atlas texture is the same and as far as I am concerned it is cool now.

It doesn't automatically do it for me, but at least keeps the setting when I turned it on before adding to the atlas. (which is acceptable work around)  :)


jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Default texture setting
« Reply #8 on: August 19, 2014, 10:47:22 AM »
I don't know why or how but I started having issues with this recently. I upgrade to version 3.6.8 and I continue changing and adding new images to the atlases, and the new ones start looking with some transparency on it. The problem: "Alpha is Transparency" wasn't check. I turn it on and and is working properly.

Anyway, I changed the code line to true in NGUIEditorTools.cs.