Author Topic: question on UILabel shadow effect implementation  (Read 2292 times)

hugo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
question on UILabel shadow effect implementation
« on: October 28, 2016, 08:22:34 AM »
Hi,
I have a question on UILabel's shadow effect implementation, paste some codes here:

// UILabel.OnFill
public override void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
{
   // some codes here
   // add label verts, uvs and cols to buffer

   // Apply an effect if one was requested
   if (effectStyle != Effect.None)
   {
      int end = verts.size;
      pos.x = mEffectDistance.x;
      pos.y = mEffectDistance.y;

      // add effect verts, uvs and cols to buffer
      ApplyShadow(verts, uvs, cols, offset, end, pos.x, -pos.y);
      
      // other codes here
   }
}

my question is that since label shadow effect verts(etc.) are added to draw call buffer latter and the label's shader (normally is "Unlit/Transparent Colored") sets ZWrite Off,
I think shadow effect will render on top of original label, but now it seems not ...

does anyone can explain something about this ? thanks~

hugo

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: question on UILabel shadow effect implementation
« Reply #1 on: October 28, 2016, 10:14:58 PM »
after re-check ApplyShadow implementation, I figure out that it just apply shadow verts(etc.) to the front of draw call buffer which make sense, sorry for my lack of concentration ~