2
$\begingroup$

I'm trying to split up objects into a certain number of parts, perform an operation on them, then join them back together again.

The reason for doing this is that on certain meshes doing this process all at once can be memory heavy and causes blender to crash or just use all the memory available. See my bug report along with test blend files https://projects.blender.org/blender/blender/issues/105652

Link to blend file in bug report working

Link to blend file in bug report not working

My thought process to work around this was:

  1. Split object into separate parts
    Using Separating an object with boolean intersection modifier generates extra vertices

Attached File:

  1. Perform operations on separate parts using it's Mesh island index ID.
    How can I perform an operation on each separate object using it's Mesh Island index?

Here's the blend file operations / link I'm trying to perform on each part. (Gets rid of all internal geometry) https://projects.blender.org/attachments/1df12be8-6e59-436a-91bb-cade1f3f9c2f

  1. Join object back together.

The final object should look like this with no internal geometry.

img1

$\endgroup$
4
  • $\begingroup$ Hello. You're talking about "take" or "operation", but which one? $\endgroup$
    – lemon
    Apr 30, 2023 at 15:59
  • $\begingroup$ @lemon I believe your referring to section 2) . It should be perform an operation. If this is not what your referring to please post the sentence that isn't clear. $\endgroup$
    – Rick T
    Apr 30, 2023 at 16:50
  • $\begingroup$ yes 2)... task (not "take")... so which operation? I mean apparently the cut works, so what after that? Or is it the operation of joining them back? $\endgroup$
    – lemon
    Apr 30, 2023 at 17:00
  • $\begingroup$ @lemon Sorry if it wasn't clear In step 2) I split the object into parts. How can I perform a operation on each separated part then join them back. The operation I'm trying to do on each part (see blend file link below) projects.blender.org/attachments/… I also updated the question above $\endgroup$
    – Rick T
    Apr 30, 2023 at 17:16

1 Answer 1

5
$\begingroup$

Consistency

First of all, Splitting an object and applying the process on multiple parts separately may change the outcome, which every Blender user eventually encounters when considering the order of Subdivision Surface and Mirror modifiers:

Therefore you need to understand the nature of the process; sometimes it just cannot be split, but in case of the Subdivision Surface modifier, it seems you need a margin of one face - if you're interested in any face on $-x$, you need to consider the leftmost face on $+x$ as well:

Memory and performance management

It's not obvious how Blender manages memory. If you create a temporary grid in Geometry Nodes, is it freed from memory as soon as it's no longer needed, or is an entire block of memory freed once the frame is rendered? In the latter case, splitting could actually increase the memory usage due to the margin, which effectively duplicated the geometry for split parts. This also increases the time required by CPU to process data. One possibility to deal with it, would be to evaluate one part, save it, and then, maybe even on a separate frame(s), render the other part(s).

Don't use boolean

As you noticed, boolean adds vertices. Not only does that inevitably modify the outcome, it's also terribly slow, and very expensive resource-wise - the exact opposite of what you want to do. Instead, use "Separate Geometry" or "Delete Geometry" to control which part of a mesh you're operating on. For example, you could read the frame number, let's call it n, and then do a bunch of divmods to get the coordinates:

  • $x = n \bmod 10$
  • $y = \left\lfloor{n\over10}\right\rfloor \bmod 10$
  • $z = \left\lfloor{n\over100}\right\rfloor$

This way you can get a coordinate for a cubic chunk of geometry to separate out of the entire mesh:

There are two layers on the below GIF, on the 2nd the monkeys look up:

Simple example

Let's take the Suzanne, split her into left and right part, add a margin*, evaluate those two parts in separate objects, and in the last, fourth object join the two parts together, getting rid of the margin:

*- You can mark the geometry to be separated, then store it as float on another domain, interpolating e.g. Face → Vertex, which makes each connected vertex take an average of all connected faces, meaning if a vertex is connected to a selected face, it's attribute will become higher than 0. Now similarly interpolating to faces again will do the same thing, assigning a non-zero value to all faces connected to non-zero vertices, effectively growing the selection to neighboring faces. Could use "Interpolate Domain" nodes instead, could be faster… I used "Capture" nodes here, because they create new states and allow to read the setup from left to right, which is easier.

Make sure every face (not counting margins) belongs to exactly one chunk, otherwise duplicated geometry can make a mess upon joining. At first I wanted to mark vertices on the good side of $x$, and spill this selection once, because a face could go across zero (it doesn't in case of Suzanne, but in many other cases it will), but this would mean faces going across zero would be present on both sides of intermediary objects. So instead I just discriminate based on face $x$, and a face going across zero will qualify to be only in one of the objects.

Result

Using the example, I don't see any difference whatsoever for flat shading, however there is a subtle difference for smooth shading, I don't know why. One direction to go from here is to analyze the vertex coordinates if they differ between the two objects in the "Final" collection.

$\endgroup$
2
  • $\begingroup$ What's especially interesting is, why the hell would the ear change? It's so far from the cut! $\endgroup$ Apr 30, 2023 at 17:49
  • 1
    $\begingroup$ Woow... !! + 1 ! Though, I still do not get the goal of all that!! $\endgroup$
    – lemon
    Apr 30, 2023 at 18:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .