Issue painting zscale attribute with Polyextrude

   4463   8   3
User Avatar
Member
10 posts
Joined: 1月 2016
オフライン
I am trying to control the distance of polyextrude with paint sop.

So I painted zscale atttribute and promoted it to a primitive attribute. But now the polyextrude only works with individual elements and not connected components (“Divide into” parameter).

How can I extrude faces in this case? What I am doing wrong? I've attached the simple example file.

Thanks!
Edited by zenmonkey - 2019年3月2日 16:46:54

Attachments:
polyextrude-paint-example.hipnc (102.5 KB)

User Avatar
Member
899 posts
Joined: 2月 2016
オフライン
Hello,
that behavior is expected.
One thing you could do is to average the points.
You have to create first an attribute ID, so that you can keep track of the points after they get split by the polyextrude.
Then you average the position of the points with the same ID.
Finally you fuse the points.

I've made an example code, but it's not very efficient because it's doing the same loop operation for each point.
Ideally you should do the averaging calculation (which is a foorloop) only once for each group of points with the same ID (some grouping trick might help in this regard).
Also, as you can see in the picture, the averaged result seems to be lower than it should be for the tallest prims. I don't know why this happens.
int ids[] = findattribval(0, "point", "id", i@id); 
float avg = 0; // average position

foreach(int i; ids)
{
    vector pos = point(0, "P", i);
    avg += pos.y;
}   

avg /= len(ids);

@P.y = avg;

I attached the project file as well
Edited by Andr - 2019年3月3日 05:44:15

Attachments:
polyextrude-paint-example_FIX.hipnc (117.4 KB)
zascaleaverage.JPG (129.7 KB)

User Avatar
Member
899 posts
Joined: 2月 2016
オフライン
Andr
Also, as you can see in the picture, the averaged result seems to be lower than it should be for the tallest prims. I don't know why this happens.


I understand now why this happens.
To fix it, just uncheck “output side” in the polyextrude.
The averaging calculation was taking in accounts also the bottom points of the side group.
But you don't actually need them.


ps. but I don't understand why you would need a polyextrude and 4 more nodes, while you can simply use a single point wrangle and link @P.y to your point @zscale attribute?
Edited by Andr - 2019年3月3日 06:00:48
User Avatar
Member
10 posts
Joined: 1月 2016
オフライン
Andr
Andr

Thanks Andr but your solution seems too complicated for what to me seems like a simple task.

At least conceptually it is simple - control extrusion distance via an attribute.

Isn't zscale exactly for this purpose? Why can't I use it with connected components? Am I missing something basic here?

And yes I can do it with VEX where I move points along their normal but I was experimenting with polyextrude and wanted an elegant solution. What am I confused by is that zscale attribute is essentially created for a task like this yet for some inexplicably reason it doesn't work with connected components…
User Avatar
Member
10 posts
Joined: 1月 2016
オフライン
Just watched Rohan Dalvi's video on polyextrude [vimeo.com] and looks like he is stumped by this “individual elements” restriction as well.

Is this a know limitation or something else? Would love houdini expert users to chime in.
User Avatar
Member
899 posts
Joined: 2月 2016
オフライン
it's because zscale is a primitive attribute.

Anyway an even simpler approach than the post-extrude averaging, is to assign @zscale to @N.y in a point wrangle.
Then in polyextrude set Extrusion Mode to Point Normal and use ‘Existing’.
Edited by Andr - 2019年3月4日 14:42:54
User Avatar
Member
10 posts
Joined: 1月 2016
オフライン
Andr
it's because zscale is a primitive attribute.

I did promote it in the example to a primitive attribute prior to passing to polyextrude

Andr
Anyway an even simpler approach than the post-extrude averaging, is to assign @zscale to @N.y in a point wrangle.
Then in polyextrude set Extrusion Mode to Point Normal and use ‘Existing’.
Can you send an example file of this?
User Avatar
Member
899 posts
Joined: 2月 2016
オフライン
Yes, polyextrude node seems to be accepting only a primitive attribute as ‘distance scale’.
So you have a single value driving the extrusion of each prim, and therefore the extrusion would work only if the geo is divided into ‘individual elements’, with points being split (unique points for each prim).
Otherwise Houdini wouldn't know how to extrude each point, since it belongs at the same time to multiple faces with different ‘distance scale’ values each.
That's why in your case it's better to use the normal of the points as extrusion vector.

Anyway, I'm not on houdini atm.
What do you find difficult about those two steps?
Just insert the wrangle before the polyextrude. To set a vector in Vex you can use the set() function.

Cheers
Edited by Andr - 2019年3月5日 11:13:12
User Avatar
Member
1 posts
Joined: 10月 2020
オフライン
Hi Andr,

Total vex beginner here: tried writing a point wrangle but I keep getting errors telling me the variables are not recognized, I did check the box for creating local variable with my attribute.

“vector N = set(1, zscale, 1);”

I also tried “vector N = set(1, $zscale, 1);” and “vector N = set(1, $ZSCALE, 1);”

Another try was “@P.y = (zscale);” but this didn't work either

Not sure what I'm missing, would appreciate any help
  • Quick Links