Search Unity

JPG won't be shown in full size

Discussion in 'Scripting' started by alexander, Apr 17, 2008.

  1. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Hi,

    I want to display a large map - can be 7000 x 4000 or even larger.

    I' using a given code for a scrollview and as you can see the parameters aren't too small-sized.
    But the jpg is displayed in a much smaller resolution in the scrollview as its original size (could be 1500x 800).
    How could this happen and even more important, how can I solve this problem.

    Code (csharp):
    1.  
    2. import UnityEngine.GUI;
    3. ...
    4. var logo : Texture2D;
    5. var bauplan : Texture2D; //<-- thats the big map
    6. ...
    7.  
    8.     scrollPosition = BeginScrollView (Rect (0, 0, 1024, 630), scrollPosition, Rect (0, 0, 10000, 10000));
    9.  
    10.         Box (Rect (0,0,10000,10000), "");
    11.        
    12.         Label (Rect (5, 0, 175, 33), logo);
    13.  
    14.         Label (Rect (35, 35, 10000, 10000),bauplan);
    15.    
    16.  
    17.     EndScrollView ();
    18.  
    Thanks for every idea

    alex
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You shouldn't go past 2048x2048 for a single texture, as most graphics cards can't go higher than that.

    --Eric
     
  3. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Hmm, that is, there is no other alternative possible?
    Furthermore I've even planned to resize manuelly the map up to 3 or 4 times.

    Hmm, 2048x2048? My new iMac not even shows this resolution... :-(
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could tile several textures together. Just so long as each individual texture is no larger than 2048x2048.

    Well, texture resolution is different from screen resolution if that's what you mean.

    --Eric
     
  5. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    But even when the texures are smaller 2k x 2k, they were scaled down.
    Now I've got an image with 1500x782 px and in my scrollbar its scaled down to about 2/3 of the width.
    (and also 2/3 of the height)
    What to do, to have the textures in-1:1-size on the screen?

    Thank you
     
  6. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    Make sure that the GUIStyle applied to the Box element you're using to display your texture is set to the fixed size of your texture in the GUIskin definitions, or add GUIStyle.Width and GUIStyle.Height overrides in the Box element statement. Otherwise, it is sizing it to the available space in the containing window or area.
     
  7. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180
    Thanks DOC,

    found the entry for width and height.
    And when I restrict it for instance at the "FixedWidth" to 50 px, my picture is 50 wide and accordingly high.
    In my case, I've tested it with a 1442 x 1920 px image.

    But when I test it with 0 in FixedWidth and FixedHeight or with the dimensions of the image it's resized either a wide of 1024 or to a height of 768/769.
    But in my script there is neither 1024 nor 768...

    Is it a restriction of Indie?
    Is there a manager, where I can adjust the height and width?

    ...next coffee...
     
  8. alexander

    alexander

    Joined:
    Mar 28, 2008
    Posts:
    180