Jump to content
kirkjr2

Procedural OBJ splitting

Recommended Posts

Let's say I have an OBJ with 4 pieces of geo. Is there anyway to split these objects up so I can randomly copy to points? My next OBJ could have 16 objects and I don't want to create a blast node and manually select the group every time.

I've managed to figure out how to select the group through an expression and a for loop using `arg(primgrouplist("../OBJ"),detail("../repeat_begin2_metadata1/",iteration,0)).

The Transform is in there for a placeholder but I'd like to center each object at the origin so it isn't offset when it's copied.

splitOBJ.png

Share this post


Link to post
Share on other sites

Use the connectivity sop to get an attribute that you can split them with if they're disconnected. I think there's actually a for loop preset called for each connected piece that does the work for you.

Share this post


Link to post
Share on other sites

dgani > connectivity can't actually split the geo, it will just identify pieces and then you have to split it by hand or by some other method.

my solution would be to use Python script that can do blast SOP (or a new geo container) per group. i've posted it the thread below.

i can imagine you could do that with TOP network as well... 

 

Share this post


Link to post
Share on other sites

Thank you for the feedback! Is there a way to randomly copy each group to a point without splitting them up and using a switch?

Share this post


Link to post
Share on other sites

hey, yeah that's certainly possible.

steps you need to do:

1 - turn group names into a string names

2 - loop over names and pack each name into a packed prim (useful if you want to deal with chunks of geometry as if they were a single points)

3 - on your template points generate an attribute that specifies which instance number is supposed to be copied onto each point

4 - before copying the geometry on points, refer to that instance number attribute and delete all packed prims that don't match that number

5 - loop over the template points and for each of them copy matching packed prims 

check the hip file for an example.

 

screen_copy_groups.JPG

obj_instance_groups.hiplc

Share this post


Link to post
Share on other sites

Awesome that is exactly what I was looking to do!

Share this post


Link to post
Share on other sites
Posted (edited)

I learned so much from this one: (timestamp to jump to the for each block). I had to watch that part several times, especially the spare parameters which are so useful if not absolutely mandatory. Spare inputs at the 0:51:50 mark

 

Edited by AntoineSfx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×