Hello everyone,
I'm at an impasse, I want to write to a heightfields primitive attributes through Vex, but I feel like I can't grasp the concept of primitives, so I was hoping someone can explain how the pieces fit together.
I'm building a terrain, I have a heightfield, I add a erosion node, I can see that the erosion node ads names like "sediment"or "bedrock" under "names" in Primitives if I look at the Geometry Spreadsheet.
I add a COP2 Network and inside of that I add a sop import node and connect it to my erosion node, in there I can see the sediment "mask"(?) all good so far.
now I try to access the values inside of "sediment" through VEX. I can change value of sediment in vex by typing:
@sediment = 0.5f;
but if I rename sediment like so:
setprimattrib(0, "name", 4, "R", "set");
I can't set the variable by its new name after that:
@R = 0.5f;
what primitive types are these "maks" generated by the erosion node?
can one add their own "masks" through vex and have it end up under "name"?
why can't I change the value of a renamed variable?
where can one see the value of these "masks"? apart from having to look in a COP2 network
it looks like I'm just changing a string when I change the name of "sediment" with "setprimattrib" but how do I set the value?
All I can see is a list of strings called "names" and in that list there is a string called "sediment" but somehow there is more data somewhere?
I would like to create my own "mask" like the erode node does it, but set every pixel/voxel in it by vex.
Edit Primitive Attributes in Heightfields with vex
2720 1 0- InternetFelix
- Member
- 5 posts
- Joined: 5月 2021
- Offline
- Siavash Tehrani
- Member
- 729 posts
- Joined: 7月 2005
- Offline
Hi Felix, I assume you are talking about using the Heightfield Wrangle SOP? This node is an alias to the Volume Wrangle SOP (since heightfields are 2D volumes). From the docs:
So it seems a volume wrangle can read and modify the voxel values, but not create a new heightfield. You could however add/rename layers by using HeightField Copy Layer, or branching off > Attribute String Edit SOP or Name SOP > merging back in. From there you can modify the new heightfield with a wrangle, or maybe take it into COPs and do something with VEX Snippets inside a VOP COP. You can read COP nodes with a Heightfield File SOP and give it a new layer name there.
Note
Unlike how the Point Wrangle and Attribute Wrangle nodes work, writing to an unknown @name variable will not create a volume.
So it seems a volume wrangle can read and modify the voxel values, but not create a new heightfield. You could however add/rename layers by using HeightField Copy Layer, or branching off > Attribute String Edit SOP or Name SOP > merging back in. From there you can modify the new heightfield with a wrangle, or maybe take it into COPs and do something with VEX Snippets inside a VOP COP. You can read COP nodes with a Heightfield File SOP and give it a new layer name there.
FelixTopgolfThis doesn't do anything on my end.
but if I rename sediment like so:
setprimattrib(0, "name", 4, "R", "set");
Edited by Siavash Tehrani - 2021年7月30日 01:12:07
-
- Quick Links