octaviuz Posted July 23, 2015 Share Posted July 23, 2015 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 Quote Link to comment Share on other sites More sharing options...
ChristopherC Posted July 23, 2015 Share Posted July 23, 2015 Would a wrangle node be acceptable? if (@id % 10 == 0) { removepoint(geoself(), @ptnum); } 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 23, 2015 Share Posted July 23, 2015 (edited) 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 July 23, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 thanks! it does the trick, but i would like to know why i cant access or change id to PT or group by id directly. Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 hi Sebkaine, yes i got a sim from RF, each particle comes out with an id, that is constant, but houdini uses PT, which is not constant, so i tired to rename id to PT, with no luck Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 i modified ChristopherC wrangle a bit if (rand(@id) < 0.95) { removepoint(geoself(), @ptnum); } so i can delete as a percent, a good result but still curious on the renaming of attributes. Quote Link to comment Share on other sites More sharing options...
ChristopherC Posted July 23, 2015 Share Posted July 23, 2015 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 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 23, 2015 Share Posted July 23, 2015 (edited) 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 July 23, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 23, 2015 Share Posted July 23, 2015 removepoint(geoself(), @ptnum); Actually i didn't know that you can delete geometry with VEX ! Thanks for this ! Quote Link to comment Share on other sites More sharing options...
ChristopherC Posted July 23, 2015 Share Posted July 23, 2015 For information, it's also possible to directly modify groups in VEX by using functions such as `setpointgroup`—this can become handy when a group membership depends on slightly more involved conditions. Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 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! thanks guys!! Quote Link to comment Share on other sites More sharing options...
ChristopherC Posted July 23, 2015 Share Posted July 23, 2015 (edited) 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 July 23, 2015 by ChristopherC 1 Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 muchas gracias guys... I am having now issues with the deleting side of things....using a group SOP by expression $CR == 0, works, but the the Blast, kind of wont refresh the selection Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 23, 2015 Share Posted July 23, 2015 well you don't need a group Octavio. you create your wrangle that modify @Cd you plug a delete node just after => delete by expression $CR == 0 Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 ahhhh!!! fanx!! Quote Link to comment Share on other sites More sharing options...
Robert Posted July 23, 2015 Share Posted July 23, 2015 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). 1 Quote Link to comment Share on other sites More sharing options...
octaviuz Posted July 23, 2015 Author Share Posted July 23, 2015 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/. Quote Link to comment Share on other sites More sharing options...
ChristopherC Posted July 23, 2015 Share Posted July 23, 2015 The `Copy` node can use attributes defined on the point to define the shape of each template copied. What you want in your case is to define a `pscale` attribute on the points and make it dependent on the `id` attribute. You can check out this link for more info: https://www.sidefx.com/docs/houdini14.0/copy/instanceattrs Quote Link to comment Share on other sites More sharing options...
cojoMan Posted August 18, 2015 Share Posted August 18, 2015 [...] Also, as far as I know, the point number is read-only so you can't change its value. sort node, by attribute, id - doesn't this work ? Quote Link to comment Share on other sites More sharing options...
ChristopherC Posted August 18, 2015 Share Posted August 18, 2015 What I meant is that you can't manually assign it like you would do with others attributes by doing something like `@ptnum = 123;`. But yes, sorting the points does the trick, thanks for mentioning it! 1 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.