Werner Posted November 23, 2017 Share Posted November 23, 2017 I'm trying to understand how loops and Foreach works, but need some help on how to iterate over primitives with different offsets and angles in my cuts. Here is an image I found online to explain what I want to do...or something similar. 1. Use clip to cut a primitive once 2. Loop over the new primitives and cut again, but at different positions and angles. 1 Quote Link to comment Share on other sites More sharing options...
mestela Posted November 24, 2017 Share Posted November 24, 2017 I'm sure there's better ways, but here's my attempt. Will explain more if I get time later... recursive_subdivide.hip 4 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted November 24, 2017 Share Posted November 24, 2017 (edited) here's my foolin' around...I put a bias in mine so it can break up the biggus first rather than an even chance for each prim..not sure if I've set up my logic right tho....one thing, tried the compiled block and Sort ain't compilable yet vu_generic_recursive_div.hipnc Edited November 24, 2017 by Noobini 4 Quote Link to comment Share on other sites More sharing options...
Werner Posted November 24, 2017 Author Share Posted November 24, 2017 (edited) Thanks Mestela! I had a look at your Greeble example as well. It seems to do exactly what I had in mind...it's just for learning so your file is very welcome. You should put it up on your website. Thanks again. Edited November 24, 2017 by Werner Quote Link to comment Share on other sites More sharing options...
Werner Posted November 24, 2017 Author Share Posted November 24, 2017 Too much fun! 4 Quote Link to comment Share on other sites More sharing options...
Werner Posted November 24, 2017 Author Share Posted November 24, 2017 Forgot to mention where I got the idea from. There is a beautiful render on the SideFX gall done by Dimitris Ladopoulos, that made me want to explore loops Foreeach. https://www.sidefx.com/gallery/algorithm/ Thanks again for the great example Mestela. I'm yet to understand how it all works, but I will take my time. one more for fun. 2 Quote Link to comment Share on other sites More sharing options...
mestela Posted November 25, 2017 Share Posted November 25, 2017 Great renders! I agree, it'll make a nice mid-length article for the wiki, the way I worked it out with lots of mis-steps and incorrect toggles and whatnot was actually a good way to learn, I have a feeling a slightly meandery tutorial that follows the same path would be good. Anyways, some quick notes: The outer loop is in 'by count' mode in feedback mode on both the begin and end blocks. This means its purely a 'repeat the inner process x times' loop. Eg, create a sphere, put down a new foreach loop, begin block method to 'fetch feedback', end block iteration to 'by count', gather method to 'feedback each iteration'. By default nothing happens. Put a transform sop inside the loop, with transformX as 1.0. The end result is the sphere moved 10 units, because the same geo is fed back into the loop, and moved 1 unit on x each time. The inner loop begin block is in 'fetch piece or point' mode, end block in 'by pieces or points', 'merge each iteration', 'primitives'. This means it goes through each primitive, applies the inner loop to just that primitive, and accumulates all the results. The tricky stuff is if you use a clip, the clip is defined in worldspace, not relative to the prim being clipped. As such, the wrangle does some bookkeeping to work out the center of the prim being processed, and clips there. That looked too regular, so I added some randomness. Then it looked too much in one direction, so I choose a random x or z direction for each prim, and the switch sop flips between them based on that random x or z. That'll all be easier to explain with gifs. 2 Quote Link to comment Share on other sites More sharing options...
Werner Posted November 25, 2017 Author Share Posted November 25, 2017 No, your explanation is great. Looking at your file, I got the foreach loop part right(thanks to the Masterclass tutorial). I could not find a way to make the clip SOP to work. That is when I got lazy and posted here. My mind was heading in the right direction, but only starting to learn VEX now. I can see how much more control I will have once I understand it better. It would be awesome if you placed it on your wiki. The format and explanation is easy to follow, and would help me to understand the VEX part. Thanks for the incredible resource and effort. Your wiki page is permanently open on my pc. Now, the idea is to see if I can ad two more clip SOPS at -45 and 45, so that it randomly switches between the 4 angles. Thanks again. 1 Quote Link to comment Share on other sites More sharing options...
mestela Posted November 25, 2017 Share Posted November 25, 2017 heh, starting to sketch it out... http://www.tokeru.com/cgwiki/index.php?title=ForLoops 1 1 Quote Link to comment Share on other sites More sharing options...
Werner Posted November 25, 2017 Author Share Posted November 25, 2017 Very exited about this one. I think allot of people will benefit. How high did you push the generations in your file? It looks insane at 15 repeats or more... Thanks Mestela! 1 Quote Link to comment Share on other sites More sharing options...
Dimitris Posted November 28, 2017 Share Posted November 28, 2017 Hey @Werner and @mestela I was surprised to find this thread with the Algorithm stuff I posted a few days ago. See more at https://www.behance.net/gallery/59061121/Algorithm I'm glad it got you interested and thankful for people like mestela! I am also relatively new, so my method might not be very efficient or elegant, but here it goes: I tried a couple of way but ended up using polysplit with edge loops in order to have local space rather than world space. I ended up with 2 variations. 1st one splits each primitive with a random number of edge loops (eg. 0-4). Blue loop splits horizontally, green loop splits vertically. I could only get equally spaced splits so in the 2nd example I tried to make it split each primitive a random number but at a random distance (0.2-0.8) each time. Hope this helps. 4 Quote Link to comment Share on other sites More sharing options...
mestela Posted November 28, 2017 Share Posted November 28, 2017 Very cool! The patterns you get are way more interesting than the once I was getting. Quote Link to comment Share on other sites More sharing options...
Paul Corfield Posted November 28, 2017 Share Posted November 28, 2017 Excellent @Dimitris , saw your renders the other day and wondered how you did it. Thanks too @mestela for your file and write up on the for loops. Added in some diagonal cuts too to your file. These cuts are also with a for loop that I modified from a file @henderthing was kind enough to let me dig around in a while back. Still trying to get my head around these loops, like a lot of Houdini stuff, it's a bit of a dark art. 3 Quote Link to comment Share on other sites More sharing options...
Dimitris Posted November 28, 2017 Share Posted November 28, 2017 (edited) Thanks @Paul Corfield and @mestela Nice work! I'll soon post the same idea, this time on solids! Edited November 28, 2017 by Dimitris Updated post with better image Quote Link to comment Share on other sites More sharing options...
Popular Post Dimitris Posted November 28, 2017 Popular Post Share Posted November 28, 2017 Here is the version for solids. I used connectivity and clipping this time to achieve this. Green loop takes care of X-axis, red takes care of Y and blue the Z-axis. 10 Quote Link to comment Share on other sites More sharing options...
henderthing Posted November 28, 2017 Share Posted November 28, 2017 Been playing with this ever since prototyping a basic version for a crystal card in "the Last Mimzy"... It's also fun to build this way in 3D, filling a cube or volume, and flesh out the wireframe that lives on the resulting edges... Will post a version of that when i get some time... Here are a couple low detail animations from several months ago: 5 Quote Link to comment Share on other sites More sharing options...
Werner Posted November 29, 2017 Author Share Posted November 29, 2017 Dimitris, great to see you here. I love the renders you did. Great shading and lighting. I can stare at these patterns all day long. 5 Quote Link to comment Share on other sites More sharing options...
Paul Corfield Posted December 1, 2017 Share Posted December 1, 2017 Added some rotation with a transform just before the clip node in Matt's file. Also added some noise after the for loop to get some variation in the height from the ground. 6 Quote Link to comment Share on other sites More sharing options...
Werner Posted December 1, 2017 Author Share Posted December 1, 2017 That is super cool. Beautiful render Paul! Quote Link to comment Share on other sites More sharing options...
Paul Corfield Posted December 1, 2017 Share Posted December 1, 2017 @Werner Thanks, it came out ok, not bad for what took about 1 minute in Redshift. I'm like you, I never tire of looking at patterns like these. I'll no doubt mess around with this scene quite a bit more to see what else it can do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.