Jump to content

Search the Community

Showing results for tags 'foreach'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
    • Tools (HDA's etc.)
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 40 results

  1. Hi, I have attached a scene file for reference, in the scene, I have fractured a box and used a for each loop to adjust its pivot points and position and again I have used a grid and scattered point to copy it. I have used for each loop to and a copy to points node. My problem is that, all of my fractured geometry gets copied to each point, while I know copy stamp method but is there any other way that I can use to copy each fractured piece coming out of a loop randomly over the scattered points via a copy to points node. Please let me know, I have attached a file below. * Also can you please let me know how to add strings in attribute vop node, suppose I want to create a string called "piece" inside the vop node and add the id or any random number to it and combine both the values as strings and also export it as a string attribute. Thanks copyToPoints.hipnc
  2. i am trying to run over named primitives, but the for each loop seems to pick randomly for each iteration which batch to process. i want the loop to respect the sorted primitives and run over each named primitive as it is in the geometry spreadsheet. How does it pick the first batch for iteration number 0? can i change that? image 1 is before the loop,sorted primitives image 2 is inside the loop with a single pass to see iteration 0 As you can see the first batch the loop chooses to process is not the first batch as sorted before. First batch should be the one named color_229_229_0
  3. Hi, I would like to create a stack with some pieces of geometry and scale down each of them based on the previous bbox. The final look should be a pyramid based on the geometry you are using .. My problem is that I haven't been able to figure out the correct VEX syntax to use a point wrangle and read the bbox from the previous iteration. Any help out there? Thanks I attached a graph example testing.hipnc
  4. Hey guys, I never got how does a foreach works in vex (at all!), can someone please explain me this? It does the same thing as the For-Each Loop node?
  5. Running solver on multiple objects

    Hello, I want to create a fire from multiple moving objects. I tried to merge them and create a Pryo source then plug this into Pryo Solver but this was a bad solution as the bounding box is getting very large. I tried to run foreach loop on each moving object and then create a pyro source and then plug the result into Pyro Solver but the Bounding box is now tracking the first object but not all the other. If anyone have good solution for this problem please share it with me, also .hip files are very welcome if you don't need to write a long solution i can just dig inside Thanks.
  6. Hi, I'm trying to store a size of some objects into an array using 'foreach loop'. And it works in a single pass mode, but not in normal mode. And I have no idea why Try to switch single pass mode on and off and check attributes on detail stacked_boxes_q.hipnc
  7. For each POINT in each GROUP

    Hello guys I am still quite new in VEX coding and I am all day fighting with set of gravitational rules based on a membership of the points in groups. I am emitting particles, the particles are sorted to groups by 3-6 nearest points. So after couple of frames of emitting particles I have 100 groups and each groups has 3-6 points. Now I need to set some gravitational rules for every group so the points in every group will be attracted to each other just inside the group. I got stuck here. If anyone has any idea how to solve this issue, it would be perfect. Many thanks in advance. ap_ParticleGravitationalAttraction_01.hipnc
  8. Hello everyone, I come to you because I have a little trouble understanding a tutorial. Indeed I look at the tutorial "Abstract Effect a Houdini" the problem is that it is a version prior to 17 and since the node "For Each" has changed. So in the Tutorial it does as in the picture 1 to get the picture 2 I block here (picture 3) and there are plenty of node for each and I do not know which to choose. . . I tried several times but I can not get the same result. Do you have any ideas ? Thank you in advance everyone. os: sorry for my english, i use a translator
  9. DOP in for-each loop

    Hi community! I have a huge destruction scene, where I'm stuck with the ground impact dust. Basically i need to make a smoke sim on every collision with the ground. I have my impact points in place, with birth frame data as well. My guess was to make a for-each loop with a DOP inside of it for every point. It works, but every frame it recalculates the whole sim until the current frame, which is of course is not good. The scene is so huge and scattered, doing this in 1 sim would take an eternity. How can I do this in a correct way? I`m sorry, but i can not post any of the hip file. Thanks for reading this, also a huge thanks if you answer. Cheers. **edit: im on H16.0
  10. Copy to Points - Foreach

    Hey! I was wondering how to copy Geo to points using the Foreach Loop block, but without using a switch. Instead I am trying to use groups to switch between the input Geo. Unfortunately I was not successful yet. Maybe anybody has an idea what I am doing wrong here? Best, M CopyLoop_01.hip
  11. Hello Everyone! How can I loop so that the output geometry is used at the beginning of the cycle? Where am I wrong? I only get two dice, but no more .. Procedural_house_base.hipnc My result (only 2 blocks) My goal (several blocks with copying on the new ones points ) Have a good day All
  12. Hi all, I have an arrays-in-loops puzzle. I thought of a shortcut to do a thing, it doesn't seem to work, and I should move on -- except I would like to understand why it doesn't work. Minimal background: I've got some point data, I've polywired it together using Connect Adjacent Pieces, and gotten a restlength on the primitives from that. I need to set a pscale on the points before moving on to my next step. Half the distance to the nearest neighbor is good enough for now. I could use nearpoints() to figure that out (and it seems to work!), but I thought, "hey, I already have restlengths; why not just look up the shortest restlength and use that?" That turns out not to work, or at least not as I think it should. Where have I gone wrong? After my connect step, each point ends up connected to 4-20 other points by primitives with restlengths between .9 and 3.9. My first stab at this was: use pointprims() to get an array of primitives associate with each point; create an empty float array to hold the restlengths; foreach loop over the primitives, read the restlength with primattrib(), and push the result onto the lengths array; sort() the lengths array into a new array; read out the shortest length and use that to calculate a pscale. Here's the actual code: int myprims[] = pointprims(0, @ptnum); float mylens[] = {}; foreach (int myndx; myprims) { float mytmp = primattrib(0, "restlength", myprims[myndx], 0); // f@checktmp = mytemp; push(mylens, mytmp); // f@checkrslt = mylens[myndx]; } float lensort[] = sort(mylens); float shortest = lensort[0]; f@pscale = shortest/2; I think it's failing at the push statement. If I write out mytmp as a point attribute just before I push it, I get a reasonable number (commented code). If I check the stored value right after the push, I get either zero or the restlength of prim zero. If I check after the foreach loop completes, I get restlength of prim zero. So the push doesn't work. Looks like example code in the docs, but I'm missing something. Any thoughts?
  13. ForEach VEX doubt!

    hey guys, I have various primitives and those have different amount of points on them, for example each one primitive might have 10 points and other might have 20 so it varies like this, Now i want to have an attributes which ranges from 0 to 1 for each primitive just like what we get from curveu attribute in resample node. I know how to do this in for each sop but i want to do this in vex, am somehow not able to get that loop working correctly. I store the array using primpoints to get the points on that primitive and iterate that through a for loop but i am not able to get normalised value ranging from 0 - 1. Can please someone help?
  14. I'm trying to understand a issue with surface normals after a fracture. In the example file i have attached I use a boolean shatter on some geo. This doesn't cause any visible issues with normals. However one oddity is that the result of the shatter contains non manifold edges and wont pass through a second boolean set to union. I'm not sure if this is what causes issues later on. Then I run the shattered pieces through a foreach loop an fracture each piece with voronoi. The result reveals bad normals along the edges of the fracture. In this case the problems can be mostly alleviated by reducing the cusp angle of the of the normal. But in some cases ive seen this solution doesn't always work. And too low a cusp angle can introduce other problems. Is the normal issue related to the non manifold edges from the boolean? Is there a way to set this up to avoid getting these normal problems. See attached file. Thanks shatter_test.hiplc
  15. Can anyone tell me why this happens? I divided some quads from a grid. In a foreach loop i grouped prims with 3 points: if(npoints(0)==3){ f@group_delete = @ptnum; } but it only adds half of the triangles to the group. If i do npoints()==4 no prims are added to the group. If i do unique points before the loop only some of the quads are added. I suspected that this has to do with vertex numbers v.s. point numbers. so i tried primvertexcount() but got the same result. how can i remove all triangles from this geo? thanks b
  16. Creating subfracture group

    Good Evening, Im trying to improve the look of my fracture setup using booleans. The pieces look great but due to the boolean cutters the pieces dont read so well in DOPS. I decided to measure the chunks and shatter only the larger pieces in a bid to improve the collision geometry. I want to use a forEach loop for each large chunk, shatter it and then assign it to a group or assign an attribute so that I can use them later in the constraints network. Those chunks will have glue constraints set to -1 so they dont break basically meaning they are the same as the original piece but will read in DOPs better for collision geometry. I dont want the subfractured individual piece info just the original whole piece. Is there a way to create a group for each loop of the forEach. Then I would have groups like unbreakable_01, unbreakable_02? Would appreciate some pointers before I go insane haha hip attached. Thanks, Duncan forEachLoop.hiplc
  17. Hi all, I've started putting an asset together which allows me to create multiple 'threads' from a single line, then effect them as if they are fraying/weaving. I'm quite happy with it, however my approach doesn't lend itself well to anything other than straight lines, and I'd like to apply it to more/multiple complex curves - so that it follows their contours exactly. At the moment it does 'work', however it distorts the original curve quite a lot, which I'd like to avoid. Could anyone suggest a way for me to adapt my current VOP setup to calculate the trigonometry per curve? Or an alternative to using the 'wireU' attrib? Or alternatively, if there is a different approach I should be taking all-together? any pointers in right direction would be much appreciated .hip attached - Thanks in advance! (N.B. This setup is loosely based on a thread I originally found here on odforce some time ago - but I cannot for the life of me find it now, so a hat tip goes to OP if reading.) thread_tool_asset_003.hip
  18. I have a Foreach loop which processes a bunch of primitives, one-by-one. Inside the loop I have I a Ray SOP. For its target geometry (i.e. what I'm projecting on), I want to use the original target geo (coming from outside the Foreach loop) plus all the projected primitives processed so far, i.e. the progressively accumulated results of previous projections. I don't want the loop as a whole to work in "feedback" mode i.e. working on previous iterations. I want the loop to process primitives one by one. I just want the to Ray SOP to accumulate iterations (previous projections). Any advice how to arrange this?
  19. uhm... Im trying to avoid using copy stamp as suggested in H16 and use a For Each loop instead... but I cant seem to make sense out of it! (I watched a few videos and checked the help - but they seem pretty useless / over-complicated). I simply want to copy some geometry (eg. circles) onto some points (eg. on a line) + each point has an attribute --> I scale each geometry based on the point attribute. Seems like a perfect iterative loop over points task! When I put my copy to point(s) node inside the for each loop everything works fine (the copy node only receives one point which is fed iteratively from the the for loop). HOWEVER when I apply the transform node and I use vex (@attribute_name) to try to access the attribute value associated to that point to scale my geometry it doesnt work (I get 0). If I try to access the same attribute using a wrangle node it works. Maybe Im doing something silly wrong with the transform node... but what I do seems intuitively right (type the vex attrib name in the scale Thanks!
  20. Hi guys, first topic, it's a beautifull moment. So i have a really really simple thing to do but i can't figure a way. I have like 3 objects, i want to go threw a for loop to get the bbox of these 3 objects and the generate a bbox from a cube with every of these objects. So at the end i will have 3 boxes with the size of the windows. I want to make it automatic so if i plug a new window it will be generate. Easy right? But i can't find the way to do it with the for each loop, some help? thanks So just for you to know, i loop in every windows and i take the bbox in a wrangle with this v@bbox= getbbox_size(0);
  21. Point Wrangle inside foreach loop

    I'll get right to it. I am running a foreach loop on a bunch of prims. For each prim I scatter a number of points. Still within the foreach loop, I run a point wrangle on those points. In the wrangle I run intersect on each of the points and if one hits I want to set an attribute on the prim (foreach loop peice) that the points were scattered on. In the end I don't need the scattered points, I just need the prims output with the attribute @keepage. What I cant figure out is how to set up the forloop so that this works.
  22. This has been driving me insane for the last half an hour so I thought I'd see if anyone here has any insights. I've made two near identical setups. One in a foreach subnet (working correctly) and on in a foreach block (not working correctly). I've attached a simplified setup to demonstrate the problem. I suspect it has something to do with the "merge each iteration" option. Which seems to work slightly differently on the blocks. It's like it's not feeding the results back into the next iteration correctly. Any ideas? There's no real reason that I can't use a subnet, I'm just intrigued as to why the results are so different. I'm sure it's just me doing something wrong. FOREACH_Loop_vs_Subnet_01.hiplc
  23. Hello everyone ! I have some trouble with the foreach loop, and after some search I have not found an answer... I want to connect points from two scatters and do some operation on each pair of points : connect them to a line, resample, noise and set pscale depending of point number of each loop. Here is what I have : A scatter "A" creates two points. For each of thoses points I want to scatter (with scatter "B") another point and connect them together. Here is my two issues : 1- I don't know how to scatter from a sop outside the foreach loop. 2- I connect my points using the add sop setted to "Polygons > By Pattern > Polygon 0 > 0-$N". Will it work on the second iteration ? Here is an image of my network : Thanks for helping ! scatterForEach.hipnc
  24. Hey guys, I am using a foreach block in a solver sop but the foreach causes my point orders to changes, if I bypass the the foreach my point order stays intact as the points accumulate. In the foreach I am using a static point attribute that exists on the points before they enter the solver, and in the solver I want to use the attribute to apply different transforms to the points based on geometry with a matching attribute. Everything about the setup works apart from the point orders changing as the point increase messing up my system later down the line. I attached a simple example to illustrate the problem. Any ideas for what I am doing wrong or could do differently? Thanks, Zybrand foreach_point_order.hip
  25. Hello, I am working on a project helping a friend where I have a fractured character/object (made of a cloth like material) that is basically disintegrating and blowing away using the spring SOP with help from a CMIVFX Tutorial The only issue is that I need the pieces to dissolve away to nothing as well. I figured the "foreach" node (with a transform node shrinking as time passes with $FF) would be the way to go, but I am still learning Houdini and VEX expressions, and despite any research, I have not been able to really understand how to get it to do what I want. The foreach node still kind of confuses me at the moment. How can I get each piece to shrink way over time to nothing? Thank you in advance for any help. Thanks, Dustin
×