Author Topic: Radial Reveal guidance?  (Read 5348 times)

oxyscythe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Radial Reveal guidance?
« on: July 21, 2014, 10:27:03 AM »
Hello! I am needing to do a radial reveal effect on a button and I was going to go down the custom shader route, but as I was doing some research I noticed the poster of this post here:

http://forum.unity3d.com/threads/health-bar-reveal-shader-with-1-drawcall-1-texture.125843/

was saying that actually NGUI might be able to do this already out of the box?

Is that indeed the case and if so could you point me to some resources that explain the process?

Many thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Radial Reveal guidance?
« Reply #1 on: July 21, 2014, 05:57:06 PM »
"Filled" type. Chosen on any widget -- sprite, texture, or 2D sprite.

oxyscythe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Radial Reveal guidance?
« Reply #2 on: July 22, 2014, 04:43:38 AM »
Aha! Yes, this is perfect, exactly the kind of thing I was looking for! Thanks!

That said, I have a slight follow up issue.

The sprites I need to do this on kinda need to be sliced sprites as they are buttons that may vary in size, and I need to do the radial reveal effect on the border (the animation goes something like ->radial reveal border->scale and alpha in button fill->pop in button text)

Any suggestions on how to go about doing that?

Thanks!

oxyscythe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Radial Reveal guidance?
« Reply #3 on: July 22, 2014, 06:08:02 PM »
Spent most of the day looking into options for this but came up blank :(

Bit frustrating as both the FilledSprite and the SplicedSprite functionality is there, I just need to be able to have them both.

Workarounds like trying to apply some sort of mask and applying the mask to my frame sprite didn't seem to work (as there doesn't seem to be any masking support - closest I found was using a clipping panel, but clipping is based on a rect so you can't do radial stuff like the FilledSprite)

So the best (only) option right now seems to be to add code to the UISprite so that additionally to the other types, it can also handle a SplicedFIlled type.

This too seems to get rather convoluted as the filling code in UISprite seems fairly complex and specialised to the current use cases that are handled.

I did spot the Advanced type too but again you can't seem to be able to have a radial type for the subtypes of the advanced type.

Failing all that are there any other suggestions on how to do this? Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Radial Reveal guidance?
« Reply #4 on: July 22, 2014, 11:22:42 PM »
You can't mix sliced and filled behaviours. Sliced sprite is drawn using 18 triangles (9 quads). Filled sprite is drawn using anywhere from 0 to 8 triangles. You have to choose one and stick with it. If you want behaviour that slices the border, then create a sprite from just the border in the size that you need it to be in, then use the Filled sprite type to draw it.

If you *really* want both mixed together, then you would need to create a custom widget type. I suggest deriving from UISprite and overwriting its OnFill function. You can pass any number of vertices you need into it.

oxyscythe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Radial Reveal guidance?
« Reply #5 on: July 23, 2014, 01:12:57 PM »
Yeah I kinda need both as we need the size independent behaviour of Spliced as well as the Radial/Horizontal/Vertical Fill behaviour of the Filled.

Thanks for the OnFilled suggestion, I will look into that when I get the chance and hopefully do it that way, for now I have gone with a different, simpler effect (much to the dismay of the art team! ;) )