# Learning VOPSOP

## Recommended Posts

Thinking back on this. Is there a way to put a expression in for the source min and source max? That way if the -5 changes to -6 it will automatically be correct?

##### Share on other sites

try  Relative to Bounding Box node - you may be able to get rid of the fit node

Edit: So day 3 will be a normal challenge, but start thinking about day 4, you'll be setting a challenge for everyone else to complete! - this will allow you to see the different approaches to your problem - the only rule is you have to be able build it yourself first

Edited by marty
• 1

##### Share on other sites

got to admit I took a peek inside soloman's first file =D I still can't figure out what exactly is Houdini doing when I feed a vector to a trig node ;/ I went through the vex code, the help and tried asking Google but couldn't find my answer unfortunately.

Anyway, Vop network : http://i.imgur.com/LqLLS4H.jpg

and the ramp controls thingie : http://i.imgur.com/ZHXPYHK.jpg

// the relative BBX is so awesome. Didn't even know such a node existed, thanks ! ;3

##### Share on other sites

I presume feeding a vector into a trig node will run the trig function separately using each vector component as an input, and output the respective results as vector components (so, effectively you're just doing 3 unrelated trig calculations at once).

Any time you feed a vector into something, it'll either be a node that naturally operates on vectors, or a scalar function that will naturally operate on each component, or a scalar function that will only accept one input, and so it'll choose the first component and ignore the others.  That last case is where you'll see the dotted-line appear - that's denoting that it's casting a vector back to a scalar, which will usually mean it's just throwing away the y and z components.

I find it's best to avoid that for clarity.  If you want to use a particular vector component, split them out using a Vector To Float node, and explicitly connect the component you want to use.

The Add node also works in a similar way, except it's adaptive... it will cast the entire operation to whatever the first input is, so if you input a vector, and then add a scalar, it'll add the scalar to each of the vector components individually.  If you start with a scalar, and add a vector, it'll add the x component of the vector to the scalar, and ignore the rest (in that screenshot of the Vop network, that is again signified by the dotted line input into the Add node)

It works that was for most unlimited-inputs style Vex nodes.

So, in short, what's happening in that screenshot is - the trig acts on all three components separately, the multiply multiplies each component seperately by the output of the ramp, and then it throws away the y and z component, and adds the x component to the y component coming out of the vectofloat node.

Edited by danw
• 2

##### Share on other sites

The Relative Bounding Box node is a good example of why it might be preferable to use the AttribVOP node instead of the VOPSOP node.

By default, that "file" input will point to the SOP connected to the first input, so it'll work fine by default in a VOPSOP even if you don't connect it.  But if you want to explicitly specify an input from inside a VOPSOP node, you'd get into the awkward realms of using "op:" syntax.

The AttribVOP node is basically near-identical in function to the VOPSOP, and is updated to work better with some of the more recent additions to Houdini.

Inside an AttribVOP, the globals give you "OpInput1", "OpInput2", etc.  These are "filename" strings that reference whatever SOP nodes you have plugged in to the AttribVOP node, and you can just plug them straight in to something like the Relative Bounding Box node to reference those inputs, rather than needing to get into writing hscript.

• 1

##### Share on other sites

ohhhh Thank you SO MUCH !! Now it makes perfect sense. For some reason I was assuming it was doing some arcane mathematical operation with the vector when in reality it was simply grabbing each component and returning its sin value.

Here's the (hopefully) correct network : http://i.imgur.com/TR4r073.jpg

Again, thank you so much. I even got to play around with the bounding box axis and the axis that I feed to the trig function ;3 It's pretty cool

edit; I just tried pasting my Vopsop network inside an attribVop and it seems to be pretty much the same thing, except that I've got all the input paths on the globals. That's quite convenient ;3 Will go through the documentation later today.

Edited by Georgie
• 1

##### Share on other sites

Yep, that's looking much neater, good job :-)

That's pretty much the key to learning most of Houdini... the moment you work out how and why data is flowing around a graph, the rest starts clicking into place.

The AttribVOP has a couple of caveats - only one I can think of off the top of my head is that you can't use the "Add Point To Group" node... so I guess it can't edit group membership the way VOPSOP can.  Otherwise it seems to be essentially an expanded VOPSOP, with the added benefits that you can run it over primitives or vertices instead of points if you choose, and you can actually add and remove points/primitives from inside the AttribVOP, which doesn't work in VOPSOP's context.

I'm not certain what the official line is, but since they introduced AttribVOP, I've started to migrate over to using it primarily, and only bothering with VOPSOP on the occasions when I discover something that it can't do.

• 1

##### Share on other sites

Awesome stuff - Thanks Dan!

Day 3.  Please create a VopSop that will raise the y position of each point in a grid that has an X value greater or equal to 0

Additional bonus points for an explanation why on a 50 x 50 grid the points that look like they have a value of X = 0  aren't affected by the conditions of greater or equal to 0

Thanks!

Edited by marty

##### Share on other sites

I got the points on X=0 affected by the condition

Nice thread!!!thanks for taking the time with us newbies!!

Exer.hipnc

Edited by georgeivan

##### Share on other sites

Nice work! This is good as visually you may think you are affecting point x=0, but, we want to be more accurate.

Can you please show me in the details view a point that is equal to 0 in x that has a y != to 0.

Thanks!

##### Share on other sites

i give up lol

Edited by georgeivan

##### Share on other sites

We'll wait until others have tried to run through it, it's super simple but in the mean time try to set the grid columns = 51 instead of 50.

The overriding idea here is to be accurate, using all the tools available in Houdini to be able to check your work.

##### Share on other sites

Yes i see,thanks!

##### Share on other sites

I failed. Tried for over a hour, couldn't figure it out. I got close though. I didn't realize how the "if" node worked, little problem!

I basically took at look at Georges and copied it, with a few small tweaks.

For the Additional bonus points part, I know it has something to do with computers always adding a .00000000000001 at the end. so in my file i added a .00001 to get it to hop to the next set of lines(points). Is this what you were talking about?

I'm still trying to think of something for day 4, I will do something. lol

day3.hipnc

Edited by thesoloman

##### Share on other sites

Question. Is there a way to click on a point in the 3d viewport and have it select the point in the details view?

Edited by thesoloman

##### Share on other sites

Yes, you can show the selected points in the details view. See screen cap attachment.

The If-Then Block Vop is a touch more abstract than others. You are feeding the If node with a Compare node. The Compare node outputs 1 or 0, true or false, based on the argument of >=. Try connecting a parameter node set to export to see the true or false values output from the compare node in the details view!

When the If node sees a value of 1 coming from the Compare, it will then run the nodes inside. This is where you've added the +1 to the Y position.

For the additional bonus points; no, it's not the rounding 'error' of floating point operations. It's good to know that for the future but this is more logical, less esoteric! Have a think about the geometry and the number of points, why do some points have the X really equal to 0 when you set the columns to 51 instead of 50, in fact it will happen whenever you have set it to an odd number.

You may already know it all though- this is just to become familiar how to check your work with details view, as visual inspection is simply not enough for accurate work!

##### Share on other sites

Ok cool. Interesting, thanks!

What is the best way of bringing a group of points that you custom selected off of a custom model made by hand (poly model) into VOPs?

##### Share on other sites

check out the Point In Group node.

To step up your learning, use the Tab menu and typing 'point' or 'group' and it will refine the selection to those relevantly named.

##### Share on other sites

I've posted several video's on using vops on my youtube channel. So you can check them out over there.

Edited by kgoossens

##### Share on other sites

Cool as - thanks Kim - your videos are very good!

Tomorrow is a big day here and it would be cool to see you, and everyone else, join in.

thesoloman will be putting up a challenge for us where we need to post our solution to a VopSop problem. It's going to be good fun. Hope to see you post here too!

• 1

## Create an account

Register a new account