Forgot Password / Register

Register Blogs FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-05-2009, 01:35 PM
Jim Crafton Jim Crafton is offline
Registered User
 
Join Date: Mar 2008
Posts: 196
Jim Crafton is on a distinguished road
foreach SOP

I was playing with the foreach sop last night, and ran out of time before I could figure this out. Let's say I have a mesh with a bunch of quads. I want to select some of the quad primitives (faces) and have the foreach sop only work on those faces. I couldn't figure out how you do this.

A possible solution just came to mind (I'm not at home, so I don't have houdini in front of me).
-select the faces and create a group geo sop
-add a create attr sop give the attr a name of something like "selected_faces_prnum", use $PR (like the sidefx video on the soccer ball does)
-add the foreach sop and use the "selected_faces_prnum" attr.
Would that work? If not, is there an alternate way to do this?
Reply With Quote
  #2  
Old 11-05-2009, 02:24 PM
CaptainHammy's Avatar
CaptainHammy CaptainHammy is online now
The Python Guy
 
Join Date: Jan 2008
Location: Santa Monica, CA
Posts: 30
CaptainHammy is on a distinguished road
Send a message via AIM to CaptainHammy
I'd personally use a group since I'd only want to act on specific faces. If you try to do it by attribute value it will act on ALL your geometry since even if you give your specific faces a value of one, the other faces will have the default value and be modified as well. If you just create a single group and set the group mask to that it will only act on those faces and you can then merge the geo back to the source geo minus the faces you wanted to work on.

Attached is a simple file where I jittered a grid and only wanted to bricker faces that had an area greater than 1.5.

Edit: Is there some particular trick to uploading files that I'm not aware of? Every time I try and attach my zip files it errors with no useful explanation.

Here's the url.
http://www.captainhammy.com/foreach_by_area.hipnc
__________________
Graham Thompson
Technical Director
www.captainhammy.com

Last edited by CaptainHammy; 11-05-2009 at 02:43 PM.
Reply With Quote
  #3  
Old 11-05-2009, 02:34 PM
robert.magee's Avatar
robert.magee robert.magee is offline
Side Effects Software
 
Join Date: Nov 2002
Posts: 176
robert.magee is on a distinguished road
Here is an example where I used a group to define a primitive selection then branched this off to two blast sops. The first blasts away all the nodes outside the selection and the second blasts away the selected faces. I then run the first one through the foreach and merge the results with the second branch to get the surface. Now the group members are the only faces that run through the foreach...

http://www.sidefx.com/images/stories...each_group.zip
Reply With Quote
  #4  
Old 11-05-2009, 11:24 PM
Jim Crafton Jim Crafton is offline
Registered User
 
Join Date: Mar 2008
Posts: 196
Jim Crafton is on a distinguished road
Robert - thanks! CaptainHammy thanks as well, Roberts was a little more what I was looking for.

Next question, playing around with this, is there any limit to how much geometry you can model on the "each" node? I tried extruding, polysplitting, belveling, extruding some more, got a cool shape, then stepped out of the foreach node and got nothing, it all had red hash marks on the nodes. Stepped back into the foreach node and everything was red as well. Then Houdini crashed after I tried to delete on the last nodes in the foreach container. Is there a limit to what you can do here?
What I had hoped to do was make a moderately complex panel design and then have the foreach sop repeat this for me on the selected panels.
Reply With Quote
  #5  
Old 11-05-2009, 11:34 PM
robert.magee's Avatar
robert.magee robert.magee is offline
Side Effects Software
 
Join Date: Nov 2002
Posts: 176
robert.magee is on a distinguished road
I don't know of any limit. If you had a file that wasn't working properly that I could see it would be helpful. I wonder if some of the panels on the original shape were not able to do everything you were asking or some of the values created bad geometry. Again an example file would be helpful. What I would do is create the steps you want to do on a single poly then copy and paste these nodes into the foreach sop - then if a problem occurs you can send me the single panel example and the target shape so that I can see what might be the issue.
Reply With Quote
  #6  
Old 11-05-2009, 11:58 PM
CaptainHammy's Avatar
CaptainHammy CaptainHammy is online now
The Python Guy
 
Join Date: Jan 2008
Location: Santa Monica, CA
Posts: 30
CaptainHammy is on a distinguished road
Send a message via AIM to CaptainHammy
The only limiting factor is basically the amount of memory of your system when you are using extremely large amounts of data but that's really no different than any other SOP.

Unfortunately that nature of the For Each makes it extremely difficult to debug in some cases. Nodes inside will error, causing nodes outside to error and MMB on them to find the actual source can be very difficult and tedious. The best thing I can suggest is to just keep MMB on your errors to try and find something that makes sense and is wrong. Bypassing the whole For Each can sometimes help clear some errors but sometime it is just really difficult to find out the problem. I know a lot of people, myself included, who have spent a LOT of wasted time trying to debug a For Each network.
__________________
Graham Thompson
Technical Director
www.captainhammy.com
Reply With Quote
  #7  
Old 11-06-2009, 11:47 AM
Jim Crafton Jim Crafton is offline
Registered User
 
Join Date: Mar 2008
Posts: 196
Jim Crafton is on a distinguished road
Robert,

OK, thanks, I'll try that technique. If I run into the crash, I'll post the hip file here.


CaptainHammy, thanks for the heads up. I sort of ran into what you're talking about last night, and was unnerved by it, because I'd never really had any problems like that before with Houdini.
Reply With Quote
  #8  
Old 11-06-2009, 01:07 PM
Jim Crafton Jim Crafton is offline
Registered User
 
Join Date: Mar 2008
Posts: 196
Jim Crafton is on a distinguished road
Here's a problem with using it. I'm using Robert's approach of modeling the bits on a separate chunk of geometry, and then copy/pasting the nodes to the foreach node.

The panel as I'd like it:


The selected faces I want to put this on


In the foreach node


After pasting the nodes:


I can't upload the zip file, I don't why it's quite small but the attachment manager won't let me.
Reply With Quote
  #9  
Old 11-06-2009, 01:55 PM
Jim Crafton Jim Crafton is offline
Registered User
 
Join Date: Mar 2008
Posts: 196
Jim Crafton is on a distinguished road
OK I figured this out I think.

The glitch is coming from the values in the panel geo SOP. They work for a 2x2 grid, but not when applied to the smaller geometry of the foreach node.

What I wanted was a way to scale or project the geometry of my "template" panel, onto the constraints of the foreach face. Thinking, thinking, thinking....

The CreepSOP!!! First shot didn't work, needed to convert the foreach face to a NURBS surface, and then tweak the creep params a bit, but it worked great!!!

So the original panel:


The foreach node network:


Note the creep settings. Setting the translate and scale to .5 seems to perfectly align things (is there a better way?), and rotating by 90 gets us facing the right way (NOTE: I don't understand *why* I needed to do that, but it works).

Using the 2nd aux input allows us to pump in *ANY* kind of rectangle like geo that we want, very, very slick!

Results:


This is one of the reasons I LOVE Houdini! I can't imagine how you would do this in Modo (or Maya, Max) as elegantly.
Reply With Quote
  #10  
Old 11-08-2009, 12:05 PM
chickenstu's Avatar
chickenstu chickenstu is online now
Registered User
 
Join Date: Jun 2009
Posts: 10
chickenstu is on a distinguished road
hi,

a little tip:
if you rotate your template with a transform SOP before the creep SOP,
you can easily chose "fill path" in your creep SOP, then the only thing you have to change is the TZ translate parameter and your SZ scale parameter if you wish to!

apart from that keep it coming

regards,

Manuel
__________________

manueltausch.com
http://vimeo.com/user2522760/
[my houdini tutorial channel]
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
About 3D BuzzContact Us
Copyright © 2008 3D Buzz, Inc. All rights reserved.