Cannot use both merge systems at the same time for different grafts due to changing body geometry

Issue #1964 resolved
Calibrator created an issue

Hi, I was merging breastacular, then genitals. I wanted to merge breastacular the old way, permanently for easy sculpting and shapekeys which doesn’t seem possible with the geo nodes way. After merging Breastacular, diffeo shows an error when trying to merge other grafts, thinking they were changed because the body geometry was changed. Is it possible to fix this? Alternatively I wouldn’t mind a not terrible solution for shapekeys.

Comments (23)

  1. Calibrator reporter

    Yeah, I know that but I’m asking if it’s possible to avoid that problematic approach. It’s a bit crazy to make a shapekey around the graft areas with the current system.

    The necessary merge information is stored in the meshes when they are imported.

    Is this still relevant for the geometry node method?

  2. Thomas Larsson repo owner

    Merging geografts relies on vertex numbers, so as soon as you do something that changes vertex numbers (merge other geografts, delete a vertex), things will not work. I don’t use geometry nodes myself, but even if the original mesh is present, the first geonode modifier will change vertex numbers, so the inputs to the second geonode modifier will have incorrect vertex numbers.

    So no, I’m pretty sure that there is no way around this.

  3. Calibrator reporter

    Actually you’re wrong but you gave me exactly what I needed to figure this out. So here’s what I did. I merged the first graft with geo nodes (at this point it needs correct vertex count) then I disabled the geo node modifier (at this point it doesn’t actually edit the vertex count), then I did a normal merge, the old way, which changes the vertex count, but the geo nodes setup doesn’t care about the vertex count any more. I checked out your setup and that only happens before the geo node is created it seems. So now by doing it in reverse order I managed to do exactly what I wanted. And the best part is you can add more shapekeys or different grafts at any time. Although there’s 1 huge problem with your geonode implementation. You need to make it always create a new geo node group. It just hijacks an existing one if it’s there.

    So, TLDR: My specific solution was simple but I doubt you can implement it in diffeo, thanks for giving me the idea. What you can and should do is change how the geo node for the grafts is created, to make sure it always creates a new group any time you click on merge. Also do the same for the vertex groups. Make the vertex groups get a number. From what I see they aren’t automatically added to the geo node anyways on 1.7.3.1938 on blender 4.0.3.

  4. Calibrator reporter

    Sorry for double posting, im on phone now and this site barely works on pc…

    Anyways I wanted to edit the last comment: make sure that there's a new geo node AND modifier set every time merge is clicked. I forgot that important part. Lemme know if you need any info on how this process works inside blender.

  5. Thomas Larsson repo owner

    I’m glad to hear that your problem is solved, but it is not something that I’m interested in implementing in the plugin. As I wrote above, I don’t use geometry nodes myself and don’t fully understand what the code is doing. I don’t think vertex groups can fully replace the necessary info. This info involves the masked vertices that will be deleted, which can be represented by a vertex groups. But it also contains a list of vertex pairs that should be glued together.

  6. Calibrator reporter

    I don’t think you understand what I’m asking you to change because I went on a bit of an essay for my issue’s solution. Let me rephrase.
    https://diffeomorphic.blogspot.com/2022/05/geometry-nodes-and-geografts.html

    In this link there’s a picture of the modifier, this one

    In 1.7.3.1938 it always uses 1 geo node, 1 modifier and the same 2 vertex groups that are used in the geo node. I’m asking you to make it so every time the merge is done it adds a new geo node, the one where it says “Geografts Genesis Mesh” and add a .00x or something, add a new modifier which uses that geo node and lastly add new vertex groups instead of overwriting the old ones. If you do this there’s no downside to the average user and it’s a great help to psychopaths like me who use geo nodes on their models, because in the current setup if i have a completely unrelated geo node it will get replaced lol.

    So, what do you think? Overall I am insisting on this because the currently implementation is problematic in the event there’s an existing geo node setup on the model, it just so happens it’s useful for the idea I had at the same time. You don’t really need to implement anything new here, just modify the way these things are already set up to be added to the model.

  7. Alessandro Padovani

    Geonodes were implemented to explore the possibilities, but they lead to poor performances and unexpected issues, that’s why they stay experimental and not advised for production.

    If there’s nothing to add we can close as “wontfix”.

  8. Calibrator reporter

    Yeah there is something to add. Whats the performance problem like when you turn off the geo node modifier? You are then posing a default character so it's less of a performance impact than if you actually merge them the old way.

    You can also add morphs at any time. I don't understand why you would wanna ditch the system. The system is good, but everyone is treating it like an alien cause it's new

  9. GeneralProtectionFault

    So I dunno about performance, I don’t see a problem there, but Thomas already mentioned the issue of the vertex numbers being changed by the first geometry node.

    However, I’m curious if this is of use: https://docs.blender.org/manual/en/dev/editors/spreadsheet.html

    @Thomas this spreadsheet view Blender has seems to already be a handy table to view geometry data (including vertices). I tried merging geografts with the geometry node option, and at a quick glance, it appeared that switching the spreadsheet view between the “Original” and “Evaluated” had the information. Original is before any modifiers, so could that table be referenced for adding multiple geometry nodes?

  10. Calibrator reporter

    You may be on to something, I honestly have no idea, but also I completely gave up on that since they don't wanna work on the system. I just want them to slightly fix what's already there to not break existing geo nodes at this point.

  11. Thomas Larsson repo owner

    It was a long time ago since I had a look at the geonodes code, and as far as I can see it doesn’t seem to work even for a single geograft; all arguments of the geonodes modifier seem to always be 0.0. But it should be possible to name the vertex groups after the geografts rather than the main mesh, and thus have several geonodes modifiers with different groups.

  12. GeneralProtectionFault

    Yeah I’m just curious if that spreadsheet is the solution to the fundamental problem of having the vertex numbers. You do what you think is best, of course. I can tell you that not working for a single geograft is a Blender 4.0 change of some kind. It works in 3.6.

  13. Calibrator reporter

    Honestly that's gonna be the most important change for this current system. You can swap the geo node of the modifier manually without issues.

  14. Calibrator reporter

    Regarding the spreadsheet, you don't actually need it at all I think. All you need is to access the original mesh with the geo node modifier disabled.

    If you want to add a new geograft you do it over the original mesh. With that in mind you don't need to access the new vertex groups and you can always access the old ones with the modifier disabled. I think this should be fine

  15. GeneralProtectionFault

    @Thomas, so if you decide to work on the naming bit Calibrator asked for, just wanted to put a version(s) footnote.

    So like I mentioned, the single geograft not working/0 values is something between 3.6 & 4.0.

    However, 4.1 is basically “out” so I started playing with it a bit. In 4.1, it breaks completely. So just a note even if the idea is just maintain existing code, might be a good idea to look at both/latest Blender so you don’t have to look at it multiple times 😂

    Here’s the 4.1 error I got, just easy import, went straight to trying to merge geograft, selected geometry nodes (didn’t select new mesh), Diffeo 1.7.4.2051:

    File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\error.py", line 223, in execute
        self.run(context)
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 241, in run
        self.mergeGeografts(context, ncverts, cob, grafts[ncverts])
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 384, in mergeGeografts
        self.mergeWithGeoNodes(context, cob, anatomies, cgrafts)
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 524, in mergeWithGeoNodes
        mod.node_group = self.makeGeograftGroup(cob, tob, anatomies)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 548, in makeGeograftGroup
        group.addNodes(tob, anatomies)
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\geonodes.py", line 78, in addNodes
        self.links.new(self.inputs.outputs["Geograft Edge"], captureEdge.inputs[VALUE])
                                                             ~~~~~~~~~~~~~~~~~~^^^^^^^
    IndexError: bpy_prop_collection[index]: index 2 out of range, size 2
    Error: Python: Traceback (most recent call last):
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\error.py", line 223, in execute
        self.run(context)
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 241, in run
        self.mergeGeografts(context, ncverts, cob, grafts[ncverts])
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 384, in mergeGeografts
        self.mergeWithGeoNodes(context, cob, anatomies, cgrafts)
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 524, in mergeWithGeoNodes
        mod.node_group = self.makeGeograftGroup(cob, tob, anatomies)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\merge.py", line 548, in makeGeograftGroup
        group.addNodes(tob, anatomies)
      File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\import_daz\geonodes.py", line 78, in addNodes
        self.links.new(self.inputs.outputs["Geograft Edge"], captureEdge.inputs[VALUE])
                                                             ~~~~~~~~~~~~~~~~~~^^^^^^^
    IndexError: bpy_prop_collection[index]: index 2 out of range, size 2
    

  16. Thomas Larsson repo owner

    I think geometry node geografts work now. Tested in Blender 3.5 and 4.0, and geometry nodes are disabled in Blender 3.3 or before, Separate mask and edge vertex groups for different geografts. The armature modifer must for some reason come before the geonodes ones, because otherwise the main mesh doesn’t move.

  17. Calibrator reporter

    Hmm I had no errors. I used 4.0.3 to merge them I think. Yeah looking at the previous replies I used “1.7.3.1938 on blender 4.0.3.” then I opem the file in 4.1

    I do this cause converting rig in 1.7.3 and 4.1 crashes blender, i dont think i tried merging.

  18. Thomas Larsson repo owner

    A related bug has been fixed. Using geonodes for shells didn’t work, because the shell uv’s were deleted in a final clean-up step, because none of the base mesh materials were using them. Now any uv maps are kept if the global shell method is geonodes.

    I’m still using win 7 at home, so I cannot test 4.1 until the release is ready.

  19. Calibrator reporter

    I can test it for you ahead of time if you want, i have it installed. I gotta update to 1.7.4 at some point anyways.

  20. Alessandro Padovani

    If it helps, #1020 gets a full discussion on fixes and optimizations for geometry shells, including the uv bug. Not everything pointed in #1020 was implemented and we closed the discussion. This is just to avoid redoing the whole thing here, eventually.

  21. Log in to comment