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 - Seroster

Pages: [1]
1
I'm not Aren, but - not likely.

There is not going to be much disk space wasted.  However you are going to deliver your app, the texture ought to end up being compressed on disk.

I think chances are also high that the graphics card of the device you are building for (e.g. iOS) only deals with textures which are a power of 2 in size (256x256, 1024x1024, etc).

However, if you aren't using Dynamic fonts then I think you might be able to put the font into an atlas along with other graphics.

2
I know this is more of a 3D question, but if anyone has any ideas about this it would be awesome.

Here's the situation:
- I have an NGUI UITexture that I am positioning in 3D on a map to indicate a point of interest.  I'm doing this so it can be occluded, maintains its position when the map is rotated, etc.  (So, the UITexture is on a special layer which is seen by a camera which sees the 3D stuff, and the special layer, but not the rest of my UI)
- I've got a script to always orient this texture towards the camera (which works!)

However, I've been asked to make this texture keep its size on screen the same as if it was being shown by an orthographic 2D camera.
*pounds head on desk*

I'm not that much of a 3D guy.  I know I can use camera.WorldToScreenPoint() to figure out the location of a point in 3D, on the screen, so I can figure out where the centre of the texture is.  But I can't figure out the position of the corners without knowing the extent of the texture in 3D (which is not its pixel size) and that confuses the heck out of me.

What I need to do though, is either
- figure out the size of the texture on the screen currently, compare with the actual pixel size of the texture, and then calculate a scale to apply, OR
- figure out based on the vector from the camera to the texture, what the scale of the texture is at that distance.  I guess that might only be an approximation?

Any ideas?

3
NGUI 3 Support / Re: 3D model Clipping with Panel?
« on: December 17, 2014, 12:56:07 PM »
Given that ngui panels aren't 3d... you might want to look at the camera viewport rect.  OR render the 3d camera output to a texture and then position the display of that using a UITexture.

4
NGUI 3 Support / Vertex coloured sprites
« on: September 28, 2014, 10:56:54 AM »
I'm using this for something in a hobby game I'm working on.   This allows you to create colour gradient effects on sprites.  In case this of use to anyone:

Of course this would be better if you could set the colours from within the inspector.  I don't need that myself so I haven't done it.  And it really would be better to ensure the list is filled before trying to render. :D

In UIBasicSprite.cs:
- add a new Type, "VertexColoured".
- in the Fill() method, add the following case to the code:

  1.                         case Type.VertexColoured:
  2.                         VertexColouredFill(verts, uvs, cols);
  3.                         break;
  4.  

And then you need this code somewhere:

  1.  
  2.         BetterList<Color> vertexColours;
  3.                
  4.         public void SetVertexColours(Color c1, Color c2, Color c3, Color c4)
  5.         {
  6.                 BetterList<Color> colourList = new BetterList<Color>();
  7.                 colourList.Add(c1);
  8.                 colourList.Add(c2);
  9.                 colourList.Add(c3);
  10.                 colourList.Add(c4);
  11.                 this.vertexColours = colourList;
  12.         }
  13.  
  14.         protected void VertexColouredFill(BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
  15.         {
  16.                 Vector2 uv0 = new Vector2(mOuterUV.xMin, mOuterUV.yMin);
  17.                 Vector2 uv1 = new Vector2(mOuterUV.xMax, mOuterUV.yMax);
  18.                                
  19.                 Vector4 v = drawingDimensions;
  20.                                
  21.                 verts.Add(new Vector3(v.x, v.y));
  22.                 verts.Add(new Vector3(v.x, v.w));
  23.                 verts.Add(new Vector3(v.z, v.w));
  24.                 verts.Add(new Vector3(v.z, v.y));
  25.                                
  26.                 uvs.Add(uv0);
  27.                 uvs.Add(new Vector2(uv0.x, uv1.y));
  28.                 uvs.Add(uv1);
  29.                 uvs.Add(new Vector2(uv1.x, uv0.y));
  30.                        
  31.                 foreach (Color vc in this.vertexColours)
  32.                 {
  33.                         cols.Add(vc);                          
  34.                 }              
  35.         }
  36.  

5
NGUI 3 Support / Re: Mixing landscape and portrait scenes/content
« on: September 28, 2014, 10:46:43 AM »
Hey, thank you for the reply. :)  I'll try to clarify.

I've got effectively some parts of the UI which should ONLY appear as portrait and others which should ONLY be landscape.

If I just build the app in Unity and enable both portrait and landscape, I assume everything will rotate, and yes, if I've anchored everything properly, it should all reposition, and rescale correctly.   And that would be fine if those were the specifications I'd been given - but they're not.   (And also to clarify, in another post I referred to a hobby game... I'm working on the side on a freeware game, but THIS question is for a professional environment in which I'm modifying an existing app which uses NGUI)

So my thought was, build only enabling portrait, and for the parts that are supposed to be landscape, "fake it".

I'm not really sure that just rotating the elements is going to work.  I tried doing that to one scroll view and there was some very strange behavior (elements animating off diagonally?).  It might be simplest and clearest to build these parts of the UI by, for instance, changing a horizontal scroll view to a vertical one, with cells whose width and height I swap, and then just rotate the sprites inside the cells.

6
NGUI 3 Support / Mixing landscape and portrait scenes/content
« on: September 26, 2014, 03:39:02 PM »
Hi all,

This is hurting my head a bit and maybe someone has dealt with this issue before.

I'm working on the mobile phone layout for an app which is supposed to be mostly in portrait but a few parts are in landscape.  The app was originally built (to avoid load times, I guess) as one gigantic scene.

What is the best general approach to take here?  For instance, one of these scenes has a couple of scroll views in it (one horizontal, and one vertical).  If I set the rotation on a scroll view to 90 or 270, should placement and input work properly?  My current observation is that it doesn't seem to work, BUT there might be interference from some of the scripts being used.   Or should I anticipate that I'll want to change, for instance, a vertical scroll view to a horizontal one, with elements in the scroll view whose *contents* are rotated?

Pages: [1]