Jump to content
Sign in to follow this  
cparliaros

Combine VDB vectors

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
23 minutes ago, StepbyStepVFX said:

Can’t this be done through Volume Sample inside a VOP, or using Volume Wrangle ?

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

  • Thanks 1

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

or you can also use Add in VDB Combine

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

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×