Compile Blocks and Channel Expressions

   988   1   0
User Avatar
Member
19 posts
Joined: 12月 2019
Offline
Hi all!

I'm trying to get compile blocks to work for multithreading what should, in principle, be a really straightforward for loop to multithread. What I'm doing is taking a large mesh and using Clip SOPs to dice it up into 1-unit cubes.

To do this, I have a null block in front of the for loop that gets the bounding box of the input mesh and figures how the cube grid should get aligned and what the offsets are. Then, inside the for loop, I use the iteration detail attribute to set parameters on a null node, to figure out what the bounds should be for the current cube being processed. Then I use that node to drive how the clip planes should get positioned to slice out an individual cube from the mesh. It's a pretty naive implementation, it's not recursive, it just works out how many width/height/length blocks it needs and runs width x height x length iterations on it in a single for loop.

What I'm struggling with, is how to manage all of these expressions when I wrap a Compile Block around my loop. I've added a Spare Input to deal with grabbing the detail attribute from the metadata node, and I believe in principle channel expressions should work as is with a compile block? However, I get errors of the type:


Error
Invalid use of spare input #0 on compiled node: /obj/geo1/subsector_divide/subsector. Input either not provided, or executed out of order (likely due to ch() in /obj/geo1/subsector_divide/subsector/subsector_minz).
Error
Invalid use of spare input #0 on compiled node: /obj/geo1/subsector_divide/subsector. Input either not provided, or executed out of order (likely due to ch() in /obj/geo1/subsector_divide/subsector/subsector_minz).

Which I'm not sure what to do about.

FWIW we're currently on 18.0.597 so if there are any 18.5 improvements to handling compile blocks, we haven't got them yet. Test scene attached!

Appreciate any insight into how this could be improved.

Attachments:
slicer_compiled.hiplc (402.5 KB)

User Avatar
Member
19 posts
Joined: 12月 2019
Offline
Well, I got it to work in the end by using detail attributes instead of channel expressions, but I don't really understand while the channel expressions didn't work. This approach seems kind of unnecessarily clunky, particularly in how many spare inputs have to be created on all the nodes, when a channel expression would work better. If it's of use to anyone, I've attached the 'working' version of this scene.

But if anyone has any better insight, please do share it!

Attachments:
slicer_compiled.hiplc (425.0 KB)

  • Quick Links