BoJack
Topic Author
Posts: 11
Joined: 28 Apr 2020, 12:16

Image stretch out in Unity

29 May 2020, 14:25

Hi,
My problem is that a picture I have put in a Path as an ImageBrush stretch out in Unity instead of following the value UniformToFill. I tested on blend, it works perfectly but once I test on unity, the picture stretch out (but not the same way it would have stretch with the Fill value)
<Grid  Grid.Row="0" Grid.RowSpan="3">
            <Path Margin="0 0 0 0" Data="M-0.5,-0.5 L-0.5,449.5 399.5,449.5 304.5,-0.5 z">
                <Path.Fill>
                    <ImageBrush ImageSource="./../Images/example.jpg" Stretch="UniformToFill"/>
                </Path.Fill>
            </Path>
</Grid>
On blend:
Image
On unity:
Image


Any idea?
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Image stretch out in Unity

29 May 2020, 16:58

Could you please attach the original image so we can do some tests and analyze what is happening?
If the behavior between Blend and Unity is different it could probably be a bug in Noesis.
 
BoJack
Topic Author
Posts: 11
Joined: 28 Apr 2020, 12:16

Re: Image stretch out in Unity

29 May 2020, 17:50

Here is a link to the original image : https://imgur.com/a/yMkFJgi
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Image stretch out in Unity

29 May 2020, 18:19

Is it possible that you are resizing the image in Unity to the nearest power of 2? Try setting "Non-Power of 2" to "None".
Noesis deals directly with Unity's texture, so we know about texture dimensions, not the original image size.
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Image stretch out in Unity

29 May 2020, 18:35

I was thinking about this, if we should consider the original image dimensions before Unity converts to texture. But it seems it is not possible:
Unity does not provide a documented API for accessing the width and height of a texture asset before any processing has been applied by the texture importer. So if you have a texture that measures 210x210 in Photoshop, when imported into Unity the texture will likely read 256x256 due to NPOT and/or maximum resolution.
 
BoJack
Topic Author
Posts: 11
Joined: 28 Apr 2020, 12:16

Re: Image stretch out in Unity

02 Jun 2020, 09:51

It works, thanks!
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Image stretch out in Unity

02 Jun 2020, 10:33

Great!

Who is online

Users browsing this forum: Bing [Bot] and 18 guests