csp Posted April 5, 2018 Share Posted April 5, 2018 (edited) 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 April 5, 2018 by cparliaros Quote Link to comment Share on other sites More sharing options...
fencer Posted April 5, 2018 Share Posted April 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted April 5, 2018 Share Posted April 5, 2018 Can’t this be done through Volume Sample inside a VOP, or using Volume Wrangle ? Quote Link to comment Share on other sites More sharing options...
csp Posted April 5, 2018 Author Share Posted April 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
csp Posted April 5, 2018 Author Share Posted April 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
3dome Posted April 5, 2018 Share Posted April 5, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
csp Posted April 6, 2018 Author Share Posted April 6, 2018 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! 1 Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted April 6, 2018 Share Posted April 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
anim Posted April 8, 2018 Share Posted April 8, 2018 or you can also use Add in VDB Combine then afterwards just divide by number of volumes to get the average 1 Quote Link to comment Share on other sites More sharing options...
csp Posted April 8, 2018 Author Share Posted April 8, 2018 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. Quote Link to comment Share on other sites More sharing options...
anim Posted April 8, 2018 Share Posted April 8, 2018 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 Quote Link to comment Share on other sites More sharing options...
csp Posted April 9, 2018 Author Share Posted April 9, 2018 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. 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.