Hello Guest

Author Topic: Unity Texture problem  (Read 5460 times)

DWORD

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Unity Texture problem
« on: January 14, 2014, 05:08:39 pm »
I just started using 2D toolkit (had it for some time, but never used it) and I'm having some problems with the Sprite Collection.


(Image from the Tilemap Demo)

What is the problem here?
Dumont Studios - www.dumontstudios.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Unity Texture problem
« Reply #1 on: January 14, 2014, 05:58:44 pm »
1. What version of 2D Toolkit are you using
2. What have you done in the project? Did you change it to PNG?

DWORD

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Unity Texture problem
« Reply #2 on: January 14, 2014, 06:18:06 pm »
1. The latest version (2.3.3)
2. The first time I loaded the scene it had the graphical glitch (no changes), then I changed to PNG and the tilemap palette glitched.

I found out that I had to change the shader manually to Blend2TexVertexColor (to work with Unity Texture). The PNG palette still glitched.
« Last Edit: January 14, 2014, 06:20:44 pm by DWORD »
Dumont Studios - www.dumontstudios.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Unity Texture problem
« Reply #3 on: January 14, 2014, 06:21:28 pm »
Im not at my dev machine right now, but -
the tile map should work fine without switching to Blend2TexVertexColor. Why did you have to change it?
There could be an issue with png textures + the palette, I'll investigate that.

DWORD

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Unity Texture problem
« Reply #4 on: January 14, 2014, 06:44:31 pm »
If I didn't change to Blend2TexVertexColor or BlendVertexColor it would look like the image in the left (Unity Texture glitched), since the default shader for that was PremulVertexColor (the first time I loaded the scene).
Dumont Studios - www.dumontstudios.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Unity Texture problem
« Reply #5 on: January 15, 2014, 10:49:40 am »
Thanks for pointing that out. It looks like there was an error in the previously uploaded version (2.3.3) which only manifested itself when imported into a new project. We're working on a fix and will upload a new version.

Update - turns out there isn't an error, but an additional case that needs to be handled somehow. This only happens when a Unity project is created with the "2D" default settings, and then importing tk2d. Because tk2d is backwards compatible to Unity 3.5, there are some missing values for settings in there, namely "Alpha Is Transparency". Normally that would be fine, but Unity picks different default values when running in "2D" or "3D" mode, and as a result in 2D mode it wrongly ticks Alpha is Transparency. I'll have to investigate how to detect and change that, as it is a setting that Unity sets on the texture as soon as its imported, before we get any control over it.
« Last Edit: January 15, 2014, 02:58:45 pm by unikronsoftware »

stilghar

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unity Texture problem
« Reply #6 on: February 06, 2014, 10:38:28 pm »
Guess I'm also having this issue, shall I set the proyect as 3D then? I thought also it was a problem with the shader and changed it to the Blend one...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Unity Texture problem
« Reply #7 on: February 06, 2014, 10:45:53 pm »
You could, but this only affects the demo scenes. You can also unstick alpha is transparency to fix it as mentioned in the previous post. tk2d 2.4 (in beta now) has a hack to detect this and fix it.

stilghar

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Unity Texture problem
« Reply #8 on: February 06, 2014, 10:48:28 pm »
Thanks Unikron, I see you already replied also in the private support thread.