better udim

Issue #381 resolved
Alessandro Padovani created an issue

Unless I miss something. I'm new to udims since I never used them in blender and I just got some articles and tutorials.

It seems to me there's a misconception about how udim is implemented. That is, in the current implementation we copy textures locally, then merge materials in a single udim material. Now udim is not to merge materials, but to merge textures that's different. So instead of selecting a set of materials to merge, we should select a set of textures to merge.

If we take as example G8F, ideally we could create a single diffuse udim merging all the diffuse textures, then replace the diffuse textures in all the materials with the new diffuse udim. The same for bump, specular, transparency and sss.

Merging materials is not the same thing because the same udim can be used in different materials. For example the diffuse udim could be used in multiple materials having different specularity. If we merge them we lose the different materials.

As a side note, as far as I can see, in the duf file there's no mention of the udim tile. This makes me suspect that daz studio doesn't really support udim, but just relies on texture tiling the same as we do in blender when we import without udim. For example the G8F eyelashes geometry gets a G8FBaseEyelashes_1006.jpg texture for the opacity channel, but it's on the first udim tile in the uv map. In this case the texture name doesn't match with the udim tile.

This doesn't mean that we can't try to organize the daz textures into udims of course. But just that we can't always trust the texture name for the udim tile.

Comments (30)

  1. Xin

    This feature already exists: https://diffeomorphic.blogspot.com/2019/12/udim-support.html

    I see no reason to do this automatically. The addon should try to keep materials separated like in daz. It’s up to the user to then merge them. The eyelashes aren’t part of the main body so they aren’t problematic.

    The concept of udim’s tiles is still relevant even if not necessarily using udims, for baking for example. Whenever you can, you want the UVs arranged in tiles. Non-udim materials won’t be affected anyway since they just wrap around and ignore tiling.

  2. Alessandro Padovani reporter

    No. The actual implementation merges materials that’s not good. It should merge textures instead. And I didn’t say anything about making it automatic, just that we should select textures instead of materials.

  3. Xin

    But that’s the main advantage of using udims here. I don’t see much of a reason to combine textures and then just keep the materials separated.

    You can already do that in Blender anyway, without the addon. Just creating udim textures is a Blender feature. I am not seeing how the addon could make it easier. Maybe I’m not understanding what you mean.

  4. Thomas Larsson repo owner

    For me, the main advantage with udims is that you can edit a single material that covers the entire body, or most of it anyway (eyes are usually different). If you keep the original materials, you must still tweak all of them, or use the limited material editor. And I don’t understand the point with using udim textures if you only use a single tile in each material.

    That said, I haven’t really used udim materials all that much. Or at all.

  5. engetudouiti

    You can not get UV infomation from saved scene.duf, but actuall UV infomation of each mesh is in data/UV set. . then duf may serch and use it when import.

    and actually each UV set dsf discribe all vert U and V value in the UV, so one verts may show U = 3.3 V = 0.5, (so we can confrim, the verts locate in 1004 UDIM tile space) we can see it when we import as obj (and add on may show same I suppose)

    Then I really do not know merging texture meaning…you may better to show real case when you need to merge texture..(I can only suspect grafted gen etc)

    At same time, Blender 2.8 offer new UDIM tools.

    then it can auto apply texture file, for each UDIM tile shader nodes by use the textue file name (like _1001 etc) . (about this case UDIM tile = material group as same as add on do) we need to make kind of texture set first in blender.

    But it only work, if you use uber type shader, like principled bsdf, which use one shader node for all UDIM tile material of the mesh.

    (eg,, you make UDIM texture set, and set the principled bsdf and connect texture node for base color.

    and set texture option as UDIM, if you set diffuse_1001 texture for UDIM 1001 material, after that blender auto apply diffuse _1002 texture for UDIM 1002 material base color texture,, , _1003 texture for UDIM 1003 material….

    At least current add on option of BSDF shader, can not use blender UDIM work flow. because it change shader structure for each UDIM tile. (or surface group) (though I do not seriously test it, but basically you can not adapt it for current bsdf nodes)

    Then about merge material correspond to UV tile, is often used for paint workflow for many aprication. (because many paint tool not suppose, there are multi mateiral group in one UV tile like daz)

    So add on offer the auto merge material option is quite reasonable for me. At same time, I actually not like to merge material, (so it can offer more variation only tweak shader porperty) then only when I need it, like export mesh to 3d coat and keep UV set (or 3d coat generate all material as each UV set, it may easy cause duplicated texture when export)

    Or when Bake texture, actually we may hope to merge material for each UV tile.

    And if we keep, UDIM UV blender could not bake texture,, I remember so,, but not test with recent 2.9 bake still. so I do not know, if it already solved or not.. about both case,, use UDIM UV or not, we may merge material which may use same texture for bake.. then blender generate textures without duplicate un-necessary one..

  6. Alessandro Padovani reporter

    Thank you everyone for your comments. I left this behind to test the addon by Xin that’s far more exciting. I’ll try to show better what I mean and why it is bad to merge materials with udims. I’ll take as example G8F.

    First, we already have a merge material tool that works very well. This tool merges materials if they have the same textures and material attributes. So only materials that are the same are merged, and after merging we don’t lose any daz material in the figure.

    As for the G8F example:

    1. The Ear and Face materials are merged because they share the same textures and attributes.
    2. The Lips and Face materials are not merged because they share the same textures, but not the material attributes. Specifically the lips get a different specularity, among other things.

    Below what we get after the merge, where all the daz unique materials are preserved. So this is all fine.

    Now we make the udim version, and merge udim materials. What happens is that, to get the daz udim, all the materials are merged in a single material. That is, in a udim figure we only preserve textures and give up any other material information. Well this is not merging materials, this is deleting materials to only keep the textures that’s different.

    As for the G8F example:

    1. The Lips and Face materials are merged because they share the same textures, thus we lose the material attributes.

    Below what we get after the udim merge, where all the daz materials are lost and we only keep the textures. So this is not fine. We can see that the specularity on the lips is lost, and the eyemoisture is pink because there’s no texture.

    So what to do ? Can’t we merge materials with udims ? Yes of course we can. Because all the textures are merged in a single udim texture. So in the G8F example the Legs, Arms, Torso and Face materials can be merged, because they share the same udim and material attributes. This is not possible with the merge material tool. It is only possible with the make udim materials tool. So this is the correct way to merge materials with udim, without losing the daz materials.

    So this is what to fix:

    1. Do not merge materials with different attributes, only merge materials with the same udims. This essentially merges materials by attributes, that is, all the materials with the same attibutes will be merged, because udims are the same for all the materials.
    2. When the material doesn’t get a texture, don’t plug the udim in the material slot. This fixes the pink eyes.

  7. Thomas Larsson repo owner

    Sorry but I don’t understand. The Make UDIM Materials tool lets you choose which materials to merge, and which material they are merged to. By default the Skin-Lips-Nails materials are selected, so the eye materials are unchanged. Or am I missing something?

  8. Alessandro Padovani reporter

    Thomas, unless I miss something, the issue is, with the actual behavior we can’t merge udims without merging materials too. In your example, Lips and Face have the same udim, but if we merge them we lose the different materials. Again, udim is for merging textures, not for merging materials. Then, after merging the textures, we can merge materials taking advantage of the merged textures, and thus merging more materials than was possible with separate textures, As explained above.

    Or, If I miss something, how do we merge Lips and Face without losing the materials ? And why shouldn’t we merge the eyes too ? The udim includes the eyes in daz studio at tiles 1006 1007, as shown above.

    That is, in daz studio we have a single udim shared among all the materials. So it’s not the materials we have to merge, it’s the textures.

  9. engetudouiti

    I simply think, at current add on not offer tool which we edit UDIM with UI without change material slot.

    but offer option, move all selected mesh UV to the selected tile like 1011 or 1010 etc.

    Then at same time, if plug in keep material and UV (if it was UDIM UV, generate UDIM tileUV witch described in dsf. ,and if it was not UDIM (genesis2 etc) keep it as one UV tile (of course we see overwrap) , as default . (when we selected multi material) I do not think importer need other thing witch Thomas need to solve.

    Because it is what daz importer need to do.. other things is actually not for daz importer but it is tool to edit UV and edit material for each purpose in blender. (though I never against, add those tool in this add on)

    Only one thing if Thomas add option to import (relate with UV and material of daz ) we may see most of daz genesis or V4 character surface, had custom group = template number. in daz studio.

    it actually group daz material surface with each tile to paint easy, ( not overwrap but logically clean uv as per UV set) so if add on can catch it, I may prefer,, add on auto generate material group as template number of surface group, as one import option (generate material as template number) what daz do as surface group.

    (though it not means, the template number = UDIM tile number at all, and of course once we merge material the material should use same texture (eg we merge lip and face as template1 , so now template 1 node only use same texture. we can not avoid it..

  10. Alessandro Padovani reporter

    Thomas, below an example how I can do it by hand, that’s not possible with the plugin.

    First I create a diffuse udim, with all the diffuse textures, let’s call it UDIM_G8F_Diffuse. We can do the same for specular, bump and sss.

    Then I can apply the udim to lips and face, without losing the materials.

    Now the rendering is fine because lips and face get the same udim but different materials. That is, we don’t necessarily have to merge materials to make udims. They are two different steps.

    We could have a “make udim textures” tool to make udim textures and apply them to materials instead of the standard textures. The the “merge materials” tool could be updated to also handle udim textures, so two materials with the same attributes and the same udim can be merged.

  11. Thomas Larsson repo owner

    Of course you lose information if you merge materials that are different. So if the lips and nails are colored and you want to keep that, just don’t include them in the list of materials to merge. Or you could include them and paint on the textures; the udim button is only enabled if the textures have been stored locally, so no daz asset is affected by that.

    I still don’t see what you gain by combining all textures into a big udim texture that you use in different materials. Not space, since the number of images is not changed, only some pointers that are used for book-keeping. In contrast, the gain with combining materials is clear: you have fewer materials that you can edit at will, and don’t have to maintain consistency with a lot of other materials.

  12. Xin

    I agree with Thomas, I don’t see much of a point in doing this if you are not combining materials. If you want to do it anyway, you can already do it with Blender. The addon wouldn’t be adding anything interesting to it.

  13. Alessandro Padovani reporter

    Again, I am not against merging materials. I am against merging materials that are different. Creating udims and merging materials are two different steps and have nothing to do one to another. With udim we can merge the face, torso, arms and legs materials, because they have the same udims and material attributes. While lips and face can’t be merged, because they have the same udims but different material attributes.

    Thomas, do we want to convert to udim or not ? If yes then all the materials should use udims. Then how is the user supposed to know what materials can be merged with udims ? Must he look and compare every material in the figure ? The “merge materials” tool merges automatically the materials and this is how it should work with udims too. There is no difference between udims and textures. That is, udims are just merged textures, and they have nothing to do with merging materials that’s a different step.

    steps:

    1. convert textures to udims: this will merge all the textures to udims, the same as daz studio
    2. merge materials: this will merge all the materials having the same udims and material attributes

    edit. Anyway, with the actual “make udim materials” tool, I can create a udim including only the face, torso, arms and legs materials, so to avoid merging materials that are different. But this way I can’t get udims for all the materials. Also this requires for me to know what materials are the same or not.

  14. engetudouiti

    There seems some miss usage of UDIM word.

    but I understand Alessandro request. because I often see same issue for other 3d paint tool. and we often talk about the difference UDIM UV tile, and material group . eg now I have genesis3 default UDIM UV, with keep all material group in blender. then export it to 3d paint tool. I may hope to use all material group to select and paint easy.. but ofcourse I only need each UDIM tile texture, not expect, to generate same texture for same UV tile mat.

    But most of 3d paint tool not work so, only separate material group with each UV tile. because it is only important group to generate and paint textures. (per UV tile)

    But daz user, or blender user request it,, (please divide UV tile (UDIM tile) and material group clear, they are not same group.. but even though the aprication developer understand means, they do not take it seriously.. because to paint texture, we only need to care which UV tile poligons. not material group.

    So the paint tool offer 2 options, use material group as separate UV tile (UVset they call) or use UDIM tile as each material. Alessandro request almost same-thing, for add on merge process. (make new UDIM without change material group as we need)

    one thing Alessandro seems not understand, if there is over-wrap in same UV tile, we never call it as UDIM.. though you can use the UV as you need, but UDIM is for 3d paint, then to it work,, on same UV tile, there should be no over-wrap. it is principal for UDIM workflow.

    So Alessandro can merge face, torso, legs as one UV tile. but without you adjust each island scale (by tool, or by blender un-wrap with only select those material, or use UV atlas tool) ,but simply locate those 3 parts on same UV tile, it should be overwrapped, then we never call it as UDIM anymore.

    So if alessandro request, merge UDIM tool, it means, it auto adjust each part scale and locate on the islande correctly = it not UDIM merge tool, but texture atlas, or blender UV unwrap tool with your selected surface.

  15. Alessandro Padovani reporter

    engetudouiti, I do understand that udims must not have overlapping uv maps in the same tile. I never talked about collapsing uv maps. In my example above, I use the “make udim materials” tool to merge materials, so udim tiles are preserved.

    As for 3d paint tools, they only care about textures, they do not care about materials. This is why they only look at single textures and/or udim sets. Then are udims and materials the same thing ? No they aren't. A single udim can be shared among different materials. For example we can multiply the same udim in the diffuse channel with different colors. The very same as we do with regular textures.

  16. engetudouiti

    Of course, I agree “Then are udims and materials the same thing ? No they aren't.” so your guide about 3d paint tools is what I said.

    why I thought if you hope to merge UV on same uv tile (actually it cause overwrap) , because you said

    “Anyway, with the actual “make udim materials” tool, I can create a udim including only the face, torso, arms and legs materials,”

    you said “I can create a udim which only include face, torso, arms, and legs, material” . so I supposed it means if you may locate those mat group poligons on same UDIM tile. If you not means so, I can not understand what you means ,create a udim.

    I suppose your word usage UDIM is somehow wrong .

    eg For example you say “we can multiply the same udim” I really do not know what you means mutliply same udim.

    and what you means, same udim in the diffuse channel?

    I suppose if you think UDIM is kind of one large texture (which not locate on 1 unit UV tile,, but which cover all UDIM tiles?

    Of course there may be case, if you make texture and locate so, but basic UDIM means it is way to manage multiple textues with UV which have multiple UV tiles ., Each UV tile off set from base UV tile is used for shader. so each texture need to represent each tile number.

    so we may say, UDIM UV or gathered UV (or basic UV , gathered UV, or non tiled UV) , but we may seldom say UDIM as texture.

    you often use UDIM as kind of new type texture, so it make difficult what you really plan and request for me. Though it is no problem, if Thomas clear understand what you hope.

  17. engetudouiti

    And if I guess you means, you plan to make Blender UDIM texture set for current blender 2.8 offer UDIM tools. then you hope to set it in daz importer shader generate texture nodes.

    But you may better, untill request it by add on script, , actually try to use blender UDIM tool and use it in add on shader node then show how it work. I do not think it is easy done by script.

  18. engetudouiti

    OK Alessandro I understand, with read all what you did with your pic of shader nodes.

    But still not clear, what you expect add on do. you hope add on auto set material and make UDIM texture set for all diffuse, metal roughness, bump etc,, with check each material shader node ?

    I understand, yes it may work as you expected.. mix use UDIM texture set, and original texture path for each material , but such material is easy understand for user?

    I may afraid, so when user try to change one diffuse texture for skin, if I keep to use the material slot,I need to overwrite all texture which include in texture set as same file name as before. or they need to re-assgin texture set with new exchange texture again, for each diffuse, roughness etc,

    I do not know, if it is actually imprement work-flow or not. I understand it may offer minimum material group . but it may only work well with current daz material which user used.

    I do not think such complex material group can use easy , then after all when I edit material, or bake material, it may show more complex issue I afraid. though I do not think it is bad ,if add on auto generate so. (if actually it work, when you full set material and texture set)

  19. Alessandro Padovani reporter

    I see we have to agree on terms. I’m sorry if it wasn’t clear.

    For one udim I mean a set of uv tiles each one referring to a texture map. This is usually made for a single channel, that may be diffuse or roughness etc. This way the udim merges all the related textures.

    Multiple udims are multiple texture sets. So we get diffuse udim + roughness udim etc.

    The main issue with the udim tool by Thomas is it confuses udims with materials. That’s why I call it a misconception rather than a bug. Thechnically it’s not a bug because it works as intended. But you can’t use it to convert textures to udims for the limitations explained above. We do not have to discard materials to get udims, this is not necessary nor useful nor desirable.

  20. engetudouiti

    I did not understand, what you mean merge UDIM , so it means, as texture, we need texture set, which only use same shader property,

    What I still do not test is,, (though now I understand it seems work), so you can set UDIM texture set, with only selected UDIM tiles?

    I simply believed, we need to make UDIM texture sets, by use all UDIM tile. so if there are 5 UV tiles we need to make one UDIM texture set (collection) with set 5 texture, if there is no texture for some UDIM tile, I supposed blender complain. but as your test, (from your pic) so it seems not cause issue.

    Did you try, make UDIM set texture for skin (set the UDIM tile for the part) , at same time set texture for eye around UDIM tile only? if it work, (so there is now 2 UDIM texture set which use diferent UDIM tiles + there are some non UDIM texture about some material) I simply surprised the blender way. (do not know other aprication how manage UDIM.

    I afraid, so with your test you can make texture set for skin, but if you add new texture set, for different parts, it may not work as you expected… (skin texture tile start from 1001, then blender may only count your assgined UV tile for skin but when you make another UDIM texture set (eg eyes mat) which use diferent tile , blender might complain? It is what I may need to confrim by myself,, I suppose.

  21. engetudouiti

    eg make UDIM texture set for face and torso (tile 1001 and 1002) then merge material as skinbody

    next make new UDIM texture set for leg and hand (tile 1003 and 1004) then merge this as one material. as skin limbs. then keep other mat as same as before, (so not make new UDIM texture set)

    could you confirm it work? I may test later,,

  22. Alessandro Padovani reporter

    For “merge” udims I mean merging the textures to make the udims. I agree it’s not much clear now that you point it out.

    As for udim having to be used on all the materials I agree with you. But with the tool by Thomas this is not possible without discarding materials, and getting bugs as the pink eyes above. And, as far as I understand, it is not possible to create multiple udim sets too. If I try the new udim set replaces the previous one, so I guess the tool is intended to create one single udim set. Not that creating multiple udim sets is my goal, or makes much sense in my opinion. Multiple sets make sense for multiple geometries, not for a single geometry. That is, we should have one udim set per geometry.

    So new definition: a udim set is a set of udims related to the same geometry, so diffuse udim + roughness udim etc. together in the same set.

  23. engetudouiti

    I may prefer udim is set of UV tiles and textures. with keep off set which start from (0, 1) UV space.

    Then if you can only generate one UDIM texture sets for your choosen tiles only, basically it seems not work as you expected. The daz UDIM tiles was happend to start from 1001 for skin part,then you need not jump and select different one, you may only select 1001, 1002, 1003, 1004, 1005 etc, then stop it. and make one UDIM set. so it seems happend to work. (blender only recoginize the 1001 to 1005 tile as one texture set. .

    eg if you happend to change UDIM tile, your selected part headstart as 1003, I suppose it may not work again. actually as usuall case,, blender may expect to set texures for all UV tiles (in current UDIM UV)

    and it should start from 1001. (so we only set 1001 texture path for the UDIM texture set, then blender auto assgin texure for your added UV tiles)

    I suppose if your way seems happend to avoid the issue. (so you can keep to use other mat without UDIM texture, without UDIM texture set, but point the texure path of the original)

  24. Alessandro Padovani reporter

    Yes, mine was a workaround to avoid merging different materials. As suggested by Thomas with “So if the lips and nails are colored and you want to keep that, just don’t include them in the list of materials to merge”. I agree with you this is not the way udims should work.

  25. engetudouiti

    I really did not test (with my thinking how blender UDIM texture set work) new UDIM options which add on offered so I may actually test it later anyway your test how manage without merge mat but use UDIM was interesting for me.

  26. Thomas Larsson repo owner

    I guess I could add a new tool called Make UDIM Textures that does what you want. Most of the code should already exist. But not now, because I want to make a stable release first.

  27. Alessandro Padovani reporter

    Thomas, honestly I believe what I want is how udims should work, and that the actual tool doesn’t make much sense, despite what others say. Anyway, I found a workaround to use the actual tool to get udims. May be this will also explain better what I’m looking for.

    steps

    1. Duplicate the mesh.
    2. On the duplicated mesh use “make udim materials”, selecting all the materials. This will create udims including all the tiles, that we want to. But will also discard all the materials but the first, that we don’t want to.
    3. On the original mesh replace all the textures with udims, so a diffuse texture will take the diffuse udim, a specular texture the specular udim and so on.

    Now we have a figure with udims and all the materials. What we miss is for the “merge materials” tool to deal with udims. I tried to use “merge materials” on the new materials with udims but it does nothing. It is needed for “merge materials” to merge materials having the same attributes and udims, the same as it does with regular textures.

  28. Log in to comment