Jump to content

loop through each primitive per frame with no feedback or merge


mrWolf

Recommended Posts

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 by mrWolf
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. :mellow:  

Link to comment
Share on other sites

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

...

...

...

  • Like 1
Link to comment
Share on other sites

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 . :)

Link to comment
Share on other sites

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.

:)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...