Search Unity

Is there a way to modify the UV map of an object in Unity?

Discussion in 'General Graphics' started by florinlegoo, Aug 3, 2019.

  1. florinlegoo

    florinlegoo

    Joined:
    Aug 3, 2019
    Posts:
    3
    Hello!
    I may have a problem of some sort and I want to know if there may be some way that I can't see to easily resolve this. So basically, I have made a mesh for a map ( only walls and floor ) in unity which I have imported in unity. Alongside this mesh, I have made ( in another blender project ) a few meshes for some misc objects to place on the map. So, I have decorated the map directly in unity, making a prefab out of each individual object and placing them. To offer some variety, I have also scaled some of the objects unevenly ( for example I have an object that is scaled several times more on the Y axis than on the X and Z ). Because of this the texture appear to be distorted and ugly. For the record, I have UV mapped all of the objects in blender, and without scaling they all look fine. My question is if I can somehow manipulate the UV map of an object directly in Unity, to resolve the stretching and distortion of the texture, without having to make an object in blender and properly UV map it there, then import it in unity and place it. Thank you for your time and I hope that my question makes sense ( I am new to the UV mapping shenanigans and I am not really sure how to resolve these kind of issues ).
    I have also posted an image of what the stretching looks like.
     

    Attached Files:

    Last edited: Aug 3, 2019
  2. iSinner

    iSinner

    Joined:
    Dec 5, 2013
    Posts:
    201
    It depends on the type of the texture of the object you scaled.
    You could try using a triplanar shader, or using the offset and scale in the material to make your texture repeat more times on the mesh.

    Can't help more than that because i don't really know the specifics of the issue, for instance what has been scaled, how do textures look, are they tiled?

    More details would help.
     
  3. florinlegoo

    florinlegoo

    Joined:
    Aug 3, 2019
    Posts:
    3
    Oh yeah sorry I am new at this so I don't really know what details would affect the material. To respond to your questions, I scaled the prefabs of the misc objects directly in Unity ( if you want I can also attatch an image of the map with the objects on it, but basically its just the same 4 prefabs scaled differently to seem more varied ) and the texture is just a 512x512 image, set on repeat ( on non-scaled objects it looks fine but on objects I scaled unevenly it is stretched ). I also want to add that I used the same material on all the objects ( I placed the material on the unscaled prefabs, imported directly from blender)
    Thanks
     
  4. iSinner

    iSinner

    Joined:
    Dec 5, 2013
    Posts:
    201
    If it is a tiled texture, increase the tiling in the material.

    You should separate the materials on the scaled and unscaled objects since increasing the tiling would affect all of them if the material is shared, and you would want to affect only the scaled ones.
     
  5. florinlegoo

    florinlegoo

    Joined:
    Aug 3, 2019
    Posts:
    3
    Ok man thanks I'll try it
     
  6. AreinDaral

    AreinDaral

    Joined:
    Dec 31, 2021
    Posts:
    1
    I am facing the same problem right now, did you manage to fix it?