Point Cut by using Wrangle

   4196   8   0
User Avatar
Member
27 posts
Joined: March 2017
Offline
I have a question.As you see in these pictures points were cut by using Black and White Image. So, I want to do same by using wrangle. Can anyone type wrangle code to do that?
Edited by ferilous - Nov. 13, 2017 18:16:04

Attachments:
BeforeCut.png (1.2 MB)
Atribbute.png (1.2 MB)
Cuted.png (1.5 MB)

User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
@Cd = texture(“Mandril.pic”,@uv.x,@uv.y );


https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
User Avatar
Member
27 posts
Joined: March 2017
Offline
I guess I'm missing something else.

Attachments:
Untitled.png (424.3 KB)

User Avatar
Member
45 posts
Joined: Feb. 2014
Offline
I think you just need to make you lower case c an upper case C. @Cd is a built in attribute type for color.

Otherwise to create an attribute ‘cd’ you would need to write ‘v@cd’ the v tells the VEX compiler to create a vector3 attribute. There's also f@ for float, i@ for integer, p@ for vector4, u@ for vector2, and then you can add for array attributes like i@ for int array and so on.

@Cd is a ‘built in’ type like @P, @N, @ptnum(if your looping over points), @primnum for prims, @vertnum for vertices, they are the same variables that the VOP context provides.

The VEX Wrangle docs are here http://www.sidefx.com/docs/houdini/vex/snippets [www.sidefx.com] The VEX Wrangle syntax is a bit difficult , and quite frustrating to understand at first but it's simple once you learn it.
User Avatar
Member
27 posts
Joined: March 2017
Offline
exactly! I am trying to learn VEX but sometimes it is so complicated, that's the problem, I'm new in VEX.i've changed c to C but still not working. I'll try something else.
User Avatar
Member
7909 posts
Joined: Sept. 2011
Online
Make sure your uv coords are point uv's otherwise you will need to trace against yourself (xyzdist -> primuv) to read the vertex uv coordinate.
User Avatar
Member
45 posts
Joined: Feb. 2014
Offline
In this particular case you could use an attribute promote node to change uv to a point attribute, without any issues since their are no UV seams.

Or you could use,
vector uv = vertex(0, “uv”, pointvertex(0, @ptnum));
to get the get the current points first vertex number ‘pointvertex(0, @ptnum)’ then query the vertex attribute ‘vertex(0, “uv”, vertnum)’.

Then simply change @uv.x, @uv.y to uv.x and uv.y since it's no longer an attribute and just a local variable, since we didn't use the ‘@’ symbol in it's declaration ‘vector uv’, whereas we could say ‘v@uv = vertex(0, “uv”, pointvertex(0, @ptnum))’ to create a point attribute named ‘uv’.
User Avatar
Member
27 posts
Joined: March 2017
Offline
Thank you guys very much :* it worked, I've switched vertex to points.

Attachments:
Untitled.png (847.0 KB)

User Avatar
Member
9 posts
Joined: Sept. 2018
Offline
Thomas Bishop
In this particular case you could use an attribute promote node to change uv to a point attribute, without any issues since their are no UV seams.

Or you could use,
vector uv = vertex(0, “uv”, pointvertex(0, @ptnum));
to get the get the current points first vertex number ‘pointvertex(0, @ptnum)’ then query the vertex attribute ‘vertex(0, “uv”, vertnum)’.

Then simply change @uv.x, @uv.y to uv.x and uv.y since it's no longer an attribute and just a local variable, since we didn't use the ‘@’ symbol in it's declaration ‘vector uv’, whereas we could say ‘v@uv = vertex(0, “uv”, pointvertex(0, @ptnum))’ to create a point attribute named ‘uv’.
@vertnum or @vtxnum?
  • Quick Links