Hello, I'm trying to use the volumesample VEX function to sample the mask volume of a heightfield in a Attribute Wrangle node. This works for every other volume but it simply cannot sample the mask. What is the reason for this, and how can I do it?
Edit: I had erroneously written Volume Wrangle node, instead of Attribute Wrangle
Sample the mask of a heightfield in Attribute Wrangle
1154 7 2- ptzdan
- Member
- 4 posts
- Joined: Aug. 2023
- Offline
- Andr
- Member
- 900 posts
- Joined: Feb. 2016
- Offline
ptzdan
Hello, I'm trying to use the volumesample VEX function to sample the mask volume of a heightfield in a Volume Wrangle node. This works for every other volume but it simply cannot sample the mask. What is the reason for this, and how can I do it?
could you post a simple example showcasing the issue?
- animatrix_
- Member
- 4528 posts
- Joined: Feb. 2012
- Offline
ptzdan
Hello, I'm trying to use the volumesample VEX function to sample the mask volume of a heightfield in a Volume Wrangle node. This works for every other volume but it simply cannot sample the mask. What is the reason for this, and how can I do it?
Are you using the "mask" volume name?
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
- ptzdan
- Member
- 4 posts
- Joined: Aug. 2023
- Offline
animatrix_ptzdan
Hello, I'm trying to use the volumesample VEX function to sample the mask volume of a heightfield in a Volume Wrangle node. This works for every other volume but it simply cannot sample the mask. What is the reason for this, and how can I do it?
Are you using the "mask" volume name?
Yes. I just have an Attribute Wrangle node with the first input being a grid and the second being the volume whose mask I want to sample. The VEX code in the node is:
float mask = volumesample(1, 'mask', @P); @Cd = lerp(@Cd, {1., 0., 0.}, mask);
For any other volume name is works, but for the mask it always returns 0.
I create the mask with a Heightfield Draw Mask node.
- animatrix_
- Member
- 4528 posts
- Joined: Feb. 2012
- Offline
Are you sampling the displaced grid or the flat grid? If you are using the displaced grid, you have to make sure you are sampling the correct height:
vector p = set ( @P.x, 0, @P.z ); float mask = volumesample ( 1, "mask", p ); @Cd = lerp ( 1, set ( 1, 0, 0 ), mask );
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
- ptzdan
- Member
- 4 posts
- Joined: Aug. 2023
- Offline
- animatrix_
- Member
- 4528 posts
- Joined: Feb. 2012
- Offline
ptzdan
Thank you. This solved the issue. It still seems to me a bit weird how for any other volume primitive this wasn't problematic. Wrapping seems to be handled specially for the mask
This is due to the border type of the mask field. If you set it to Streak just like the height field, you should get the same result, even without setting @P.y to 0:
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
- ptzdan
- Member
- 4 posts
- Joined: Aug. 2023
- Offline
-
- Quick Links