Jump to content

Set the time of a point when switching attribute


Recommended Posts

Hi guys

I've been fumbling around with this for ages and I cant figure out what to do.

I have a bunch of points scattered over a grid with a solver running through them (exactly like the infection system that simon holemadel uses) changing an attribute named 'infect'. Not infected = 0 infected =1.

What I want to do is fade the color of each point from black to white over a specified amount of time from when each point became infected. I'm falling at the first hurdle of storing the time at which an individual point was infected in VEX. Im using an attribute wrangle and I think I'm on the right track with 'setdetailattrib'  function, however I cant get it to take.

here's the Vex code I have been using:

float @timestart;

if (@infect == 1)
{
    setdetailattrib(0,"timestart",@Time,"set");
}    
   

and I have uploaded a screen shot and the scene file. If anyone can shed some light on this it would be much appreciated.

 

timestart_attrib.thumb.jpg.17fa9775ca8f7e4db0dcf28b977de51f.jpg

 

Cheers

Al

 

 

Set_Time_Attrib_on_points.hip

Link to comment
Share on other sites

If all you want to do is fade the colour over time, I would just multiply @Cd by a value less than 1 each frame.  Otherwise you will need to compare the attribute value on the current frame with the previous frame. If the value on the current frame is 1 and the previous frame is 0, then you can store @Frame/@Time in a variable as the infection frame. 

Link to comment
Share on other sites

The easiest way is to accumulate an "age" attribute per point, starting at the point where they get infected. You can do this by simply saying @age++;

Another issue you have is that all your points are looking for infection, while it should be the other way around. Its lighter to check for non-infected points around the infectors. If you put millions of points into your infection-system it will get pretty slow.

Ive attached a simple file where i try to show how it can be done lighter.

basic_creep_01.hiplc

  • 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...