Non destructive way to import HD morph (can not use "Reshape" after set up?)

Issue #198 resolved
engetudouiti created an issue

Though I do not know if I miss something, but Thomas did you check or pray the “reshape” function in “shape” tab of multiresolution modifier?

Because I suppose your dbz (HD option) may generate all vertex as already sub-D applied, then may try to “Unsbudivide” to

get base.

But if you use “shape”>> “reshape” it can only change current multiresolution level directly. (as if import morph as shape key)

(you can think it as new shape key with the sub-D level, so it seems more like Daz HD morph, though we can not use it as shape key for base)

What I means, just import HD morphs applied shape (it is exported as dbz (HD) I suppose) then use the mesh for “reshape” target, it add new shape for the current resolution level. (but base 0 keep as same as before)

Then I suppose you do not need to use “Unsubidivide” at all.

Though I do not know all step of your scirpt , but maybe it can be useful for grafted item too.

key concept is, after set-up all (import morph etc) with base, then we may merge, after that, additionaly add multiresolution, and import sub-d HD morphed mesh and use it as “reshape” target.

(select current mesh with apply multiresolution modifier, and set level as same as daz studio. then select” target” (which should be imported by dbz (HD) temporally, then click “Reshape” it may offer non-destructive HD shape.

If your script already use the “Reshape” then generate sub-D (multiresolution) mesh, ignore this please ^^;

Comments (36)

  1. engetudouiti reporter

    What I think is, like these pic.

    as you can see, base keep clean .

    but Only when I set multireso as 1 ,2, 3, it return sculpt shape. (so non destructive)

    Then I can still mix use sub-D (only for smooth without HD) = usuall base + sub-D modifier.

  2. Alessandro Padovani

    I don’t know if something is changed and I’m going to test it. But the reason why we didn’t use reshape before is because the imported HD didn’t have the same vertex order so it wasn’t possible to reshape it from the multires base mesh. We had to use a shrinkwrap that is an approximation and doesn’t work fine with unconnected meshes such as eyes and teeth. Now this was it in blender 2.8. While rebuild subdivisions in 2.9 of course doesn’t have this issue.

    Then if we may use the original daz base mesh with a reshape target it is better than rebuild subdivision. Because rebuild subdivision doesn’t rebuild the original base mesh but its own version, as explained in #191.

  3. engetudouiti reporter

    I see (I suppose if it not work for merged mesh), Then if merged and exported mesh will cause different vertex order from which we merged in blender.

    I may recommend, not merge unitll import HD morphs with reshape.

    It can be done by use geometry editor option. I suggested Thomas.

    ( if use geometry editor, active> export, it will not export, merged mesh, but may generate each sub-D mesh as each sub-D level separately.. )

    But it have pro and con. some user may not like ,attached part slightly moved with Geometry editor active.

  4. Alessandro Padovani

    The vertex order issue was there always. Even for a base G8F with no geografts, it was not an issue related to merging. Now if something is changed in blender 2.9 and/or in the HD exporter and this issue is no more that’s great. We have to test it in 2.8 and 2.9.

  5. engetudouiti reporter

    Or if apply sub-D in daz will show different vertex order from mesh multiresolution modifier in blender?

  6. engetudouiti reporter

    So we can transfer current shape between mesh which do not have same vertex count,

    with “Data transfer” without use shirnk wrap ( so we can transfer morphs between mesh to clothing)

    Did not it work to transfer shape from DAZ sub-d (level3) exported mesh to Blender multi (level3) applied mesh? if it can transfer,, I suppose we can use it as source of reshape.

  7. engetudouiti reporter
    1. import HD applied level 3 base mesh. (source A)
    2. import HD applied level3 with HD morphed mesh , then use the shape as new shape key for source A
    3. in blender, for base mesh, set mutiresolution level3, then applied. (target )
    4. transfer shape key from source A to target. then apply shape key

    If if work for inner part mesh too,, I suppose we can use re-shape. (but maybe not work for inner divided mesh etc?)

  8. Alessandro Padovani

    Using data transfer always produces an approximation unless we can use the topology option. And again topology only works if there’s the same vertex order. That’s why rebuild subdivisions was a game changer in 2.9 because it preserves the exact daz HD mesh, though it doesn’t preserve the daz base mesh.

    If the vertex order is the same then we can use reshape as you suggested. That will preserve both the daz base mesh and the daz HD mesh. I need some time to test it.

  9. Thomas Larsson repo owner

    Would it help if you could import the HD mesh without adding multires? Then vertex numbers would definitely be the same as in DS, and you should be able to import HD morphs, provided that the subd level is right. Multires can be added by hand afterwards.

  10. engetudouiti reporter

    if vertex order is problem, it may not work? (I did not suppose, it cause different vertex order,

    daz sub-D applied and blender mult-res applied.,

    but I think maybe it not same. Because I try almost same thing with another sculpt aprication sub-D, mesh then it not worked. at current I only suceed when I use source which add mult-resolution sub-D in blender though I am not heavy HD user,, then do not take mach time for this ^^;

  11. engetudouiti reporter

    I have some idea and hope to test, then keep this temporally (not much expect anymore ^^;)

  12. Alessandro Padovani

    Thomas, engetudouiti, I did a simple test with a subdivided cube where I applied the subdivision, then made a shape key, then applied multires and rebuild subdivisions. This deleted the shape key I created. Same with unsubdivide. So it seems it is not possible to use multires on a mesh with shapekeys.

    Still need time to test reshape I’ll let you know.

    edit. Also I believe we have to distinguish between HD shapes vs HD morphs. We may be able to import HD shapes I don’t know it yet. But HD morphs in daz studio can be driven with expressions the same as regular morphs, for example to create HD wrinkles when the eyes close. That’s just another feature we don’t have in blender at this time.

    edit. It seems confirmed that the actual implementation of multires doesn’t allow HD shapekeys. It is listed as a possible next feature though.

    https://developer.blender.org/T78898

    https://developer.blender.org/T73047

  13. engetudouiti reporter

    hmm,,, Yes I know multireso does not allow shape keys. so we can only one shape as high reso level.

    And yes DAZ hd shape = daz high reso mesh + HD morphs delta (which include sub-Divided verts)

  14. engetudouiti reporter

    I test,, blender sub-D level 3 applied and blender multi reso level 3 applied

    they keep same vertex order.

    but when import daz sub-D level 3 as obj, it seems change vertex order.

    I test with legacy ( catmull-clark sub-D ) in daz studio too. it is blender sub-D way

    but it still not keep vertex order when export.

    So as future, even though we get multireso shape keys, we can not import them .

    But I almost confrim, daz do not change way for their exporter.

    (I do not know if DAZ official blender plug-in, will offer HD reso shape (with HD morph applied)

    with special exporter (it may keep vertex order)

  15. Alessandro Padovani

    Yes that for sure. But I was hoping that reshape may work so to preserve both the HD mesh and the base mesh. Unfortunately in my test it seems reshape doesn’t work, since it scrambles the vertex order as expected. So we have to use rebuild subd. Tested with blender 2.9 and diffeo eafad55. What I did:

    1. export the HD figure, so we get both the base mesh and the HD multires in blender
    2. apply the multires to the imported HD figure so to get the HD mesh
    3. add a multires to the base mesh and subdivide
    4. reshape from HD mesh to multires base mesh

  16. engetudouiti reporter

    Allesandro

    I think, current 2.91 (I build all day) , can keep shape keys, when I set multireso modifier.

    Now I have character mesh with many shape key(custom include) , then I add multireso modifier

    (as new modifier) and sub-D 2 times (with multireso). then sculpt with the level. it keep all shape keys

    with driver as same as before. (eg breast height morph shape keys (not bone controller)

    Though I do not know, if there is difference with your test.. or if it may lost when I save scene?

    if it is version problem, at least recent 2.91 beta may work already.

    I see, so you use “rebuild” again? (I did not know why you need to rebuild, but for test I understand)

  17. Alessandro Padovani

    @engetudouiti Yes 2.91 is interesting because it adds sculpting capabilities to the base mesh in multires mode. This has nothing to do with HD shapekeys and/or reshape though.

    I mean, of course you can add a multires then subdivide and the base mesh shape keys are preserved. Then of course you can sculpt, this is what multires is for. But if you rebuild subdivisions then the shape keys are deleted. That is, in 2.91 you can't add HD shapekeys, the same as 2.90. Also in 2.91 reshape doesn't work because of the vertex order, the same as 2.90. So there’s nothing new as for HD morphs.

    Unless I miss something.

    https://wiki.blender.org/wiki/Reference/Release_Notes/2.91/Sculpt
    https://developer.blender.org/rB976f0113e00

  18. Alessandro Padovani

    Thomas, I see you added a comment in commit 9aa8e5c to use HD morphs ? How is this supposed to work ? The HD morphs will be deleted the moment you add the multires modifier and rebuild subdivisions.

    Or do you mean to use a rigged HD mesh without multires ? In this case will the base mesh shapekeys and weighmaps transfer correctly to the HD mesh ?

  19. engetudouiti reporter

    I have same question as Alessandro about the commits. After Thomas reply workflow,

    I may test again (at current I do not think it work to import real HD morphed shape) or afraid it will corrupt morph system.

  20. engetudouiti reporter

    The main problem is,, base mesh keep same vertex order in blender and daz studio.

    but after sub-D (or add multiresolution), they show different vertex order with the current sub-D level.

    So to work it we need to copy vertex order from

    A high-resolution shape (daz) (sub-D 3times + HD morphed) which exported to blender

    B high-resolution mesh (blender) (multireso level 3 or applied once)

    But A already include all delta of HD morphs. so transfer vertex weight, may not work well (without both mesh keep almost same verts postion)

    what I suposed (if it work or not)

    we may import

    C high-resolution shape(daz) without HD morph effect first.

    Then use trasnfer modifier to get same vertex order to B. (but it may need to apply multireso and remove from modifier stack once, or it can transfer to multiresolution level 3 mesh, without remove the modifier? (if it work so,, I suppose we can return base mesh (but it may change base resolution vertex order ,this time by blender way. though I do not know it effect to import morph etc,,basically it can not import morph any-more I suppose,, so after import shape keys, may try the workflow?)

    Anyway,, after see Thomas recommend work flow, I try . (it is good training for me to learn how multireso work) tahnks.

  21. Alessandro Padovani

    @engetudouiti We do have the way to fix the vertex order of the HD mesh. There’s a plugin for that but it requires manual selection of polygons by the user, so it’s not possible to automate it. Plus disconnected meshes as eyes and teeth need to be treated separately.

    The rebuild subdivisions method is good because it can be automated without user actions.

    https://gumroad.com/l/copy_verts_ids

  22. engetudouiti reporter

    Thanks I may try it later.. I need not auto-mate way, if it can work. (actually I do not hope everything auto-mate). but may hope to keep non-destructive original base .(non auto smoothed . not shrink) to import morph later. (or it may show different shape, when we import another morphs as delta I suppose)

    Then I have some idea how transfer disconnected meshes vertex number with blender transfer data modifier. (so I think it is almost same work flow)

    I sometimes test, divide mesh with each vertex group as separate obj. then re-connect again, basially blender keep all vertex order as same as before. (it suprised me). I have seen same thing when I divide mesh for bake, in another aprication. they can be keep vertex order after I merge them. (though I do not know how it can be still) So I may try the workflow if it work well to transfer verts order.

  23. engetudouiti reporter

    Hehe I seems find almost perfect way to keep clean base mesh shape with re-subidivide.,😎

    I do not know why I could not find way.. it seems simple. so if Thomas new commit say same thing.?

    Yes we can re-sub-divide. then generate new smooth base mesh. the problem is it not keep default base.(slightly but shrink or smoothed )

    If multierso modifier still for give me, after re-sub-divide, import shape key for base resolution.

    we just need to keep default base mesh. then import it as new shape key, apply it as new base.

    it is all. (so now base shape = perfect same shape.)

    Then if it change sub-D level shape, (which we improted before), we do same logic, but this time use "Reshape" . though I do not think, even though we apply new shape key as base shape, it may change level 3 shape of multireso (it seems vert infomation save as differently, so it not effect how base change I suppose. though did not test it yet)

    ====

    after finish these work,(include re-subdivide process) , we may start import morphs , so it may not corrupt .

    re-subdivide only remove morph which already imported. so I believe, after re-subidvide we can import new morph as I like. I miss something? 😎

  24. Thomas Larsson repo owner

    Alessandro, yes, the morphs are deleted when you rebuild subdivs. So you can have HD morphs but no multires and no posing, or posing and no HD morphs. This is admittedly not very useful, but may become so if Blender improves. Multires is on by default and the option to turn it off is not very visible in the global settings, so it should not hurt, I think.

  25. Alessandro Padovani

    Thomas, ok it is clear now thank you for the explanation.

    Engetudouiti, the idea to apply the original base mesh as morph to the multires base mesh is brilliant. We have to test if this doesn’t change the HD shape. If it works we can preserve both the base mesh and the HD mesh. Your procedure seems a bit overcomplicated though I’d do as follows:

    1. import HD so to have both the base mesh and the HD multires.
    2. apply the base mesh as morph to the HD multires.

    I don’t have time to test it right now but hope it works. Will confirm later.

    edit. No the above procedure can’t work it will affect the HD shape too of course. Will study your procedure better.

  26. engetudouiti reporter

    If chage base shape affect HD shape, it may not matter, just need one more step untill change base shape. because we can keep current HD shape level3 , after change base shape, can re-use it as Reshape souce.

    The problem why I may need to import HD mesh without HD morphed, only the shape can show perfectly same shape when we re-build and return as zero base. or HD morph include delta for base mesh too. (my assamption)

    But the problem seems occur, when I import new shape key. (even though 2 mesh keep same vertex order, join as new shape failed around eye. so I need to mask it ^^;

    now I finish step 3. but even though it work, I do not recommend anyone. to be frankly said, overwroking just return base shape.

    Then if imported subdivided shape already change vertex order, in 2 aprication, after all, after un-subidivide (return base resolution) in blender, should change vertex order from original base shape.

    iI suppose. so we may need all step. I think. but if it change vertex order from original base after re-subidivide, I do not know if it can still improt morph etc.. Have someone already test usuall procedure,

    (use re-subidivide) ? can you import morph ?

  27. engetudouiti reporter

    Wao it actually suceed.

    As alessandro said, there was one miss understanding. actually I need not remove HD morph and re-import.

    when I export as HDmesh, it generate 2 mesh . 1 is base resolution. (non re-subdivided)

    second is re-subdivided + multiresolution (include HD morph delta )

    Only you need to make new group which may not correctly transfer shape keys (eye mesh)

    then use it to limit shape keys after import as shape keys. the process need some step.

    (so you may only assgin group which need to change then remove eye meshes)

    I may clean up my procedure. and discribe again.

    as I said, when you import (change) base mesh , it effect level 3 HD shape. so you need to use re-shape for level 3 shape. (I already test it, reshape work without problem)

  28. engetudouiti reporter

    Oh my god!!! it seems more simple.

    I can not believe why after import HD mesh and re-subD mesh can keep same vertex order as original base mesh at all,,, but actually it seems keep same vertex order. OK do not need so many step at all.

    1. duplicate improted multireso lev3 mesh , then apply lev3, keep it for later use (higheso mesh)
    2. duplicate base mesh (set sub-D modifier, as 0) then name it as “clean base” remove modifier etc.
    3. select HD multireso mesh , set multreso level as 0. (though I do not know if it need not, just to keep stable)
    4. select clean base, then select HD multireso mesh, join as new shape. it make clean shape key like a charm
    5. you can apply the shape key as new base.. if it effect lev3 HD shape, use “reshape” by set “higheso” as reshape source
    6. it is all. I feel…

    Yes we need to re-use saved “high reso mesh” as reshape source again. it perfectly return lev3 shape but not change base shape. unitll you use apply base etc.. (it change base reso mesh to follow high reso shape, so do not use it)

    So finally we can import HD mesh but keep base as same as before (almost perfect)

  29. engetudouiti reporter

    I discribe all step, it should work to rertun real base shape. if join new shape corrupt some inner mesh, try limit shape key by vertex group (make vertex group which not include problem part verts) assgin it in the shape key.

    Thanks alessandro and Thomas. I may test with grafted item, same procedure may work or not..

  30. engetudouiti reporter

    Then I suppose now I could finish this topic.

    But at same time, I still do not know, why reverse sub-divided mesh can keep default mesh, verts order, on the other hand, if I apply sub-D multi for base mesh, (sub divide 3 times) it change vertex order from DAZ imported HD level 3 mesh.

    If we can remove level 2 , level 3 infomation, (for usuall animation), then only when we need,, sub-divide with multiresolution again, and can re-shape HD mesh (saved in blender library) as reshape source,, it seems real perfect.

    it seems happen for all mesh in blender, I suppose we can request it to blender side.

    (because,, it means, mesh will change vertex order, after re-subdivide, remove high resolution, sub-divide again, it is not expected. but I can confrim it with monkey test, (not use daz importer)

    Though if blender change current way with report, and it cause break current way( import Daz HD and re-subD ) it is night mare.. (then I may not request)

  31. Alessandro Padovani

    @engetudouiti This seems to work great. I managed to make just three steps since copying the base mesh and setting multires to zero is not necessary. I believe this improves the current HD method since this way we preserve both the base mesh and the HD mesh. Also the base mesh morphs should be better this way because they refer to the original base mesh.

    1. Make a copy of the HD mesh, this is our "original HD".
    2. Join as shapekey the base mesh to the HD mesh then make this shapekey as basis. This will restore the original base mesh but will “inflate” the HD mesh.
    3. Reshape the "original HD" to the HD mesh. This will restore the original HD mesh.

    Personally I’d feel the need to test this better before asking Thomas to eventually replace the actual HD method. Especially in relation to the base mesh morphs. But so far seems really good.

    edit. I’ve not much time because these days we’re organizing a movie with a theatre group. Plus I got house renovations to do. Just to say if I’m late it’s not that I’m lazy or don’t appreciate your work on this. You’re great.

  32. Alessandro Padovani

    @engetudouiti It seems we’re very lucky and the HD figures in daz studio use the same subdivision method as the multires modifier in blender. That is, we don’t need to fix the base mesh. Please see #191.

    The base mesh issue still applies if we export a subdivided figure to HD. But this is not a real case since a subdivided figure will be exported as subdivided, not as HD.

  33. Log in to comment