Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity has UDIM support now?

Discussion in 'General Graphics' started by PhoenixAdvanced, Feb 22, 2020.

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    264
    In previous versions of unity, I was unable to get UDIM textures working properly.

    However, I recently tried this in unity 2019.3, and it seemed to work!

    I create a single model in 3ds Max, split it up into 8 groups (by assigning ID's), and then unwrapped it, placing each of the ID sections on a different UV tile.

    I then exported to substance painter, and selected the UDIM option, then textured the model in the usual way.

    After exporting to unity, my 3d shape file had 8 texture slots, which was the same as the result that I got the last time, in 2018. This time, however, when I assigned my 8 unique materials, every one of them showed up perfectly!

    So, I basically have 8 unique materials and textures assigned to one 3D object, using UDIM.

    I am not using the unity multimaterial github package that I saw online, this is just "stock" unity.

    Did I miss something in the release notes? Does unity support UDIM now?

    Based on my tests, it seems like it does!
     
    gabrielmukobi likes this.
  2. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    54
    Hi Phoenix,

    Did you manage to get any clarity on this? Substance in there new update has improved the UDIM support.
    When you mention " 8 unique materials" are you saying you have 8 separate Unity standard materials for one model? (wouldn't this cause 8 draw calls for that model. being costly in game.)
    Or just one material with 8 different texture slots?
    Just would like clarity on as I would like to improve my workflow.
    I'm quite new to this process and there doesn't seem to be much information on UDIM use in Unity.
    I tried to do this years ago and applied separate materials in modelling package to different parts of the model then imported into Unity which had the same effect as it sounds like you are describing.
     
    soleron likes this.
  3. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    264
    Hi,

    I didn't manage to get any official clarity, but I can confirm that the new Substance version works great in unity with UDIM! It is possible to paint across seams now, which is fantastic, and that all works inside unity. You can basically have one huge object with many textures, and you can paint details across all texture sets at once, which is a very, very cool feature!

    I did need to make some changes to the export settings in substance painter to append the name of each texture set (1001, 1002, etc) to the textures, but that wasn't difficult.

    This is my material set up:

    https://imgur.com/y8r1HnT

    I am using a mesh renderer with a separate slot for each material, so yes, I am using 8 separate materials. That will cause 8 draw calls for that mode, and that would be costly in game, but as far as I am aware, there isn't another way of doing this, if there is, I'd love to hear it!

    For my purposes, I just want one UDIM object on screen at once, so having 8 draw calls isn't an issue.

    It certainly works though, it's strange that Unity haven't announced official support, it's a very useful feature when it's used correctly.
     
    Toby31 likes this.
  4. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    297
    No, I think it doesnt. The difference here is that you applied 8 materials on a mesh, while the point of UDIM is to operate multiple textures from within a single material, AFAIK. Putting parts of the model into different UV regions was a non-factor in your case, since textures (by default) are set to repeat themselves outside UV 0-1 boundary; and you'd get the same result if all parts shared the same UV space, but had an unique material assigned to each.

    Speaking of that, I assume it would be elementary to implement UDIM effect in a custom shader. If Unity doesnt clamp the mesh UV coordinates' values to 0-1 space (which I assume it doesnt), then you can make your shader calculate UDIM index for each area of the mesh using simple math (basically rounding the U value down to integer + incrementing the UDIM V index by one after UDIM U reached a certain threshold), and apply multiple textures based on this data. Though Unity shaders can only have limited number of texture inputs I assume, so it will be limited to fixed number of UDIM rows/columns
     
    FlightOfOne, soleron and VResearch like this.
  5. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,579
    What's UDIM technically? A format to pack different texture together so we have a single reference? Basically an atlas?
     
  6. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    264
    That's interesting.
    That's interesting. So, if UDIM was working, I would have ONE unity material, and multiple textures on the hard disk?

    The reason why I thought UDIM was working is because previously I couldn't get multiple textures to map to a single object properly in unity when I exported them outside the 0-1 number range, they all appeared on top of each other.

    Now, putting parts of the model into different UV regions works, although I need to use several materials.

    How would I have achieved this using the same UV space? If I have, for example, one object in my modelling tool, split up into different UV sets, but occupying the same UV space, won't the UV sets overlap?

    I will try it again, but I'm pretty sure I did this and it didn't work.
     
  7. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    297
    Yes, one unity material, which would require special UDIM shader, with multiple texture slots (for each position on UDIM grid)
    If you have multiple materials, each containing a unique set of textures, and each is assigned to its corresponding fragment of the mesh with appropriate UVs, they'll have nothing to overlap with.
     
    Last edited: Aug 26, 2020
    PhoenixAdvanced and soleron like this.
  8. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    297

    Here is some demonstration. UV overlapping or not doesnt really matter if you have 2 different materials on the mesh + no UDIM support (like in Blender)
     
  9. Cam_Crichton

    Cam_Crichton

    Joined:
    Oct 31, 2019
    Posts:
    11
    You shouldn't need multiple texture slots - that's the whole point of UDIM, it follows a naming convention that applies the texture based on the UV space.
     
  10. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    297
    I was speaking from Unity shader writing perspective. A shader can only have pre-determined number of texture slots. As far as I know, you cannot tell it to load textures from a folder instead of having fixed texture reference
     
  11. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    318
    UDIM comes with a file that specifies which texture matches to what UV tile. So you only need to load that UDIM "configuration file".

    The other option (which kind of sucks and is not real UDIM but say, a "compatibility mode" ) is getting Substance to split the UV tiles. In which case you end up with several different materials, the amount of which depends on the amount of your UV tiles.
     
  12. SOIL

    SOIL

    Joined:
    Sep 2, 2011
    Posts:
    201
  13. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    264
  14. miracletechteam1

    miracletechteam1

    Joined:
    Sep 18, 2019
    Posts:
    11
unityunity