OT Houdini build Array VOP question (and a bit of rant)

532 views
Skip to first unread message

Olivier Jeannel

unread,
Mar 2, 2016, 7:29:41 AM3/2/16
to soft...@listproc.autodesk.com
Hello serious list :)

I'm a bit confused with houdini vop array.
While I managed to do it in vex, I would like to make a build array (like build array from set) of the pointposition (P) in VOP.

I understand you need to for-loop on each Ptnum and probably append the P values and this will buid an array of P.
But you know what ? Well I can't manage to make it work.

I found no example on the net (sideFX, odforce).
The doc is just words, no schemes, no graphics.
The examples hips are bizarre, not so simple, and use the old loop node.

So I'm wondering if someone from here could provide a screen shot of how that should be connected ?

Thank you :)

Christopher Crouzet

unread,
Mar 2, 2016, 9:13:28 AM3/2/16
to Softimage Mailing List
It seems like they've extended the support for arrays in H14, which makes it now possible to use them as geometry attributes. In the previous versions I guess that there was no real point (but convenience) in creating arrays in VOP since you couldn't pass them downstream with the geometry data.

So if you're on H14+, it seems like you were on the right path? I've attached a working screenshot that stores every point position in a “output” vector array attribute.

If like me you're stuck with H13, you probably don't need to store your point positions in an array at all. Instead, you should be able to just loop over each point with a `For Loop VOP` and do your computation directly in there. Now I've never used VOPs since I prefer writing directly in VEX so I might be wrong :)

Also don't forget to use point clouds if you're after distance-related queries.


------
Softimage Mailing List.
To unsubscribe, send a mail to softimag...@listproc.autodesk.com with "unsubscribe" in the subject, and reply to confirm.



--
for_loop.gif

Olivier Jeannel

unread,
Mar 2, 2016, 9:20:29 AM3/2/16
to soft...@listproc.autodesk.com
Aaaaah THANK YOU !

I'm "aware" of the PCOpen+PcFilter to gather infos based on distance.
I also use the PrimUV a bit and XYZ+PrimUV for location things.

I'd be curious on the For Loop Vop, if you have any pictures :/ Sorry to ask.

It's a shame there's no tutorial or phylosophycal explanations of these basic loops ... It's like if everybody was a natural born coder...


Christopher Crouzet

unread,
Mar 2, 2016, 9:26:45 AM3/2/16
to Softimage Mailing List
I did attach a screenshot in my previous email, are you not seeing anything? Or are you asking for the H13 for loop?

Olivier Jeannel

unread,
Mar 2, 2016, 9:32:29 AM3/2/16
to soft...@listproc.autodesk.com
Yes I saw it, sorry, I thought there was another additionnal method with For Loop :
"Instead, you should be able to just loop over each point with a `For Loop VOP` and do your computation directly in there"
Have I misunderstood ? You're doing a for-loop without building an array in the end. 

Christopher Crouzet

unread,
Mar 2, 2016, 9:55:40 AM3/2/16
to Softimage Mailing List
Basically, arrays are a convenient structure to pass data around (and to potentially make your code more readable, which won't apply to VOP). If all you need is to perform a computation in place and directly use the result in your VOP graph, then iterating over your points is all it takes—no array needed.

I don't know what what you're planning to do with that array of point positions but I've attached a screenshot with a simple example. It iterates over all the points, retrieve their position, and outputs the centre of mass. Note that it's better to run this specific example in “detail” mode to perform the computation only once, instead of once per point.

for_loop2.gif

Olivier Jeannel

unread,
Mar 2, 2016, 10:12:34 AM3/2/16
to soft...@listproc.autodesk.com
Thank you so much for your time, explanations and examples Christopher.
I'm taking those picture and will reproduce them :)

Well, I wanted an array because I need to see if I could be able to retrieve the second element of an array (Ptnum =1 ) using  Get Element (I guess).



Christopher Crouzet

unread,
Mar 2, 2016, 11:13:41 AM3/2/16
to Softimage Mailing List
Maybe I'm misunderstanding but if you already know which point you want an attribute value of, then why would you want to store the values for every point in an array? That'd be a lot of processing for nothing. No need to iterate with a for loop neither. In VOP there's the `Get Attribute VOP` node where you can specify a point/primitive/vertex number and retrieve an attribute from it.

Cheers!

Olivier Jeannel

unread,
Mar 2, 2016, 11:53:01 AM3/2/16
to soft...@listproc.autodesk.com
No, no you're not mis-understanding. Probably me doing it wrong
I will try that too, thank you for making that clear :)
All that "thinking" is because I had this project https://vimeo.com/155960784

It's a bit complicate to describe in words.

To achieve the rotation per primitive  I had to define an axis and center for each primitive.
The axis problem is solved.
The center position is half solved. I'd like it to be in the middle of the edge (at the moment it's happening on the point Position)
I know I need to subtract vector P0 - P1 to find the middle position.
But, when I sort the array of Position (with Sort SOP) in Random mode it can happen that P1 is no more next to P0, but somewhere far away.Causing the middle of my edge being somewhere inside the polygon.

In vex I don't know how to tell Houdini pick the second index (index 1) in "that" sorted array.

So I had that idea to try to rebuild it in VOP, using a similar Ice Build arrayFromSet + Select in Array.

I have no idea if what I'm saying is clear :/

Anto Matkovic

unread,
Mar 2, 2016, 5:43:46 PM3/2/16
to soft...@listproc.autodesk.com
Nope. I think the only way to create an array directly in VOP, is pcfind (pcopen that returns array), or array version of point neighbors. Or, to stack the 'append' node several times :). There are examples how to loop over arrays of indices, later in network, here:
By the way, had to do some pretty interesting networks :) for Kristinka Hair for H - while everything worked at the end of day, anyway.

If you're around arrays and nodes, Fabric is waiting for You....



From: Olivier Jeannel <facial...@gmail.com>
To: "soft...@listproc.autodesk.com" <soft...@listproc.autodesk.com>
Sent: Wednesday, March 2, 2016 1:29 PM
Subject: OT Houdini build Array VOP question (and a bit of rant)

Christopher Crouzet

unread,
Mar 2, 2016, 10:47:17 PM3/2/16
to Softimage Mailing List
You can think of each geometry attribute as an array which length equals the number of points (if dealing with points). VOPs simply iterate over these points and process the graph for each of them. Since each attribute is an array, at any time you can pick the value of any element with `Get Attribute` provided you know the point number. This is so straightforward that you can even do this outside of VOP/VEX, with the `point` expression for example.

Sometimes it can be useful to define attributes that can themselves hold arrays, for example a list of neighbours, to then pass these down to other nodes for further processing. That's why they added that feature in H14, but otherwise there's no real need to directly create arrays yourself. Shamefully, I haven't used Fabric Engine yet but from what you're saying maybe they're just presenting the data differently by providing you with the whole points data as an array instead of letting you directly work on a per-point context? In any case, there's plently of good reasons to use Fabric Engine but this definitely isn't one of them—just wrap your head around how Houdini works instead, everything will eventually start to make sense :)

Olivier, assuming that two poins are neighbour based on their point number is quite a risky bet. Instead, there is a `Neighbour VOP` node for that so you can pick P1 as being the first neighbour of P0. But then, to reflect the sorting order of your points, it'd be better to retrieve the array of all the neighbours and retrieve only the neighbour with the smallest point number.

I've made an example scene for you—everything is happening in the node named `rotate_each_prim`, where you'll find an `angle` parameter to play with. I tried to keep the code as simple as possible and documented every line to help you understanding it.

An issue is that the `Sort SOP` node fails when for example sorting the points of the grid along the X axis since many points in that grid share the same position in X, leaving no hint for the `Sort SOP` node to prioritize one point over the other. In fact, sorting points by an axis might be troublesome even on more organic geometries, so basing this effect on the `Sort SOP` alone won't be enough to have predictible results, and you'll end up with primitives rotating in a different direction than their neighbours.

mystic.hipnc

Olivier Jeannel

unread,
Mar 3, 2016, 7:24:26 AM3/3/16
to soft...@listproc.autodesk.com
Thank you for the detailled hip, that's very kind of you :)
Makes me feel very humble too, as it obviously will take time to understand all this. I  do very little steps :)
My knowledge of Vex is very new and poor, that's why I splitted in vex + vop.

If I'm no wrong, the super clever line might be this one :
int pt1 = min(neighbours(input, pt0));
Min neighbor is what ? the closest neighbour to pt0 ? The neighbor with the smallest index ?

At a moment,  I was thinking using the Normal (@axis ) to find the P1. Assuming that @axis position is on P0 and is pointing toward P1. But I'm unable to translate this.
P0+@axis =P1

The conversion Local to Space is loosing me a bit. Is this an invert matrix thing (like in ice ) ?

 

I realise I've been wrong route with the arrays. Yes I end up with array per points which makes it very confusing. 

Thank you a lot for providing this, it's a hell of an effort to understand, but the exercice in itself is very educative even if I only get portions of it :)


Anto Matkovic

unread,
Mar 3, 2016, 8:17:00 AM3/3/16
to soft...@listproc.autodesk.com
Thank you kindly Christopher,
Yes as far as I know, FE presents the whole points data as an array. Beside that, at this moment I just feel FE as much better solution for me (and for Olivier of course :) ), instead of H. Can't really say more for now. Also really need to say, while I'm not programmer, unfortunately or not I have to communicate with them every day, even in private life, so maybe I become a bit resistant. I think we all know how is going with this kind of people -  one has this or that opinion, another has completely opposite, all long stories full of smart words. No need to waste your time on me, let's say in short :)  Of course I've read everything you said here.
thanks again...


From: Christopher Crouzet <christoph...@gmail.com>
To: Softimage Mailing List <soft...@listproc.autodesk.com>
Sent: Thursday, March 3, 2016 4:40 AM
Subject: Re: OT Houdini build Array VOP question (and a bit of rant)

You can think of each geometry attribute as an array which length equals the number of points (if dealing with points). VOPs simply iterate over these points and process the graph for each of them. Since each attribute is an array, at any time you can pick the value of any element with `Get Attribute` provided you know the point number. This is so straightforward that you can even do this outside of VOP/VEX, with the `point` expression for example.

Sometimes it can be useful to define attributes that can themselves hold arrays, for example a list of neighbours, to then pass these down to other nodes for further processing. That's why they added that feature in H14, but otherwise there's no real need to directly create arrays yourself. Shamefully, I haven't used Fabric Engine yet but from what you're saying maybe they're just presenting the data differently by providing you with the whole points data as an array instead of letting you directly work on a per-point context? In any case, there's plently of good reasons to use Fabric Engine but this definitely isn't one of them—just wrap your head around how Houdini works instead, everything will eventually start to make sense :)

Olivier Jeannel

unread,
Mar 3, 2016, 9:28:58 AM3/3/16
to Anto Matkovic, soft...@listproc.autodesk.com
You seem very dispointed by Houdini Anto, are you ?

Christopher Crouzet

unread,
Mar 3, 2016, 11:45:44 AM3/3/16
to Softimage Mailing List
VOP graphs are being converted to VEX code, which means that for each VOP node you'll find a corresponding VEX function, and most likely vice versa too. If you want to see the generated code, just right click on the VOP node, and select “View VEX Code...”. It can be informative to check it out sometimes to help with debugging, but it's overly cluttered in comparison to hand-written VEX code and thus can be hard to read.

Regarding the line `int pt1 = min(neighbours(input, pt0));`, it's picking the neighbour with the smallest point number. The reason is simple—the `Sort SOP` node reorder the points so for example the lowest point numbers for a sort by X become the ones having the lowest X value. And hence, you want the neighbour of `pt0` with the lowest point number to have `pt0` and `pt1` representing the edge that matches the best to what's expected from the sorting. If instead you'd simply do `int pt1 = neighbours(input, pt0)[0];`, then you'd sometimes get what you'd hope, sometimes not.

Also yeah, there's never a single way to do things. If you compute a sort of normal as you say for each point, that you can make in a predictable way accross the entire mesh, then you'd probably avoid the problem that I mentionned in my previous email. Maybe the `PolyFrame SOP` could be used for that, but I don't know how it internally works and thus I don't know how predictable it is. Worth a try! I only provided the scene this way to give the idea that the essential of it can be done easily enough in VOP/VEX. But it's always the remaining 10% that takes 90% of the time! :)

Dan Yargici

unread,
Mar 3, 2016, 11:54:43 AM3/3/16
to soft...@listproc.autodesk.com
Love Houdini, but coming from ICE, VOPs are an absolute horror to use IMO.  They need to drag it out of the 90's and introduce some more modern interaction workflows...

DAN

Olivier Jeannel

unread,
Mar 3, 2016, 4:09:06 PM3/3/16
to soft...@listproc.autodesk.com
Hahaha, yeah vops are rough compared to ice.
Specialy when it swap or disconnect / reconnect nodes while you move the mouse without you notice.
Second favorite is when a  vop turns itself in red "error mode" and doesn't want to come "back" until you rebuild the geometry_vop_global :/
uh well, 3d life

Jordi Bares

unread,
Mar 4, 2016, 2:01:50 AM3/4/16
to soft...@listproc.autodesk.com
Dan, you should talk to them and show them some examples, every single time I have reached (with some screen captures, videos and audio to support my requests) them there has been a positive conversation and 8/10 things have been improved, which is the reason I want to keep using it.

jb

Dan Yargici

unread,
Mar 4, 2016, 4:29:38 AM3/4/16
to soft...@listproc.autodesk.com
Thanks Jordi.  I would like to do this actually, and my family is away for a week so I might actually have the time to do it!

Which channel would you suggest?  or do you think it would be better to start an open discussion on the Houdini list?

DAN

Andy Nicholas

unread,
Mar 4, 2016, 4:46:12 AM3/4/16
to soft...@listproc.autodesk.com
Hi Dan. You can send them feedback directly via sup...@sidefx.com.
A

Dan Yargici

unread,
Mar 4, 2016, 5:33:01 AM3/4/16
to soft...@listproc.autodesk.com
Cheers Andy.  Will do.
Reply all
Reply to author
Forward
0 new messages