Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How do I have an image keep its aspect ratio when used as a texture in shader graph?

Discussion in 'Shader Graph' started by JufJannieApps, Aug 5, 2019.

  1. JufJannieApps

    JufJannieApps

    Joined:
    Jan 8, 2016
    Posts:
    26
    I have an image that I get from the users photo library on mobile. But the image changes its aspect ratio to the screen size when I use it as a texture2D in shader Graph. I want the image to use its own aspect ratio. I don't mind if the image will be cut off at the edges, or if it repeats the edges.
    I cant change the size of the plane that has the texture on it. The plane is a disc and changing it's shape would not work. I just use an image in the graph and not much else.

    I am using the shader on discs that you rotate. The discs are part of a bigger image and using the shader on all objects it is possible to make the objects look like they are part of the same image.
    I am making a puzzle like this:
    https://i.etsystatic.com/15062905/r/il/7f7b4a/1846338783/il_794xN.1846338783_oowo.jpg

    It works with all my own images, but they are all in the correct aspect ratio.

    Thank you for reading.