Jump to content

Randomly scale down particles with a linear field


sunlight90

Recommended Posts

I have particles in my scene. I want to fade out my particles pscale based on controller geo and a falloff. But I want to add a bit randomness to it.

In cinema 4d I would just grab a linear field and a random field.

In Houdini, my plan was to use a grid with maskfromgeometry and attribtransfer that on the particles. However, this will just scale down all the particles that are in one axis the same way. I have no idea how to add randomness on the particles scale, (I want that some particles scale down faster, and some particles need longer to be scaled down)

Link to comment
Share on other sites

Thank you. Instead of linking it to the time, I've linked it to my controller geo. The particles fade out with random values,  but they still fade out all at once in a straight line as you can see.

My goal is to let some particles fade out later than others, so that I break this linear outfade shape. I've tried to sketch that in red.

 

Capture.PNG

Link to comment
Share on other sites

Hi Karsten,

here is a remotely similar example. It's scaling a point grid by proximity to several planes (represented by the large points and their normals).

scale_by_plane_dist.jpg.934f7a4ce744b4878ed6722172549fd6.jpg

int pt_near = nearpoint(1, v@P);
vector clr_near = point(1, 'Cd', pt_near);
vector pos_plane = point(1, 'P', pt_near);
vector nml_plane = normalize(pos_plane);
float dist = planepointdistance(pos_plane, nml_plane, v@P, set(0));

 

scale_by_plane_dist.hipnc

Link to comment
Share on other sites

On 10/2/2020 at 12:34 PM, sunlight90 said:

Thank you. Instead of linking it to the time, I've linked it to my controller geo. The particles fade out with random values,  but they still fade out all at once in a straight line as you can see.

My goal is to let some particles fade out later than others, so that I break this linear outfade shape. I've tried to sketch that in red.

 

Capture.PNG

You can modify it easy to get what you want

int f = rint(fit01(rand(@id),0,20));
int rnd = rint(fit01(rand(@id+54),0,20));
float p = fit(@Frame,f,f+rnd,1,0);
@pscale*=p;

 

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