Hi,
Is there a node similar to the VDB Vector merge tool that works on unifying 3 separate scalar volumes into a single named vector volume? I know that vector volumes are anyway considered 3 scalar volumes but I'm trying to optimize a Volume VOP node where I'm calling the samplevolume function 3 separate times(once for each scalar volume representing the vector) and I wonder if calling the function once referencing a vector volume(as in vel instead of vel.x .y .z) would be faster.
Regards,
Ihab
Merge Scalar into vector volumes
9616 12 1- Eyecon
- Member
- 55 posts
- Joined: 11月 2015
- Offline
- animatrix_
- Member
- 4682 posts
- Joined: 2月 2012
- Offline
You can use the volumesamplev VEX function.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- Eyecon
- Member
- 55 posts
- Joined: 11月 2015
- Offline
- animatrix_
- Member
- 4682 posts
- Joined: 2月 2012
- Offline
The only way is VDB, but if it becomes a vector field as a whole you will still have to use volumesamplev.
If the fields are matching, .x, .y, .z, Houdini will sample them as a whole so you only have to call this function once.
If the fields are matching, .x, .y, .z, Houdini will sample them as a whole so you only have to call this function once.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- Offline
With Houdini volumes named with basename.x basename.y basename.z extensions to the name are treated as vectors and you should be able to fetch and work with basename.* in group fields and in VEX/VOPs using Bind VOPs using just the basename set to vector.
See the example file on how to use Bind VOP and Bind Export VOPs to bring in vector volumes and write to vector volumes.
See the example file on how to use Bind VOP and Bind Export VOPs to bring in vector volumes and write to vector volumes.
There's at least one school like the old school!
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- Offline
- Eyecon
- Member
- 55 posts
- Joined: 11月 2015
- Offline
Thanks Jeff. My only issue is converting named scalar volumes to what you describe above(something that's treated as a single vector volume). So I have 3 volumes named R G and B and I want to be able to use the volumesamplev function inside my volume VOP instead of using 3 instances of the volumesample function in order to optimize the VOP execution time(the volumes here are in billions of voxels so they take a while to process through the VOP). I assumed that with volumesamplev instead of sampling each volume each time, the process would be some how done in parallel. Again my problem is my inputs are 3 separate standard scalar volumes(generated by a volume rasterize particles SOP)so I was looking for a way to combine them together before I go into the volume VOP.
As pusat mentioned, I can convert the volumes to a VDB, use volumesamplev then separate the components again(or in my case sample them as RGB in Arnold). I'm just wondering if there is a different way that doesn't involve the conversion step.
thanks for all your help!
As pusat mentioned, I can convert the volumes to a VDB, use volumesamplev then separate the components again(or in my case sample them as RGB in Arnold). I'm just wondering if there is a different way that doesn't involve the conversion step.
thanks for all your help!
- mawi
- Member
- 251 posts
- Joined: 1月 2008
- Offline
Ihab Ali
Thanks Jeff. My only issue is converting named scalar volumes to what you describe above(something that's treated as a single vector volume). So I have 3 volumes named R G and B and I want to be able to use the volumesamplev function inside my volume VOP instead of using 3 instances of the volumesample function in order to optimize the VOP execution time(the volumes here are in billions of voxels so they take a while to process through the VOP). I assumed that with volumesamplev instead of sampling each volume each time, the process would be some how done in parallel. Again my problem is my inputs are 3 separate standard scalar volumes(generated by a volume rasterize particles SOP)so I was looking for a way to combine them together before I go into the volume VOP.
As pusat mentioned, I can convert the volumes to a VDB, use volumesamplev then separate the components again(or in my case sample them as RGB in Arnold). I'm just wondering if there is a different way that doesn't involve the conversion step.
thanks for all your help!
Just use a name SOP and rename the string volume attribute called name.
scalarVolR -> vectorVol.x
scalarVolG -> vectorVol.y
scalarVolB -> vectorVol.z
- Eyecon
- Member
- 55 posts
- Joined: 11月 2015
- Offline
mawi, thanks so much I can't believe how stupid I was That did the trick!
however and unfortunately, running a volumesamplev vs 3 volumesample did not save any time.
I did try the VDB vector merge method and that seemed to improve the performance time of the VOP significantly(because the no value voxels are not processed). However it doesn't seem to be processing things correctly.
I'm essentially using the volume VOP to advect 3 color value volumes using the rest field from a pyro simulation. I'm not sure why, but it seems when I sample the value of the VDB based on the position stored in the rest volume it's not resizing the bounding box of the base VDB….it just seems to be moving voxel values outside the original VDB bounding box(a quick render in Arnold shows output that doesn't make sense anyway).
I'm basically sampling the VDB and reassigning the color value to the same VDB…is that possibly the cause of the strange output?
however and unfortunately, running a volumesamplev vs 3 volumesample did not save any time.
I did try the VDB vector merge method and that seemed to improve the performance time of the VOP significantly(because the no value voxels are not processed). However it doesn't seem to be processing things correctly.
I'm essentially using the volume VOP to advect 3 color value volumes using the rest field from a pyro simulation. I'm not sure why, but it seems when I sample the value of the VDB based on the position stored in the rest volume it's not resizing the bounding box of the base VDB….it just seems to be moving voxel values outside the original VDB bounding box(a quick render in Arnold shows output that doesn't make sense anyway).
I'm basically sampling the VDB and reassigning the color value to the same VDB…is that possibly the cause of the strange output?
- Eyecon
- Member
- 55 posts
- Joined: 11月 2015
- Offline
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- Offline
No not that I am aware of to expand inside of VEX.
You can use the second input of the VDB Activate to activate a region of interest. If you can take your algorithm and simplify a version of it working on a greatly reduced LOD of the volume data with an upstream VOP network to identify areas where you want to do work, then activate on that, then do your heavy lifting later on with the regions that have been expanded carefully where you want to push and pull voxels.
That would be the most efficient. I believe that the Volume VOP processing VDB grids only works on active areas of the grid so you get that nice efficiencies over and above regular Houdini volumes.
You can use the second input of the VDB Activate to activate a region of interest. If you can take your algorithm and simplify a version of it working on a greatly reduced LOD of the volume data with an upstream VOP network to identify areas where you want to do work, then activate on that, then do your heavy lifting later on with the regions that have been expanded carefully where you want to push and pull voxels.
That would be the most efficient. I believe that the Volume VOP processing VDB grids only works on active areas of the grid so you get that nice efficiencies over and above regular Houdini volumes.
There's at least one school like the old school!
- Eyecon
- Member
- 55 posts
- Joined: 11月 2015
- Offline
thanks Jeff. So I kind of did that but for some reason after processing through the VOP both VDBs end up having the exact same number of active voxels. I checked the vex code and all it's doing is a simple assignment
:resultvdb=sourcevdb, for a particular test case at least yet sourcevdb ends up being fully active and therefore that vop is now taking longer to execute than with standard houdini volumes.
I'm essentially just trying to advect a volume represnting voxel color information(extracted from some base geo color) using pyro simulation's rest field(since I can't affect this custom volume directly in the pyro solver. So after the simulation, I'm sampling those color voxels using information from the rest field and essentially moving the colors to their new advected positions using a volume vop. Because the color volumes are very high density(in order for the volumes to render nicely) the vop is obviously taking forever to execute and I was just trying to get it to be more efficient.
I've attached the scene file, if anyone has a better way of doing this I would really appreciate any advice!
:resultvdb=sourcevdb, for a particular test case at least yet sourcevdb ends up being fully active and therefore that vop is now taking longer to execute than with standard houdini volumes.
I'm essentially just trying to advect a volume represnting voxel color information(extracted from some base geo color) using pyro simulation's rest field(since I can't affect this custom volume directly in the pyro solver. So after the simulation, I'm sampling those color voxels using information from the rest field and essentially moving the colors to their new advected positions using a volume vop. Because the color volumes are very high density(in order for the volumes to render nicely) the vop is obviously taking forever to execute and I was just trying to get it to be more efficient.
I've attached the scene file, if anyone has a better way of doing this I would really appreciate any advice!
Edited by Eyecon - 2016年7月30日 04:19:37
- Kareeem
- Member
- 61 posts
- Joined: 10月 2021
- Offline
anybody looking for help with this may find it here: https://www.sidefx.com/forum/topic/87311/ [www.sidefx.com]
-
- Quick Links