POP Solver/POP Wrangle issues

   4961   5   1
User Avatar
Member
28 posts
Joined: 8月 2013
Offline
I am trying to use this code on a POP Wrangle node and it is kinda working:
float @massEaten = 0;
vector goal = {`chs(“../popattract1/goalx”)`,`chs(“../popattract1/goaly”)`,`chs(“../popattract1/goalz”)`};
if(length(@P - goal)<4) {
@massEaten+=1;
@dead=1;
}
The dead attribute is set to 1 when it is within the radius, but the solver doesn't reap them. the POP Kill node will also work on its own, but when I try to use the two in conjunction, the solver stops unless I comment out the @dead=1; line.

Additionally, I need that massEaten to be a detail attribute so that I can track it after the particles are reaped. Essentially I am trying to make a simulation for a black hole that tracks the volume of matter that it has consumed so I can make it grow more intense over time with relation to this number. Also, for the next stage of development on this, I will need to be able to use a mass I calculate in SOP level as an attribute on the points, then simulate those points, rather than generating a stream of particles. Any help that could be pointed out to me on this would be greatly appreciated as well.
User Avatar
スタッフ
6280 posts
Joined: 7月 2005
Offline
Which version is this?

It sounds like it is the problem that you are creating a float dead attribute rather than an integer one. You may be able to fix it in your version by using
i@dead = 1;
to explicitly select an integer attribute like the Kill POP does. However, when I tried a quick sample in 14.0 it seemed to work just fine with @dead as we will bind float to int and int to float precisely to avoid this problem in later versions…

// Ensure mass eaten exists, default value of 0
adddetailattrib(0, ‘massEaten’, 0.0);

// Inside your if…
// Add to the detail attrib
setdetailattrib(0, ‘massEaten’, 1.0, ‘add’);
User Avatar
Member
28 posts
Joined: 8月 2013
Offline
I am running h13.

The i@kill change worked perfectly, but the adddetailattrib() doesn't seem to be defined in vex, or the help documentation at all for that matter. I removed that line and the rest works perfectly. I just have to create the detail attribute at the SOP level, but it works. Thank you so so so so so so much. This is going to make this project so much more amazing.
User Avatar
Member
28 posts
Joined: 8月 2013
Offline
Ok, that all worked, but now I am struggling with getting certain parameters of the DOPS network to be driven from the detail attribute. I have tried some`chs(“../”)` stuff and VOP POP, and, and, and, and, and… I am out of ideas and knowledge. I am attaching an annotated file with notes on what my goals are and some of what I see as my problem and what I think would be a possible solution, but I am not sure.

Attachments:
blackHolePOPSim1.hipnc (320.9 KB)

User Avatar
スタッフ
6280 posts
Joined: 7月 2005
Offline
Yes, addattrib() is in H14.

What you are proposing is circular in nature. The intenisty1 SOP needs the DOPNET to be computed to evaluate. But you are mkaing the computation of the DOPNET dependent on the values in intensity1.

Instead, move the intensity1 computation into the DOP, perhaps a Geometry Wrangle with

@intensity1 = log(@totalMass) / log(2);

and set the Geometry Wrangle to Detail (Only Once) mode.

With 14.0, you can directly reference @intensity1 and @totalMass in your per-point POP VOPs. I can't remember if Detail attributes had that auto-binding in 13.0. If not, you need to run the Get Attribute. Wire the file name to OpInput1, and on the POP VOP make sure you set in the Inputs to Myself.
User Avatar
Member
28 posts
Joined: 8月 2013
Offline
OK, the geometry wrangle DOP got it working. I have a few things to play with now, so I should be good for a few hours. LOL. Thank you so much for your help. Hopefully I don't need any more for a bit.
  • Quick Links