XaiJu
entagma
entagma

patreon


VEX101 - Intersecting Lines

It's been some time since I (via Inconvergent's website) stumbled upon these beautiful images by Jared Tarbell: 

http://www.complexification.net/gallery/machines/substrate/

After quite a while fiddling around in VEX I finally managed to get the setup to work. And then stored it in some random folder. And forgot about it. Until recently. When I decided it'd be a neat addition to our VEX101.

This was one of those moments when you realize the progress you're slowly making when it comes to scripting. My two year old setup was a spaghetti box of wrangles and inefficiency. Time to clean this up...

I present to you: Intersecting Lines.

VEX101 - Intersecting Lines

Comments

Gives me hope to hear that even the Entagma guys have to debug for days sometimes.

Johan Nilsson

Yeah, I feel it. Sometimes it helps to view it as sort of a wicked Sudoku puzzle :) Cheers!

Entagma

Ah haha! Now I see it, the frustration of debugging. Thanks mo, makes perfect sense.

richnosworthy

ps i know that the recursive splitting won't work outside of the solver, i'm just curious why its not even returning any hits when the lines cross

richnosworthy

Hey Mo, love this course, sorry this question comes along time after. Just wondering did you ever have any issues with the intersect_all function. Its strange but even taking your scene apart i can't get the function to register hits outside of the solver. I copied the same point wrangle out of the solver but modified to store the hit as an attribute. But as you increase the value of amp, no hits are registered. As soon as its inside the solver, the hits are picked up. https://dl.dropboxusercontent.com/s/pwyclnhe79indhp/2019-10-28_17-55-19.gif I know its a long time ago now, but though maybe you might have an idea why? I've been struggling with this for 3 days :) Ps if its helpful, my modified version of this https://www.dropbox.com/s/6mj2n4pzxqwitul/intersector_14Edit.hiplc?dl=0

richnosworthy

thanks for the reply, I appreciate it!

Simon van den Broek

Hi Simon, This page from Houdini's manual sums up the group syntax pretty well: https://www.sidefx.com/docs/houdini/model/groups.html Regarding the @group_ syntax: https://www.sidefx.com/docs/houdini/nodes/sop/groupexpression.html The group assignment will be stored in a group attribute. @group_ is just a shortcut to access the integer value (1 or 0) stored in this attribute. Cheers, Mo

Entagma

Hey there, is there a source somewhere explaining me more about the string group epression "!" u used, I can't find any other examples that use this. I would also like to get more information on the way you used a group like an attribute with @group_moving, can I use any group like an attribute like that?

Simon van den Broek

Hey Dilip, thanks for the kind words! Super glad to hear you did it! Also a neat animation! Cheers, Mo

Entagma

Hey Mo, I just finished watching the whole VEX 101 course and it was brilliant! I finally have the chance to understand Houdini properly, and it is all thanks to Entagma! I made this little animation as well as some other stuff while diving into the 86+ videos https://www.instagram.com/p/Byx8cKcnQjE/ hope you like it! Again, thank you a lot for sharing the knowledge !

Dilip Ramírez

Hi Kieran, as the first point we're generating will be static, we don't need to store its parent primitive. That's only relevant for the moving point, which we generate after that (called npt2). To get&set our source primitive attrib on this point, we use these three lines of code: int srcs[] = pointprims(0, @ptnum); //looks up the currently active point's prims int src = srcs[0]; // gets first (and only) primnum of which our curr. active point is a member. ... setpointattrib(0, "source", npt2, src); //stores our curr. act. pt's prim member number as our second new point's source attrib. This new point will bemove in succeeding sim steps. Hope that clarifies it a bit :) Cheers, Mo

Entagma

hey Mo, thanks for this, great tut. Just going through and when we start creating new lines from the previous line, when we look to store the parent's primitive number, how does the new point know anything about the primitive line it was drawn from? Since lerp only interpolated between two points to get the new position to add a point, how would the new point know about the actual line primitive when using the pointprims function? or if the point is positioned on the line, then it's automatically part of the line? sorry probably totally missed something simple here, thanks, K

Kieran

Hi Orson, nope - I think you're not missing something, that should just work as well - though I can't say for sure as I haven't tested it on my own yet :) Cheers, Mo

Entagma

Hi Florian, thanks for the question - there are a few things that caught my eye. Mainly what you need is a primitive attribute to exclude certain parts of your geometry from the intersections. That is always done on primitive level. See attached scene file :) Hope That helps! Cheers, Mo <a href="https://drive.google.com/open?id=1GHQ8qKL9kS3NWCwjk9B08ma8InLg_mxB" rel="nofollow noopener" target="_blank">https://drive.google.com/open?id=1GHQ8qKL9kS3NWCwjk9B08ma8InLg_mxB</a>

Entagma

Hi, and thanks a lot for this amazing serie. I was wondering about the part where you create the i@source att with : int prims[] = pointprims(0,@ptnum); int prim = prims[0]; Would it not be the same to do i@source = @primnum ? Or I am missing something. Thanks again

Orson favrel

Hi Mo (or Manu :)), I wonder if you could help, I've got a question regarding the grouping of the primitives points with "!" to omit the i@source from the selected group. I'm trying to select a pointcloud minus the points with the same @source but those still get selected with pcfind function... any idea why? Thanks a lot! hip file and screengrab here : <a href="https://www.dropbox.com/sh/2lojyynpa46d7ru/AAD8RYeDWWkx8VyZURl1kH2Pa?dl=0" rel="nofollow noopener" target="_blank">https://www.dropbox.com/sh/2lojyynpa46d7ru/AAD8RYeDWWkx8VyZURl1kH2Pa?dl=0</a>

Florian

Hi Conor, have you checked your code against the scene file we provided? Comparing it side by side in an editor usually is the quickest way to find quirks in VEX :) EDIT: Here's the original file: <a href="https://www.dropbox.com/s/kpszuy4yq7kjgk3/intersector_100.hip?dl=1" rel="nofollow noopener" target="_blank">https://www.dropbox.com/s/kpszuy4yq7kjgk3/intersector_100.hip?dl=1</a> Cheers, Mo

Entagma

Having a weird issue with this one - after the reflected line is calculated and drawn (around the 20:35 mark). I get a nexus of lines near the center of all the points. Here is a .hip to show what is happening, I must have some small thing wrong in here. <a href="https://www.dropbox.com/s/4c4w698k3nltyqk/enatgama_intersectingLines.hip?dl=0" rel="nofollow noopener" target="_blank">https://www.dropbox.com/s/4c4w698k3nltyqk/enatgama_intersectingLines.hip?dl=0</a> Thank you for these tutorials, im an old dog learning new tools and these are amazingly helpful.

conor collins

excellent last advice.

jeremy jozwik

Actually this is one of those things that can prevent you from having to know a specific framework too well beforehand. If you've got a low-level grasp of your algorithm you can always resort to manually implementing helper functions etc. But granted - knowing your framework definitely makes life easier! :)

Entagma

Hmm - a bit torn on this one. I guess as long as it doesn't distract too much :)

Entagma

Would love it if you kept sharing your stumbles in future examples!

Mr Racecar

Very valuable that you gave us an insight into what your challenges were when figuring this thing out while also touching briefly upon what programming really is. I recently read somewhere that you should always put down the whole logic on pen and paper and make it work there before ever touching a computer. I guess that means you should know your framework/VEX pretty well first...

Mr Racecar

Whew.. I got this working on my own (between Intro to VEX and AHTYA this is started to click). Ended up using Carve to get prims, merged after/with the first Point Wrangle. Then inside the Solver, added && @FF < 1; to the intersection check (if() statement) to make sure lines that started on my "boundary" grew as well.

Pete Golibersuch

Hey there.. excellent tutorial. I remember Jared's work from many years ago when Processing was getting off the ground. How would you approach adding lines prior to the calculation/Solver? Say for example, you wanted the lines to stay out of a certain area defined by a font? Could you pipe those lines (prims) into the second Solver input and place them into the array?

Pete Golibersuch

Hey Chris, good idea - I've attached a version that does a somewhat okay job at translating the look&feel of this effect into 3D space. However much of it relies on lines intersecting, which is much less likely in 3D than on a plane. (The only lines not intersecting on a plane are parallels...) <a href="https://www.dropbox.com/s/o7hcz76cygtb84a/intersector_16.hip?dl=1" rel="nofollow noopener" target="_blank">https://www.dropbox.com/s/o7hcz76cygtb84a/intersector_16.hip?dl=1</a> I've added a few comments and colored the nodes I changed green. Have fun :) Mo

Entagma

Any chance you could make a follow-up video showing how to make this effect work in 3d, inside a bounding box or bounding geometry? Was thinking it could work additively layer-by-layer like 3d printing. Perhaps introducing 45 degree angles as an afterthought? Here is an example of a space-colonization algorithm I was playing with by Toadstorm: <a href="http://www.toadstorm.com/blog/?p=452" rel="nofollow noopener" target="_blank">http://www.toadstorm.com/blog/?p=452</a> So far I've had no luck modifying the solver to work in 3dspace or mapped to a surface. I found this video quite helpful in understanding the logic. It would be interesting because it seems somewhat similar to a tool-pathing algorithm used by CNC. The effect is quite cool. Consider it a future Patreon request from me I suppose :) Great work!

Zensunni

Basically you want to normalize a vector when you need to make sure it's exactly unit length (1 unit long). This can be the case when you'd like to use a vector as a base direction (the vector can later be scaled to adjust for speed and thus result in a velocity vector), or use a vector in a dot or cross product (e.g. to get the vector perpendicular to two other vectors as in our case here). In order to yield correct results, the cross product in this case needs a normalized vector. As for reading up on when you'll need a normalized vector - to my knowledge there's no comprehensive list of this. (If anyone knows of such a resource . please reply!) One neat example would be this: <a href="https://www.youtube.com/watch?v=ZTywc8v9uU8" rel="nofollow noopener" target="_blank">https://www.youtube.com/watch?v=ZTywc8v9uU8</a>

Entagma

Phew - honestly I've never used three.js - Just skimmed over the wiki page on it... Seems like there are a few experiments on it out there: <a href="https://youtu.be/iDNdPKazTbQ?list=PLO4-XgsjiBaQk8faAEH7b2NkIrDFbSAdA" rel="nofollow noopener" target="_blank">https://youtu.be/iDNdPKazTbQ?list=PLO4-XgsjiBaQk8faAEH7b2NkIrDFbSAdA</a>

Entagma

Now I have one more question. I understood the mathematical behind the normalize() function. But I don't understand when and why I should use it. What should I read about the purpose of use in visual applications?

reaze

Thank you Mo, is it possible to share some knowledge about connecting Houdini with Three.js ? In order to use Houdini side of our arsenal in web design. Many Thanks. something like this <a href="https://demos.littleworkshop.fr/track" rel="nofollow noopener" target="_blank">https://demos.littleworkshop.fr/track</a>

Saman Fani

Hi Christoph, rand() uses a seed to generate a pseudo-random number - this is cool if you'd like to be able to exactly reproduce the behaviour of your PRNG (pseudo-random number generator). However rand()'s periodicity can be too low for some applications (e.g. DLA). Periodicity means "how long it takes until the random number sequence is repeated". nrandom() in contrast works without a seed and uses more modern algorithms to generate pseudo-random numbers which result in a rather big period. I like to use it when I'm either too lazy to use a seed or when I need a huge period for my random numbers. In this case the reason for using nrandom() was just lazyness - I didn't want to use seeds. :) Cheers, Mo

Entagma

There's one thing I'm still not sure about. What is the difference between nrandom() and rand()?

reaze

Hey, I've just enrolled into your patreon courses I can only say BIG THANKS for sharing knowledge!!! Although I am almost complete noob in the field of programming I think I can say your VEX 101 lessons are not exactly 101, even you said that at one point you had a lot of trouble figuring out the interest_all function. My point is that there's room in making a really basic set of lessons for vex before jumping to VEX101. This could mean more work for you guys but possibly a lot more traffic. Anyhow, just a noob speaking here, keep on making amazing stuff!!!

Stanko Stupar

Thank You very much, Moritz!

Massimo Baita


More Creators