Changing Position of Only One Point in VEX

   389   9   1
User Avatar
Member
63 posts
Joined: Feb. 2017
Offline
Hi everybody,

Noob question but lines like @P.y = value changes the position(for example) of every point in the geometry. Assuming I am in point wrangle is there a way to change the P.y or other attributes of only specific points and not all of them?
User Avatar
Member
5053 posts
Joined: Feb. 2012
Offline
Hi,

You can use the Group and Group Type to specify your target points:

Attachments:
3.png (91.9 KB)

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
63 posts
Joined: Feb. 2017
Offline
Thanks but this is not possible when I do not know the points in advance. My question is about situation that is not predictable. For example there is an if statement and we want to change some attributes for those points.

How can I enter that procedure to the body of vex?
Edited by fred_98 - Nov. 12, 2025 08:54:03
User Avatar
Member
2155 posts
Joined: Sept. 2015
Offline
The way Animatrix has it set up is that the points listed in that group parameter will be the only ones affected by the wrangle code.

Those are point numbers he has listed. You don't have to predefine a group if you don't know ahead of time.

Also, with that set of point numbers as Animatrix has it, if you wanted you could also work on a subset of those defined point numbers with code:
if(@ptnum <= 24 && @ptnum <= 27) @P.y += 0.1;
User Avatar
Member
63 posts
Joined: Feb. 2017
Offline
I am aware of it and your solution does not help neither.

I do not know the index of the points(@ptnum) and the algorithm will dictate which points will be qualified.

I am looking for a procedure that will affect only some of the points of the geometry but I do not know which points exactly and the index of the points are the result of some searching and other computations.
User Avatar
Member
20 posts
Joined: Jan. 2016
Offline
You can include points in a group in one wrangle and then move just that group in another wrangle. Sometimes it is easier to split operations.
User Avatar
Member
127 posts
Joined: Dec. 2019
Offline
fred_98
I am looking for a procedure that will affect only some of the points of the geometry but I do not know which points exactly and the index of the points are the result of some searching and other computations.

Supposing that you are able to get point numbers after your searching process, you can use get/set functions to modify a specific point based on it's ID/number :

// get point position based on a given ID
vector position = point(0, "P", point_id);
// adjust position
position.y += value;
// set the position "P" attribute on geometry only on the given point ID
setpointattrib(0, "P", point_id, position);
Edited by ObeidaZakzak - Nov. 12, 2025 14:28:31
Houdini Pipeline Supervisor @ TAT Studio
User Avatar
Member
9344 posts
Joined: July 2007
Offline
fred_98
I am aware of it and your solution does not help neither.
why wouldn't if() condition work for you?

you can include any condition in there and the point will move only if the condition for any particular point is true, doens't have to be point number related

like if you want to move only points faster than certain speed:
if ( length(v@v) > 10 ) v@P.y += 1;

or for simple attribute to value comparisons you can directly use ad-hoc syntax in group field with group type set to corresponding class like:
@mask<0.5
which will run only on elements with "mask" attribute value less then 0.5


or you may need to be more specific how do you expect to specify te points you want to move if neither group nor generic if condition work for you
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
63 posts
Joined: Feb. 2017
Offline
The reason that I could not clearly express my question was that I was trying to translate structure of arrays in C to VEX tamte.

The answer by Obeida Zakzak is similar to what I am looking but I am not very sure.

I will try to experiment with the answers and come up with better description.

Thanks to anyone responding.
User Avatar
Member
9344 posts
Joined: July 2007
Offline
VEX is best when used for processing elements in parallel and each element will figure it's own attribute values

however if you want to set values for other elements, it may be helpful to know this [www.sidefx.com] as those limitations may be confusing if you are not aware of them
Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links