Jump to content

Combine VDB vectors


csp

Recommended Posts

Hi,

I was wondering if anyone knows any method to combine velocity vectors of x number of VDBs with an average operation. With VDBCombine SOP either Add or Maximum operation will not give me the correct result because the add will put one vector on top of the other and the maximum will just keep the vector with the greater length.

I can produce average using a volume wrangler and the avg() vex function but then I am limited to 4 volumes.

cheers,

C

Edited by cparliaros
Link to comment
Share on other sites

10 hours ago, fencer said:

I'm using "Replace A with active B" for each component separately (vel.x, vel.y, vel.z), interpolation "Nearest", "Flatten All B into A" as well.

That's also not a average, the last combined field will override the previous.

Link to comment
Share on other sites

5 hours ago, 3dome said:

well you are not really limited by the 4 inputs.. just use the op syntax in the volumesamplev('op:/full/path', ...) or for a even more convenient way use spare inputs :)

You gave me a wonderful idea. With a vdbCombine Activity Union I create the combine vdb and with a single volume ranger I loop through all the merged velocities fields in the second input and I store in a array the vector for each field. Finally at the end I do an avg(array) and works!

  • Like 1
Link to comment
Share on other sites

9 hours ago, cparliaros said:

Yes it can but then you are limited to 4 inputs.

Under the gear menu, select “Add spare input”. Spare inputs require you to enter the path to the node being connected, rather than wiring in directly. Another feature of spare inputs is that they index starting at -1, with additional inputs numbering more negative.

Link to comment
Share on other sites

11 hours ago, anim said:

or you can also use Add in VDB Combine

then afterwards just divide by number of volumes to get the average

That also will not give accurate velocity as not all combined vdbs contributed to every voxel. By using the volumesamplev in a volume wrangler you can get better results.

Link to comment
Share on other sites

6 hours ago, cparliaros said:

That also will not give accurate velocity as not all combined vdbs contributed to every voxel. By using the volumesamplev in a volume wrangler you can get better results.

accurate velocity is sort of arbitrary as it depends on the situation, I was reacting to the need of pure average

also just using volumesamplev() will give you 0 or Background value for volumes sampled outside of their active regions, making it essentially the same, so other math is still requited to average just active velocities

in either case I agree that in most of the real world cases just average of velocity field is not useful, it's much more useful if you compute weighted average based on length or density of all incoming vel fields

Link to comment
Share on other sites

5 hours ago, anim said:

accurate velocity is sort of arbitrary as it depends on the situation, I was reacting to the need of pure average

also just using volumesamplev() will give you 0 or Background value for volumes sampled outside of their active regions, making it essentially the same, so other math is still requited to average just active velocities

in either case I agree that in most of the real world cases just average of velocity field is not useful, it's much more useful if you compute weighted average based on length or density of all incoming vel fields

You are right, you need some editional calculation. I measure the length of vector for each merged vowel and if its higher than 0 then it will be part of the average computation.

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