Jump to content

Emit particles based on an attribute


Recommended Posts

Simple question!

How can I control the number of emitted particles based on an attribute coming from SOP?

Say I have a grid with different colors, and I just wanna make it to emit particles based on the redness of my color?! It should be very easy, and when I go to pop-network, I see all the attributes and info that I need in the detail view but looks like source node doesn't accept attributes like $CR for Birth Rate!

Edited by ehsan parizi
Link to comment
Share on other sites

Simple question!

How can I control the number of emitted particles based on an attribute coming from SOP?

Say I have a grid with different colors, and I just wanna make it to emit particles based on the redness of my color?! It should be very easy, and when I go to pop-network, I see all the attributes and info that I need in the detail view but looks like source node doesn't accept attributes like $CR for Birth Rate!

Hi

You can scatter(Scatter SOP) points based on an attribute and use those points for your source maybe.Although this method will give more of a distribution density type thing, not sure if that would get close to what you need.

You can try adding a new attribute based on the Cd and see if you can pass that new attribute to the Pop network.

Edited by kursad
Link to comment
Share on other sites

Hi

You can try Group SOP. Also you can scatter(Scatter SOP) points based on an attribute and use those points for your source maybe.

That doesn't work, because I want the source pop to emit more particles based on the redness of the point! with grouping you can just say that I want these part to emit and the rest not to emit, which is not what I wanna do, I want to control "the number" of my particles based on the $CR value, or any other kind of attribute.

Link to comment
Share on other sites

Well,

You can create groups(using partition sop) based on the Redness of the points then use ForEach SOP to create your particles. I have not tested it but might work out.

I always try to avoid the ForEach sop. There should be an easier way to do that, I don't know why the source pop doesn't accept the attributes that are already available?! Anyway, between the things that you suggested, scattering points based on Cd gives me the closest result but still not exactly what I'm trying to do. I appreciate your answers :)

Link to comment
Share on other sites

but looks like source node doesn't accept attributes like $CR for Birth Rate!

Not for a Birth Rate, but it does work this way! Birth Rate is evaluated once per cook, and your $CR is an attribute valid per point, so it doesn't make sense. You can use $CR in Birth Probability param though. You can see what's happening by considering a point() expression in any param. This always works, except not always you have a point number to provide it :)

hth,

skk.

  • Like 1
Link to comment
Share on other sites

Hey guys,

If your input geo has a colour attribute, then in your source POP, use the Birth Probability fields set to $CR / $CR (or whatever colour value you choose).

Then it will only emit from the points/faces that have any colour assigned.

What works really nicely is using the colour as a multiplier for velocity/life/forces etc, to get some really interesting effects.

Just ensure that 1) on your Attributes tab, you enable Cd to be inherited and 2) you set the 'Sample Threshold' high enough to avoid sampling warnings/errors.

Hope that was what you were after!

Matt.

Edited by Matt_K
  • Like 2
Link to comment
Share on other sites

Hey guys,

If your input geo has a colour attribute, then in your source POP, use the Birth Probability fields set to $CR / $CR (or whatever colour value you choose).

Then it will only emit from the points/faces that have any colour assigned.

What works really nicely is using the colour as a multiplier for velocity/life/forces etc, to get some really interesting effects.

Just ensure that 1) on your Attributes tab, you enable Cd to be inherited and 2) you set the 'Sample Threshold' high enough to avoid sampling warnings/errors.

Hope that was what you were after!

Matt.

Thanks Matt,

that's exactly what I was trying to do :D

Link to comment
Share on other sites

  • 1 year later...

Hi,

It is a very old topic, but I kind of have the same problem and don't know why it doesn't work.

I want to use the velocity of the first input in the source pop to decide my birth rate.

I've animated a sphere (polygon mesh) and added a trail sop (compute velo). I used the trail sop as my first input for the pop net.

Inside the pop net I am using a source pop and for the birth rate, I wanted to use a simple expression using the point velocity attribute (inherited velocity).

The first problem is, that the incoming geo has no points inside the popnet (it only has points as soon as particles get created)?

And my second problem is, that even when I use point("../../trail1", $PT, v, 0) I get no results (besides 0).

It sounds like a really simple issue, but somehow I always get "blocked" right at the beginning.... slowly a bit frustrating.

Thanks,

Chris

Link to comment
Share on other sites

There are a few ways to do this but if you want to use the Source POP to birth points based on velocity, you need to set the Birth Rate whether it is continuous or instantaneous. Birth Rate doesn't work with any geometry attributes so you need to use an expression. I like to create a detail attribute on the geometry. First promote point v to a detail vector vavg. Then another detail float attribute vmag which is set to the length of vavg which is the magnitude of the velocity.

Use a detail() expression in the Birth Rate of your choice.

If your geometry is deforming, you may also want to add Birth Probability. Set the min to 0 and the max to $CR for colour red. Your available geometry attributes are very limited in Birth Probability to any of the Color attributes, $CR, $CG or $CB. There are a couple others but stick to colour.

Put this down to legacy.

See the example file for the set-up.

birth_by_velocity.hip

Another method is to construct your points explicitly using a Scatter SOP based on a primitive vmag attribute from an attribute promote of the length of v. Number of points in Scatter again determined by the above Detail attribute method.

No reason why you can't take the three SOPs and make an asset out of it.

Link to comment
Share on other sites

Thanks for the quick answer, but may I ask which version of Houdini you are using? I guess 12.5?

I can't find the attribwrangle in 12.1 :(. (EDIT1: I just saw that those are otls? However, it gives me an error saying that the vfilter1 in the vopsop1 doesn't have enough sources specified)

I tried to look through those nodes and inside, but I only get error outputs with nothing in the viewport.

So, basically it is possible to use a detail expression in the Birth Rate, but not a point expression?

Why does detail("../../xyz", vmag, 0) work, but point("../../xyz", $PT, v, 0) not?

EDIT2:

Ok, I got it working with your explanation, thanks a lot. My bad, I was answering too quickly before really testing it :)

I simply recreated it according to your describtion and it works. I still have the above questions though.

Edited by chiess
Link to comment
Share on other sites

Yes H12.5 and yes Attribute Wrangle SOP is new for H12.5 along with other Wrangle SOPs.

Yeah we have a habit of adding a lot of new features and functionality with every minor and major release. I also have a habit of extorting the most out of the new features and functionality as a way of showing the community what you can do. Sorry about that. :)

----

Yes you can use a detail() expression directly in the Birth Rate but this parameter is a global birth rate. The point() expression wants to peer in to every point using a variable but $PT won't work here and is overkill.

How all this works in the Source POP is the Birth Rate (whether instantaneous or continuous) determines how many points will be born and the Birth Probability allows you to shuffle these points about the surface given the $CR red colour attribute in my example.

As I mentioned in the previous post, the Birth Probability is somewhat limited to $CR, $CG, $CB and $CA and a couple others. Consider it an old school type operator harking back to the deep dark past where you wrote in to a limited set of existing attributes including the Cd Colour attribute.

You can't index in to any attribute on the birth surface in the Birth Probability parameters so the Colour attributes it is.

----

Great you got it going and here's hoping you can upgrade to H12.5 in the near future.

Link to comment
Share on other sites

Thanks old school!

Uh, it is great that you guys develop so many new features and add functionality in each minor and major version, but for a beginner like myself, it is pretty.... tough :)

At the moment, I am already happy when I am able to use the existing features and "common" workflows to get my desired result. Currently I am trying to explore in so many different direction.... going mad very soon (thats why so many threads from me are popping up).

Thanks for the explanation!

You mentioned, that the Birth Rate is a global parameter, what exactly do you mean by that? It sounds like a disadvantage?

Link to comment
Share on other sites

  • 11 months later...

I rebuild this setup inside h13 with the new DOP network. It works so far, but I would like to get a little more control over the emission. At the moment we are using a detail() expression in the Birth Rate inside the source node. Is it possible to get the emission value based on the velocity of each face?

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