Author Topic: UITexture blend looks messy  (Read 2796 times)

Oakshiro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
UITexture blend looks messy
« on: August 05, 2013, 05:59:52 AM »
Hi there,

I have a UITexture which is being downloaded from internet (Facebook picture), and should be displayed behind a round "hole" in a png sprite.
I activated the "Depth pass" option, and the UITexture has a Unlit/transparent colored material, but semitransparent pixels look quite messy...



I understand you cannot load a url inside a sprite so UITexture should be the correct way to do it, but how should I manage the alpha blend to make it look right?

Thanks!
Oakshiro

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture blend looks messy
« Reply #1 on: August 05, 2013, 08:03:39 AM »
Don't use depth pass. People keep mis-using that option, so I actually flat out removed it from inspector in 2.6.4.

Instead use a custom shader that would blend your target texture (main texture) with a mask texture. This way you will get soft edges.

Oakshiro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UITexture blend looks messy
« Reply #2 on: August 21, 2013, 06:20:55 AM »
Ok, I'll try to deactivate depth pass.. but I have no idea of how to properly create a shader...
Maybe I am trying to do something strange, but the idea is to load a image from the internet and put it as a sprite, behind the round one.

If you could point me out how to do it in one way or another it would save my day!
thanks

Oakshiro

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture blend looks messy
« Reply #3 on: August 21, 2013, 10:13:24 AM »
As I said... look into masks. The idea is that you will have a material that has 2 textures on it. First texture is going to be your downloaded texture. Second texture is going to be the circle mask. Blend the two in the shader, and you will get the effect you're looking for.

This isn't an NGUI question at all. It's a "shader basics" question.

Oakshiro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UITexture blend looks messy
« Reply #4 on: August 23, 2013, 07:06:55 AM »
Ok, then I'll search for a suitable shader on the internet.
thanks!