Arrays in Houdini. Wondering...

   12968   11   4
User Avatar
Member
361 posts
Joined: June 2013
Online
I'm trying to recreate some of the things I've done in ICE and I'm finding some roadblocks.

Let's say I want to do a simple smooth, per point get the neighbors positions and average them. Here's a way to do it in ICE.



In VOP I'm a bit lost atm since even though I can access the neighbors ID, unlike ICE there's no “locations” here, so I dunno how to get the point positions of said neighbors.
Also apparently I can't create an array by selecting from an array with an array of indices instead of a single value.



More over, these very handy array operations don't seem to exist.


If I'm going to have to loop to get these, I wonder how much overhead these put into Houdini and also if it's better to do them directly in VEX or in an “inline code” node. (?)
And even if I loop to create my arrays, will they be created per vertex? Isn't that wasteful?
What's the “context” of the attribute VOP? Is it always point?

I'm guessing many of you went through this “rewiring”, eh.
Edited by probiner - May 14, 2017 11:54:46
User Avatar
Member
4189 posts
Joined: June 2012
Offline
Here, simple smooth:

Attachments:
Screen Shot 2017-05-15 at 11.25.26 AM.png (71.1 KB)
Screen Shot 2017-05-15 at 11.25.23 AM.png (80.9 KB)
SmoothPointCloud.hiplc (229.7 KB)

User Avatar
Member
98 posts
Joined: Aug. 2014
Offline
probiner
If I'm going to have to loop to get these, I wonder how much overhead these put into Houdini and also if it's better to do them directly in VEX or in an “inline code” node. (?)
And even if I loop to create my arrays, will they be created per vertex? Isn't that wasteful?
What's the “context” of the attribute VOP? Is it always point?

I'm guessing many of you went through this “rewiring”, eh.

Hello Probiner, nice to see you there

About overhead with loops, of course loop takes more to evaluate, however let's say that you shouldn't hesitate to use them. I wouldn't go into comparisons with ICE, I'll stay just with that: “you shouldn't hesitate to use them”.
BTW in Houdini world, closest thing to ICE Context is “class”, vertex, point, primitive, detail ('vertex' is just a polygon corner). Context in H belongs to words like SOP, DOP and so on.
In some cases, like working with curves/strands, you can utilize modes of Attribute Promote SOP (average, min, max, sum and so) for really fast, ‘modified transferring’ from curve to points on curve, or back - because curve is primitive class, point is… point class.
User Avatar
Member
4189 posts
Joined: June 2012
Offline
you can always use AttribblurSOP too, if your goal isn't to just use Vops. It's OpenCL accelerated!
User Avatar
Member
361 posts
Joined: June 2013
Online
Hey guys, thanks for the insights

@Artye
My goal is to use Vop. The picture below shows something more in light of the smoothing I'm trying to do. You've shown me some interesting avenue with “pcopen”, but this not for this:


@amm
Hey hey Thanks for the inputs. I've uses Loops then even ended up setting up a HDA to do those summarizing operations:


As seen in the first image, I just didn't grasp how to do all the looping inside the VOP, I had to have the ICE equivalent to “Repeat” done on SOP level.

So much to learn

Cheers
Edited by probiner - May 22, 2017 20:41:54
User Avatar
Member
174 posts
Joined: March 2014
Offline
Cool !
Can you just share that here ? https://github.com/fxnut/siLib [github.com]
User Avatar
Member
98 posts
Joined: Aug. 2014
Offline
probiner
As seen in the first image, I just didn't grasp how to do all the looping inside the VOP, I had to have the ICE equivalent to “Repeat” done on SOP level.


If I'm correct your solution is almost the same as in loop masterclass examples [www.sidefx.com], so that's ‘it’, probably.
By the way I've played with some ‘practical cases’ of cumulative calculations, when I was working on ‘rewrite’ of Kristinka Hair for Houdini, things like Frenet Frame for orientation, or transferring one axis scale of pattern into equivalent distribution along curve, so on. Worked well with satisfactory speed, considering that thing is still, loop. Firstly I've tried to ‘misuse’ the behavior of some SOPs like Sweep and that worked too, but, doing everything in VOPs was a way faster.
Hope I'll find a little bit of time to post as much generic examples of these ‘researches’.
Edited by amm - May 24, 2017 15:34:31
User Avatar
Member
361 posts
Joined: June 2013
Online
NNois
Cool !
Can you just share that here ? https://github.com/fxnut/siLib [github.com]

Hey NNois, I didn't reply right away but I kept this in mind. What is it?

I want to do a VOP library with some subnets that echo some XSI workflows so I'm wondering what is this library of yours.

Cheers
User Avatar
Member
174 posts
Joined: March 2014
Offline
Hi, that's not mine at all.
That's a outgoing effort to rebuild in Houdini the most used ICE nodes.
This project started on the softimage mailing list by Andy Nicolas and other “big names” of the list.

Although I don't have time now to participate, I think building a lib for softies is a very good idea
https://groups.google.com/forum/m/# [groups.google.com]!msg/houdini-silib/1EDy4VBE_48/6F_DWkK_CgAJ
Edited by NNois - June 12, 2017 19:06:35
User Avatar
Member
1 posts
Joined: Jan. 2014
Offline
Hi, I'm a Senior FX artist coming form Softimage XSI and I've switched to Houdini FX 3 years ago.
There are many ICE nodes that are missing in Houdini that stops me in my day to day work. I think it would be important to have someone from SideFX to port them to Houdini in an official way so they would be part of the default Houdini nodes.

Here's some examples:

- Get array min - Get array average - Get array max - Get array sum - Get array median - …
but also nodes like:
- Select in array - Find in Array - Get element index - Get Array Sub Indices - Sort Array with key - Push on Array - Pop from array - …
and those concerning the set (as if you would Attribute Promote to Details):
- Build Array from Set - Get Set Min - Get Set Max
and:
- Select SubArray in Array - Build 2D Array - Build Index Array - Build array from constant -

I truly believe it would be useful to the community. Any XSI users missing these nodes as well?

Here's the Autodesk's list: http://docs.autodesk.com/SI/2015/ENU/# [docs.autodesk.com]!/url=./files/iceref_nodes.htm
User Avatar
Member
2 posts
Joined: April 2018
Offline
I have a solution to find the min and max of an array! If you promote your array to detail you can use this attribute wrangle to find the min and max

int my_array = detail(0, "my_array");
int len = len(my_array);

foreach(int val; my_array){
int first_comp = getcomp(my_array, 0);
if(val == first_comp){
i@min = 99999999;
}
else{
i@min = min(@min, val);
i@max = max(@max, val);
}
}
Edited by Jgaspari - Jan. 20, 2023 17:52:19
User Avatar
Member
185 posts
Joined: Feb. 2016
Offline
To get the min/max value of an array you can use the min()/max() functions.
BONUS: you can also get the average by using the avg()
int array[] = array(1, 5, 5, 5, 9, 4);
int max = max(array);
int min = min(array);
int avg = avg(array);
  • Quick Links