mrWolf Posted August 30, 2014 Share Posted August 30, 2014 (edited) Is there any way to hack to forEach sop in order NOT to collect (or reuse) the resulting geometry after each loop, and just iterating through all the primitives instead? As far as I understood the two modes for the forEach node are: - use the output of the previous iteration ("merge results" unchecked) - process each piece and merge them all together in the end ("merge results" checked) What is missing is .. - process each piece, without merging pieces together Scenario: I have a big Volume that I am building procedurally. This volume is too big to fit in memory at once, and since I know it's dimensions and occupancy, I splitted it's bouding box in smaller bounding boxes so I can generate each piece of the volume separately, store it on disk (with indices and a corrensponding point cloud per frame) and then reload it with an Instance at render time. The whole thing works great so far. I'm generating each piece using a forLoop. In the foor loop I write out each piece on disk , per frame, and it works great. So in the end on disk i have something like "pieceX.Y.bgeo" (where X is the bbox number, and Y is the frame). The problem is that in the end o the for loop, Houdini retains all the volumes and merge them together anyways (bringing me back to the initial problem of having it all in memory) ! So my purpose of keeping in memory only the piece I am creating per time, storing it to disk, and then move to the next, is defeated. I am probably missing a very simple solution. All I've to do is iterate through each primitive, process it, store the result, throw it away and move to the next , and all of this per frame. Any idea ? Edited August 30, 2014 by mrWolf Quote Link to comment Share on other sites More sharing options...
mrWolf Posted August 30, 2014 Author Share Posted August 30, 2014 One microsecond after I pressed "post", I realized the solution is to simply add a "delete" sop after the file write node in the forEach. (I need a vacation ) Quote Link to comment Share on other sites More sharing options...
danw Posted August 31, 2014 Share Posted August 31, 2014 Out of interest, how do you write geometry out to disk from inside a foreach loop? I was trying to do something similar the other day, but I couldn't work out how to have it "Render" on demand once per iteration, rather than needing to click on Render manually. Quote Link to comment Share on other sites More sharing options...
mrWolf Posted August 31, 2014 Author Share Posted August 31, 2014 I used a file sop (in write mode) inside the loop to export each piece separately, and a rop_geometry outside the loop, to advance the frame (writing a dummy bgeo somewhere). 1 Quote Link to comment Share on other sites More sharing options...
danw Posted August 31, 2014 Share Posted August 31, 2014 Huh. All this time and I never realised the File SOP could write files automatically. Cheers! :-) Quote Link to comment Share on other sites More sharing options...
wateryfield Posted September 7, 2014 Share Posted September 7, 2014 I used a file sop (in write mode) inside the loop to export each piece separately, and a rop_geometry outside the loop, to advance the frame (writing a dummy bgeo somewhere). How can i write the bgeo separately by the ropnet, not by the file sop in foreach. That way use ropnet i can just write one bgeo. If have any time take a look with my HIP. Thanks! file_write_separately.hip Quote Link to comment Share on other sites More sharing options...
mrWolf Posted September 7, 2014 Author Share Posted September 7, 2014 How can i write the bgeo separately by the ropnet, not by the file sop in foreach. That way use ropnet i can just write one bgeo. If have any time take a look with my HIP. Thanks! You can attach a rop_geometry outside the forEach, like I said before, and then execute it from a ropnet context using a "fetch" rop node. Check the hip file attached: This is what i did in your hip file: 1 - enable the file write inside the forEach 2 - attach a rop_geometry outside the forloop (and set a frame range) 3 - create a fetch node in the ropnet1 and pointed it to (2) This way you can execute your export per object / per frame , from rop context file_write_separately_fetchSolution.hip Quote Link to comment Share on other sites More sharing options...
wateryfield Posted September 8, 2014 Share Posted September 8, 2014 You can attach a rop_geometry outside the forEach, like I said before, and then execute it from a ropnet context using a "fetch" rop node. Check the hip file attached: This is what i did in your hip file: 1 - enable the file write inside the forEach 2 - attach a rop_geometry outside the forloop (and set a frame range) 3 - create a fetch node in the ropnet1 and pointed it to (2) This way you can execute your export per object / per frame , from rop context Thanks for your reply. Alessandro. But after i execute render of the fetch, i still just get one file. Is the rop_geometry output file name must be variable. Thanks. Quote Link to comment Share on other sites More sharing options...
mrWolf Posted September 8, 2014 Author Share Posted September 8, 2014 Hi Wateryfield, the rop_geometry is there just to advance to the next frame (the geometry exported from the rop_geometry node is not important). The node that actually exports the geometry is the file node inside the forEach. In order to vary the file name of the file node inside the forEach node, according to the current iteration of the loop you can compose the file name using stamps(...) function. Example: $HIP/piece`padzero(4,stamps("..","FORVALUE",0))`.$F4.bgeo This will output files like: piece0001.0001.bgeo piece0002.0001.bgeo piece0003.0001.bgeo ... ... piece0001.0002.bgeo piece0002.0002.bgeo ... ... ... 1 Quote Link to comment Share on other sites More sharing options...
wateryfield Posted September 8, 2014 Share Posted September 8, 2014 Hi Wateryfield, the rop_geometry is there just to advance to the next frame (the geometry exported from the rop_geometry node is not important). The node that actually exports the geometry is the file node inside the forEach. In order to vary the file name of the file node inside the forEach node, according to the current iteration of the loop you can compose the file name using stamps(...) function. Example: $HIP/piece`padzero(4,stamps("..","FORVALUE",0))`.$F4.bgeo This will output files like: piece0001.0001.bgeo piece0002.0001.bgeo piece0003.0001.bgeo ... ... piece0001.0002.bgeo piece0002.0002.bgeo ... ... ... Thanks for your fast respond. I will take a try . Quote Link to comment Share on other sites More sharing options...
wateryfield Posted September 8, 2014 Share Posted September 8, 2014 Hi Wateryfield, the rop_geometry is there just to advance to the next frame (the geometry exported from the rop_geometry node is not important). The node that actually exports the geometry is the file node inside the forEach. In order to vary the file name of the file node inside the forEach node, according to the current iteration of the loop you can compose the file name using stamps(...) function. Example: $HIP/piece`padzero(4,stamps("..","FORVALUE",0))`.$F4.bgeo This will output files like: piece0001.0001.bgeo piece0002.0001.bgeo piece0003.0001.bgeo ... ... piece0001.0002.bgeo piece0002.0002.bgeo ... ... ... Get it. I forget the most important thing ,the render frame range. Now it working. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.