Memo Posted May 27, 2014 Share Posted May 27, 2014 I have a cached number of points, and I'd like each one to emit particles at a relatively constant rate (30fps, i.e. one particle per source point per frame). I'm thinking if I feed the whole thing as a POP source, and dynamically control the birth rate to match point count it should be fine (the incoming point count isn't changing drastically. It sticks to one number for a while, and then changes to another set after a few seconds, and then another etc, so minor inaccuracies at the point of transition is fine). My challenge is to find a way of getting the number of points into there! According to the documentation there should be a local variable $NPT which is number of points. But I just get 0 when I type that in. I ended up writing the code below (into the Impulse Count parameter) and it seems to work well, but seems overkill just to get the number of points on the current node!. Am I missing some basic syntax on the $NPT? sop_path = hou.parm('soppath') sop_node = hou.node(sop_path.eval()) point_count = len(sop_node.geometry().freeze().points()) return point_count Also any opinions on whether it would be better to use impulse activation with the particle count, or constant activation with particle count * fps? Former seems more sensible to me, but I don't know what's going on behind the scenes so that may not be the case. Quote Link to comment Share on other sites More sharing options...
Skybar Posted May 27, 2014 Share Posted May 27, 2014 POP Source DOP -> Source -> set Emission Type to "All Points". Quote Link to comment Share on other sites More sharing options...
Memo Posted May 27, 2014 Author Share Posted May 27, 2014 Sorry yes you're right, I'd simplified my question. Actually I'd like to be able to control how many particles per point per frame there is.e.g. currently i'm playing around with a half or a quarter (i.e. impulse_count = point_count/4). So I can have longer trails with fewer particles. Is there no easier way to get point count? Also my method reads the SOP Path, which obviously isn't ideal since the source may be using the node input. Quote Link to comment Share on other sites More sharing options...
Skybar Posted May 27, 2014 Share Posted May 27, 2014 Ah right, you could do npoints("/obj/geo1/emitter") as the Impulse Count. Just append /4 if you then want a fourth of that, and so on. Quote Link to comment Share on other sites More sharing options...
Memo Posted May 27, 2014 Author Share Posted May 27, 2014 ah ok thanks. So I still need to read the SOPPath from the parameter. If the source is coming via the POP Networks input, then what can I do? Quote Link to comment Share on other sites More sharing options...
Skybar Posted May 27, 2014 Share Posted May 27, 2014 ah ok thanks. So I still need to read the SOPPath from the parameter. If the source is coming via the POP Networks input, then what can I do? Just point it to that SOP then? Quote Link to comment Share on other sites More sharing options...
Memo Posted May 31, 2014 Author Share Posted May 31, 2014 if anyone else is wondering the same thing and comes across this post, the answer is: npoints(opinputpath("../", 0)) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.