Jump to content

[SOLVED] Help with creating a persistent plexus effect


borbs727

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
Link to comment
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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...