Jump to content
borbs727

[SOLVED] Help with creating a persistent plexus effect

Recommended Posts

Hey everyone, 

 

I currently have a plexus effect by blending a few tutorials together (tinytuts and Danil Krivochko).  I'd like to take it a step further and create a persistent plexus effect where the connections at frame 1 remain throughout the simulation- never breaking or creating new connections.  

 

I have this code from the tinytus tutorial:


if (ptnum % ratio == 0) { 
   int myprim = addprim(0,"polyline"); 
   int nearpts[] = nearpoints(0,P,maxdist,maxpts); 
   for (int i = 0; i < len(nearpts); i++) { 
     addvertex(0,myprim, ptnum);  
     addvertex(0,myprim, nearpts[i]); 
   }
}

It's creating primitives based on nearby points.  So in order to get the persistent plexus look, I need to use maxdist and maxpts to create the look I want, but be able to keep max distance from influencing the connections after I get my initial look.  I think I need to start by establishing a connection between points at frame 1, so they remember who they were connected to during the simulation.  I might be able to do this by somehow storing nearpts[] data into each point with an attr?

 

Or maybe I can create a new if statement that says in pseudocode that may or may not look like python:

int nearpts[] = nearpoints(0,P,maxdist,maxpts); 

if frame == 1:
    create a list called initpts and store any points from nearpts[] into this new list
else:
    pass

Then change the for statement to say for each initpt in initpts:
     addvertex(0,myprim, ptnum);  
     addvertex(0,myprim, initpt); 

Is there a way that I can utilize python to create this effect here?

 

Another thought I had was to use a solver sop because I've seen that it can calculate what went on the frame before, but I'm really struggling with how to proceed with this direction.

 

A nudge in the right direction would help me out a lot, thanks!

 

 

Here's my file so far.

od_persistantPlexus.hiplc

Edited by borbs727

Share this post


Link to post
Share on other sites

Hi Mike.

 

Tomas already posted a solution but I thought I would show you how you can achieve it with the idea that you already had. Creating an array attribute which stored the points to connect with on the first frame and then using that to connect them. I pulled out the code you had in the vop network to a straight wrangle as I find it easier to work with.

 

Cheers Jake.

 

od_persistantPlexus_new.hiplc.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

Amazing!  Thank you both for taking the time to help me out :D They work perfectly.  Also, thanks for showing me how to houdini-ize my idea, Jacob, that's a big help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×