Use the Multiresolution modifier for HD details

Issue #53 resolved
Brad Goodfellow created an issue

You can use the Multiresolution modifier to subdivide a mesh and then copy the vertex coordinates from another mesh (Reshape button). I tried this with a base resolution Genesis 8 mesh subdivided 3 times and a HD subdivision level 3 mesh exported from Daz Studio but unfortunately only a few of the vertices matched and the mesh turned into a mess.

Comments (30)

  1. Alessandro Padovani

    @Brad You have to use shrinkwrap first to match the vertices.

    https://www.youtube.com/watch?v=MU7EQjauKNo

    https://www.youtube.com/watch?v=1CiQxc1QvRM

    Personally I'm not a big fan of HD characters because they are too heavy for animation. Also I fear it's not possible to import HD morphs because they are not documented and only available to PAs.

    Nevertheless I agree some basic support for HD, such as importing the base HD shape as suggested above, would be nice to have. This would allow at least for still pictures of HD characters in blender. It is also true that doing this by hand is not a big deal so if this is too complex for the plugin to implement it may be not worth it.

    edit. Also may be there could be issues with geografts since they would probably need to be merged before applying the multires.

  2. Thomas Larsson repo owner

    Without having looked much into the HD morphs, my spontaneous feeling is that they should be converted to normal maps somehow. So you can have high detail but the mesh is not denser and can be smoothed after posing. Too bad Daz didn’t provide normal maps instead.

  3. Brad Goodfellow reporter

    You can bake HD details into normal maps but the way is tedious and finicky (as far as I know), and requires manually fixing the seams since the meshes need to be separated so the UVs don’t overlap.

  4. Alessandro Padovani

    I fully agree about using normal maps instead of hd details. Indeed it is also possible to export the hd geometry to obj and convert it to a normal map or a displacement map for real bumps. I’d like to stress here that this only works for the base hd shape though. The hd morphs are morphs on the hd shape and I don’t know any method to export them.

    https://www.youtube.com/watch?v=f1fynKtys-Y

    Exporting the hd mesh to a multires is another thing and it mimics daz studio more closely. Then I understand it may be not worth it if it is too much of a work for the plugin, since doing it by hand is not too difficult anyway.

    edit. @Brad in blender you can create a new uv map for the hd baking. You don’t need to use the daz maps.

  5. Alessandro Padovani

    The first test with commit 56f7ba7 is exciting. Below there's a comparison of the Mutation Morphs HD for G8F by JoLab, first iray then cycles.

    https://www.daz3d.com/mutation-morphs-hd-for-genesis-8-female

    The good side is that materials are preserved in the HD mesh. That doesn't happen with a obj export of course. So the plugin allows us to render the daz HD mesh with cycles that's super cool.

    A little issue is that the rig doesn't follow the pose of the character. Exporting a posed character can be useful for prebending especially when baking HD where we don't have the HD jcms. Plus since for non-HD characters the rig is posed it would be consistent behaviour to pose it for HD too.

    Then the less good side is:

    1) The HD geometry can't be used as is for multires because the vertices don't follow the same order. We can use shrinkwrap to fit it but first we have to split separated meshes such as eyes and teeth. And depending on the HD shape we could have different degrees of success since shrinkwrap is not perfect anyway.

    2) Same for baking displacement or normal maps, we need to split separated meshes first.

    Then the above two points are true for obj exports as well so I believe what we get here is much better anyway.

    3) The dbz exporter is very slow compared to obj, so we have to wait a bit. But this is expected since it's exported via script.

    Scene included.

  6. Thomas Larsson repo owner

    This is a first step towards HD meshes. Not sure what will come out of it eventually. Some comments.

    That the rig pose is lost is a bug. Previously it was baked into the rest pose, and is so again with the latest commit.

    I could create a multires modifier from python, but I don’t know how to access the individual vertices. But even if I could, using multires is probably not feasible, since Blender and DS use different subdiv algorithms by default. Unless the subdivided vertices are ordered in the exact same order, one cannot copy the locations, so there is no simple way to transfer the information to the multires modifier.

    That said, it should be possible to bake normal maps effectively. The reason is that this is a local problem; each face in the original mesh corresponds to a few (typically four) faces in the subdivided mesh, and they cover the same area in UV space. For each face, it should be possible to compute the offset for each point (pixel) in UV space with linear interpolation. But that is something that requires interpolation.

  7. Alessandro Padovani

    Commit 7c5b34d fixes the posed armature thank you Thomas for the quick fix !

    As for multires yes that's the issue. I fear there's no way to fit the blender subdivision. That would require to reorder the vertices by following the topology that sounds very complex to me.

  8. Alessandro Padovani

    There’s also an interesting discussion at the daz forum about making an alembic importer compatible with the diffeomorphic plugin. The work is in progress by TheMysteryIsThePoint and will be useful to import hd animations in blender.

    Also in the same discussion there’s Jessub Kim “JClave” who has in progress the special cycles build in #7 to render the uber shader.

    https://www.daz3d.com/forums/discussion/298831/

  9. Mike

    I’ve been using this method alot recently and it works like a charm! With the most recent version of blender, even the transfer vertices script isn’t neccessary anymore 🙂

  10. Zack Johnson

    I am impressed that you guys have been able to figure this out… I haven’t tried it yet - but I have a question. If I were to use this method, theoretically I would be able to keep the multires modifier hidden until final render, upon which I can enable it and render an animation with the full HD mesh, correct? If that’s the case I have to try this. I recently realized how much detail is lost without HD on some of my more muscular models. It would be great to be able to get that detail back. Baking normal maps only does so much.

  11. Mike

    Yes, that’s correct!
    As it’s a modifier you can enable it for rendering only.
    That makes it possible to work with the low res model with great performance and render everything out in superior quality!

  12. Alessandro Padovani

    Yes that’s what multires is for. Personally I have some doubts about rebuild subdivisions since different HD meshes may derive from the same base mesh so I don’t understand entirely if the generated base mesh is always the same. May be this works best when HD is used for fine details.

    In any case the workflow by jcade is interesting because it doesn’t require manual operations by the user, so it should be possible to automate it.

    edit. About my doubts. As I understand it, to correctly transfer maps from the original base mesh to the derived base mesh, the HD morph should be applied to the original base mesh. Since this is done with dbz then I guess the workflow by jcade should work fine for the general case. AKA the derived base mesh is not always the same but we’re fine with it.

  13. Thomas Larsson repo owner

    It appears that Rebuild Subdivisions creates a base mesh that has the same vertex order as the original mesh at base resolution. That is marvellous, because it means that no vertex reordering is necessary.

  14. Alessandro Padovani

    As for commit d734b1c it seems to work great. Below a comparison of the muta HD character, first iray then cycles.

    I feel we have a milestone here.

  15. Alessandro Padovani

    Thomas, there’s a clever idea from Krampus at the daz forum about geografts. Basically you save the HD character without geografts then append the geograft from the base resolution version and it works fine just like that. There’s one minor caveat that you have to pay attention to first merge the geograft then merge the armatures. I tried with futalicious on the muta HD character and it works fine here.

    I don’t know if this may help to fix something, or we can just explain this workflow in the user docs.

    1. Export the base resolution character with geografts, import in blender and save.
    2. Export the HD character without geografts, import in blender and save.
    3. In blender load the HD character and append the geograft from the base resolution, then parent the geograft to the HD character, then merge the geograft, then merge the armatures.

    Please Thomas let us now what you think about this.

    https://www.daz3d.com/forums/discussion/comment/5999337/#Comment_5999337

  16. Thomas Larsson repo owner

    Yes, this seems to work. Actually, you don’t to save the blend files. Here is a slight variation:

    1. Import the HD character without geografts. Two collections are created, delete the one at base resolution.
    2. Import the base resolution character. Another collection is created.
    3. Merge the geografts from the last collection with the HD mesh in step 1.
    4. Delete the last collection.

    This works because the HD mesh with its multires modifier has the same topology as the original mesh, so you can do the same things with it (merge geografts, load JCMs, etc.)

  17. Thomas Larsson repo owner

    I don’t think this workflow can be automated, since it requires two separate files from DS, so I need to write something about it.

  18. Alessandro Padovani

    I was hoping that the HD exporter could export the base mesh, then “unparent” aka “unfit” the geografts, then export the HD mesh without geografts. Then the HD importer could also copy the geografts to the HD figure.

    If this is possible then the user would just have to merge geografts as usual. Also in this case an option to avoid importing the base mesh would be useful, since we only need it to bake normal maps and it is not needed for multires.

    If this is not possible or too much complex to implement then manual work from the user is just fine I guess. We do have a great tool anyway. Please note that geografts may be rigged so in step 3 you also need to parent the geograft armature to the HD figure.

  19. Alessandro Padovani

    As for the daz api there’s TheMysteryIsThePoint at the daz forum who’s developing an alembic exporter compatible with diffeo. Would you mind if we ask him for a c++ version of the HD exporter ? This will speed up things a lot.

  20. Alessandro Padovani

    Also, since the HD workflow may require to get the base mesh anyway, then we may have the HD exporter to export only the HD version and the base exporter to export only the base version. This would make sense also for the case where the user doesn’t need to bake normal maps and/or to use geografts.

  21. Thomas Larsson repo owner

    Alessandro, at this time the LD version is needed, because the import script copies things like materials and uv map names from the LD mesh to the HD mesh. That could done differently, but that would require rewriting some code on the import side, which I don’t want to do right now.

    I wouldn’t worry so much about that the extra LD mesh uses up resources. As the table at the bottom of http://diffeomorphic.blogspot.com/2020/09/high-resolution-meshes.html shows, the LD mesh is very small compared to the HD mesh, especially at high subdivision levels. Asymptotically both export time and file size seem to grow quadratically with subd level, which makes sense since the number of vertices quadruples and most time is probably spent on disk access.

  22. Thomas Larsson repo owner

    TheMysteryIsThePoint is the guy with this thread, right. If somebody wants to develop a C++ version of the exporters, then yes please, I would appreciate that. It shouldn’t be terribly hard, because the code is rather short and the same API is available in both languages, I think.

  23. Log in to comment