How to visualize VEX variables?

   6177   7   1
User Avatar
Member
23 posts
Joined: April 2016
Offline
Is it possible to visualize vector variables created in an attribute wrangle node with VEX in Houdini? For instance if I create a variable

vector dir = {0,1,0};

Is there a way to visualize this vector in the viewport? I am able to visualize attributes by creating visualizers in the Display Options-> Visualizers tab, but this doesn't seem to work for variables created through VEX, unless I am missing something. The reason I'm trying to do this is it helps to see the vector lines when I'm trying to problem solve.

Thanks for any help!
Edited by Subtle 1rony - Dec. 18, 2017 02:28:26
User Avatar
Member
555 posts
Joined: Feb. 2017
Offline
if i want to see a point somewhere, I just copy a box to that point…
User Avatar
Member
606 posts
Joined: July 2013
Offline
A variable is a temporary storage location, who's lifecycle ends when the VEX is executed.

vector dir = {0,1,0};

An attribute however, its lifecycle persists beyond the VEX execution.

v@dir = {0,1,0};

Hope this helps.
Houdini Indie
Karma/Redshift 3D
User Avatar
Member
23 posts
Joined: April 2016
Offline
Hey guys, thanks for the reply. I understand a VEX variable only exists within the wrangle node its created in. I was wondering if there was a way to visualize those variables(vectors in particular) the same way you can visualize vector attributes using the Display Options->Visualizers feature, which lets you create markers that display the vector lines.

I've attached a picture of the visualizer markers that I'm referring to. The blue is for the point normal and the yellow shows the position vector of the points. If I create my own vector variable in VEX(not an attribute), am I able to visualize it the same way? My reason was primarily for debugging purposes.



Thanks again for any assistance. I am a fairly new user, trying to find my way
Edited by Subtle 1rony - Dec. 18, 2017 02:43:00

Attachments:
Capture.JPG (20.7 KB)

User Avatar
Member
1746 posts
Joined: May 2006
Offline
Its pretty common to copy your variable to a temp attribute, visualise it, and use an attribute delete sop later to get rid of it (or just remove those lines from your wrangle and delete the visualizer).

Eg,

vector dir = (0,1,0};
v@a = dir;

And then you'd append a visualiser to look at the ‘a’ attribute, set its mode to ‘marker’, and type to ‘vector’.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
7805 posts
Joined: Sept. 2011
Offline
If you're lazy like me, you will use the built-in visualizer for normals, and bind to ‘N’. Just don't forget to delete the line binding to N if you actually wanted to keep the normals it had before.
User Avatar
Member
23 posts
Joined: April 2016
Offline
Ah, thank you mestela, that solution does indeed work for me. And thank you for cgwiki, its been immensely helpful getting me started off in Houdini and understanding its language more.

@jsmack, what exactly do you mean when you say “bind to N”. Bind is a term I'm hearing a lot as I continue learning about Houdini, but I don't have a clear definition in my head of what it means. Thanks for your help!

-Eric
User Avatar
Member
1746 posts
Joined: May 2006
Offline
In a wrangle, it just means ‘copy to @N’, eg

vector dir = (0,1,0};
@N = dir;

In vops you use a ‘bind export’ vop, it basically does the same thing.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
  • Quick Links