Jump to content
Sign in to follow this  
sunlight90

Randomly scale down particles with a linear field

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)

Share this post


Link to post
Share on other sites
Posted (edited)
int f = rint(fit01(rand(@id),0,20));
float p = fit(@Frame,f,f+20,1,0);
@pscale*=p;

This example for random frame start, but you can modify it for your needs.

Edited by tamagochy

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I was hoping to use Houdini and not having to install 3rd party assets for this. Or is it that difficult to do in Houdini? 

Share this post


Link to post
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

Share this post


Link to post
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;

 

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
Sign in to follow this  

×