Jump to content

id to PT


Recommended Posts

hi,

 

a simpleton question... I am importing particles from Real Flow, and want to group then delete every 10th particle or so, with Group By Range select 1 of 6 etc works fine except it uses PT, and this gets very chaotic as this order changes every frame.

 

So i have been trying Attrib Rename,  which technically works, i see the data is renamed to PT, but the Group is still picking by the original PT, i am not sure how to force the use of 'id' on group by expression....or if i need some extra tweaking somewhere else?

 

 

thanks in advance

 

 

Octavio

 

 

 

Link to comment
Share on other sites

well i am not sure i have understand 100%, but basically :

- you have a RF sim with n particle and you want to get the same sim but with less point for ex n*0.1 (10%)

- you can't isolate particle cause you have id that aren't constant

 

so to fix this you have to find a way to build a constant id for each particle of your sim if you want to avoid flickering ,

i think one way would be to use sop solver to do that.

 

if you post a hip it will be easier to help you ,

Edited by sebkaine
Link to comment
Share on other sites

You can group by id if you want! See the `method_2` from attached scene. I only mentioned the previous solution because I found it simpler.

 

As with renaming the `id` attribute to `PT`, this won't work. When you say `PT`, you're actually referring to the variable `$PT` which points to an internal attribute holding the point number. Creating an attribute `PT` won't override the point number attribute, nor will it change what the variable `$PT`  is pointing to. Also, as far as I know, the point number is read-only so you can't change its value.

 

delete_by_id.hipnc

Link to comment
Share on other sites

well if you can load a RF .bin and access to a constant attribute then i think it will be far more easy than having to rebuild a constant id.

 

plug a point wrangle after you reader

 

@Cd    = {1,1,1};

@rand = rand(@reaflowID);

if (@rand < 0.1) {

       @Cd = {0,0,0};

}

 

then after the point wrangle you delete by expression $CR == 0;

 

and it should work or maybe i am missing something strategic here ! :)

Edited by sebkaine
Link to comment
Share on other sites

I can't get this to work...

 

the @realflowId is called @id but even with that i wont get random colors.....doh! one second...

 

@Cd    = {1,1,1};
@rand = rand(@id);
if (@rand < 0.5) {
       @Cd = {0,0,0};
}
 
boomshakalaka!    B)
 
thanks guys!!
Link to comment
Share on other sites

Even though this code is working, it is a bit suboptimal since `@rand` will create an attribute named `rand`, and that's probably not what you want but if you plan on reusing it later on? Just define a simple float variable instead or put `rand(@id)` directly within the `if` statement.

 
@Cd = {1, 1, 1};
float rand = rand(@id);
if (rand < ch("prob")) {
    @Cd = {0, 0, 0};
}
 

 

Just trying to share good coding practices here, but whatever works for you! :)

Edited by ChristopherC
  • Like 1
Link to comment
Share on other sites

As long as you are using a wrangle it's much better to do the deletion inside the wrangle too, way more efficient. 

You can use an if statement to check your condition and then use removepoint(0,@ptnum). 

  • Like 1
Link to comment
Share on other sites

cool, will try that ! 

 

 

...one laaaast thing, I am now copying spheres to the particles, and i am again having to deal with the PT changing each frame and using Stamp fit01(rand($PT),0.02,0.05) , i get the spheres changing size each frame as they get assigned a new particle each time..not very nice bubbles!

 

So i am again trying to find out why the real flow particle ID can't be accessed by more vanilla sop's.

 

I don't mind getting to point wrangle but if there was an 'easier' or less code-y way of doing that? even if it is at the expense of performance,,as i am only dealing with a few thousand particles.

 

thanks,

 

O/.

Link to comment
Share on other sites

  • 4 weeks later...

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