Jump to content

several foreach problems


hatrick

Recommended Posts

Hi,

I d like to use the foreach workflow for several ideas. Could you please take a look at the attached file which hopefully illustrates my attempts.

1) How to setup the loop to rotate each single piece around a given vector?

2) How i can setup uv's for each single piece?

3) How i can randomly assign different materials to each single part in the loop?

Thank you !

Lucas

!!sorry wrong place for this !!

foreach_012.hip

Edited by hatrick
Link to comment
Share on other sites

rotating each face around its centerpoint ... the rotation axis should point outwards , in the initial example i setup N as Axis via $TX $TY etc. when transforming the geo away from centerpoint the rotations axis gets messed up. i also tried to setup the normal in other ways without sucess ...

Link to comment
Share on other sites

Also, there's a small setup with the facet SOP and a couple attribute promote nodes inside the foreach. It could have been put outside the foreach for extra performance, but I left it inside just to make obvious what it's meant for.

You should fix that in your final setup as there's no need to recalculate it for every piece at every iteration.

Cheers

Link to comment
Share on other sites

rotating each face around its centerpoint ... the rotation axis should point outwards , in the initial example i setup N as Axis via $TX $TY etc. when transforming the geo away from centerpoint the rotations axis gets messed up. i also tried to setup the normal in other ways without sucess ...

the problem is not the axis but the pivot of rotation.

however, this can easily be done in vops without using the foreach-sop.

hth.

petz

foreach_014_odforce1.hip

  • Like 1
Link to comment
Share on other sites

so for the random material assignement the foreach is the way to go ? further there are issues with the uv mapping...i need the same projection plane allignement found in the uv project SOP looped for every single piece in the forech.

thanks in advance

Edited by hatrick
Link to comment
Share on other sites

you provide great learning sources petz!! so a lot of questions come up. maybe you find some time to answer a few...

1) i am completly lost with the vector syntax in the first attrib wrangler ... vector tri[] = {{0.0, 0.0, 0.5}, {0.5, 1.0, 0.5}, {1.0, 0.0, 0.5}};

@uv = tri[@vtxnum % 3]; no idea how you get uv's forech faceset ... do you manually setup a triangle with the vector matrix? how would you set this up for other polygonal shapes?

2) what is the idea behind sorting "by vertex order" ?

3) why you promote the id attrib "by first match" ?

4) what about the translate and the invert VOP in the VOPSOP where you cycle throu every set of points which share the the same id attrib?

Thank you !

Lucas

Link to comment
Share on other sites

thx! i'll take a look. in the meantime: Could anyone please explain where s the failure in the attached network. i tried to follow petz' method with manual uv setup with an attribwrangle. it should work for a hex and the uv's are getting messed up when cycling throung the 6th vertex. THX...

ATTRIB_wrang_uv_03.hip

Edited by hatrick
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...