Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Steve Tack

Pages: [1]
1
NGUI 3 Support / Possible bug in radial fill center coordinates?
« on: February 09, 2014, 01:00:55 AM »
This certainly isn't a critical bug or anything, but I was a little surprised to see that when using the radial fill feature of UISprite, it appears to use the optimized atlas size instead of the original image's dimensions for determining where the center is.

I have a couple of "arc" shapes that I'm doing radial fills on that represent about 220 degrees of circles.  In one case, the original image was 512 x 512 with a transparent background.  That got optimized to 453 x 502 and when using the Snap button on the UISprite inspector, it went to the original 512 x 512 size.  So it knows what the original was.

When doing a radial fill though, NGUI is clearly using the 453 x 502 image to calculate the center, but it should be treating it like 512 x 512.  So the center was off and it was screwed up.

I worked around it by putting pixels in the corners of the textures to force the full size in the atlas, which does work.  But of course it's not great to use up extra space in the atlas.  In my case, it's OK, since I've only got a few weird arcs like that and in this particular case, I'm not rendering the corners.

On that subject, it sure would be nice to have a starting and ending angle for doing arc-shaped radial fills.  :)  As it stands, I end up having to author the images with the start or end at the top and then rotating the sprite into position in Unity.

2
Had a follow-up question related to this.  I've started using an asset that requires linear color space to look its best, and now my NGUI-based render textures are getting *two* gamma corrections for color items using the color tint feature.  I'm using the color tint feature on some white font and sprite textures.  So, for example, if I want an orange color, I have to use an almost completely red color to get it to show up right.  RGB 255,32,0 tint renders as RGB 255,166,0.  I did the math, and that represents the color taken to the 1/2.2 (0.45) and then again.

That's using the settings I mentioned above (Clear Flag = Solid Color of black, zero alpha, Unlit/Transparent shaders on the texture atlas and material that uses the render texture.

Any idea what I can do?  I realize this might not be an NGUI issue, but I'm too much of a noob to know where the issue really is.

For now I can use colors that compensate for the double gamma correction, but that doesn't seem ideal.

3
Thanks for the reply!

As it turns out, the Google hits I read led me down the wrong path entirely.  The regular old Unlit/Transparent shaders work just fine for what I'm trying to do, as long as I set the UI camera's Clear Flag to "Solid Color", the background color to black, and the alpha to zero.  It also didn't help that I had forgotten I actually had some of my test labels set to semi-translucent, which threw me off.

Anyway, it's working great now.

4
NGUI 3 Support / Rendering NGUI UI to render texture with opaque widgets
« on: August 26, 2013, 02:35:14 PM »
I'm working on a game where there's a literal HUD in a cockpit (as in, the UI is supposed to be projected onto a plane of glass in front of the player).  I have a "freelook" option where you can look around with a thumbstick or mouse and possibly eventually a VR headset.  When looking around, the HUD should stay in front on that pane of glass.

So I created a render texture that's generated from an NGUI UI.  It does work, but there's a problem with transparency.  The elements like labels that should be 100% opaque are partially transparent.  The closest Google hit I found was this:
http://www.beowulf99.com/blog/?p=1014

I think that might be outdated, as the shader referenced on that page does not seem to have Colormask RGB in it.  I'm running the latest NGUI version, so something may have changed since then.  I tried every combination of Unit shaders on both the atlas and the material with the render texture I'm using, but I can't seem to get the transparency to work correctly.

Is there a way to do what I'm attempting with NGUI and have it render the way I want?

5
NGUI 3 Support / Re: Weird artifacts on 2D GUI with camera size of "1"
« on: April 01, 2013, 09:05:57 PM »
As I suspected, I think I was just doing something wrong with the NGUI settings.

I have the UI root, then camera -> panel -> two anchors.  Each anchor has a panel containing widgets and more panels.

For each anchor I had configured the "Ui Camera" property to the camera, but I had also set the "Panel Container" properties to the highest level panel without fully realizing what I was doing.  When I set Panel Container on both anchors back to None, the problem went away.  I had been using that setup for my other UI's without issue, but without fully understanding what I was doing I guess.

So I'm good now.  Clearly I'll need to read up on what those Container values are for before I use them!

6
NGUI 3 Support / Re: Weird artifacts on 2D GUI with camera size of "1"
« on: March 31, 2013, 10:18:07 PM »
Yes, I have that checked on both of my anchors.

7
NGUI 3 Support / Re: Weird artifacts on 2D GUI with camera size of "1"
« on: March 31, 2013, 07:55:50 PM »
Thanks for the reply!

I selected the top-most element of the UI that has UIRoot attached and pressed Alt-Shift-P, but that had no effect.  It's still weird looking if I change the camera size back to 1.  I did already have PixelPerfect for the Scaling Style.

8
I was prototyping a UI element with NGUI yesterday and at first things were going great.  Then at some point, the entire UI became scrambled when running in the editor with Maximize on Play.  Now I don't know what that was all about, but eventually the UI showed up scrambled all the time.

I'm pretty new to Unity, though I do know how texture filtering works from my experience with doing XNA games, so I double checked that the atlas textures were set to point filtering/clamp/true color.  If I set them to another texture filtering setting, the "scrambled" appearance would go away, but the UI would look fuzzy, as expected.

So after about an hour of changing every setting I could find, I finally stumbled onto something.  If I set the UI camera's size to something like 1.01 or 1.001, everything goes back to pixel perfect.  But I don't really know what that means.  I have that hack in place, but ideally I'd like to know what's going on here.  Since I don't know what's going on, I don't know if this is quirky Unity behavior, something I'm doing wrong in NGUI, or what.

Here's what my prototype UI element looks like with the camera size set to 1:
http://www.stevetack.com/misc/NGUI_CameraSize_1.png

And here's with the camera size set to 1.001:
http://www.stevetack.com/misc/NGUI_CameraSize_1.001.png

Ideas?

I do have the purchased version of NGUI and I think it's the latest version (or close to it).

Thanks!

On a side note, playing around with Unity has been a BLAST so far, and having access to add-ons like NGUI is a far cry from what I'm used to in the XNA world.

Pages: [1]