Whenever I import an .obj file that has more than one object in it houdini doesn't seem to recognize this and just lumps it into one object which is very probelmatic when the objects are touching each other so that I can't easily select the polygons from just that object to uv map it.
In any other 3d program I am able to open the file and it shows as separate objects.. is there a way to do this in houdini?
Importing geometry (obj) so it recognizes separate objects?
36053 11 3- rdane1010
- Member
- 120 posts
- Joined: July 2009
- Offline
- ragupasta
- Member
- 349 posts
- Joined: Aug. 2006
- Offline
Add a connectivitySOP, this will create an attribute called $CLASS. So you want to name it so its called object_$CLASS or what ever suits you fine.
Next add a partitionSOP, and in the rule area type: object_$CLASS.
If you middle click the node you should have a list of primative groups. These groups are created by Houdini finidng primatives that are adjacent to each other, hence all primatives in a single mesh.
Now add a deleteSOP and set it to “delete non-selected” and choose your first: “object_” and you shall be left with just that single object. Copy and paste the delete node and shift the object number up by one, rinse and repeat then merge all seperate branches back together after you have done all your mapping ect, etc.
I would imagine a foreachSOP would be good for doing this automagically, using stamping to cycle through the primgrouplist making sure not to merge the results. However foreach isnt a sop ive used that much.
Next add a partitionSOP, and in the rule area type: object_$CLASS.
If you middle click the node you should have a list of primative groups. These groups are created by Houdini finidng primatives that are adjacent to each other, hence all primatives in a single mesh.
Now add a deleteSOP and set it to “delete non-selected” and choose your first: “object_” and you shall be left with just that single object. Copy and paste the delete node and shift the object number up by one, rinse and repeat then merge all seperate branches back together after you have done all your mapping ect, etc.
I would imagine a foreachSOP would be good for doing this automagically, using stamping to cycle through the primgrouplist making sure not to merge the results. However foreach isnt a sop ive used that much.
- rdane1010
- Member
- 120 posts
- Joined: July 2009
- Offline
- jacob clark
- Member
- 665 posts
- Joined: July 2005
- Offline
- rdane1010
- Member
- 120 posts
- Joined: July 2009
- Offline
- rdane1010
- Member
- 120 posts
- Joined: July 2009
- Offline
Ragupasta, I tried what you said but I can't seem to figure out how to select the individual “objects” once I have done the first two steps as I wasn't able to select anything when I followed the way you said… when I select from the menu that lists the different objects it doesn't seem to select anything and then with the delete sop it just deletes the entire object..
The method I had used with 3ds max to .fbx isn't working well for me now since 3ds max is, well, not exactly a first rate progam when it comes to highly subdivided objects so if I put it there first it basically turns my nicely sub'd objects from silo into garbage.. for now I am just saving each part I need separate as a separate object and piecing it together in houdini.
I think this is something sidefx should really consider improving for future versions as even basic programs like silo are able to recognize the .obj files as consisting of mutliple objects.. thanks for the help on this though as I greatly appreciate it
The method I had used with 3ds max to .fbx isn't working well for me now since 3ds max is, well, not exactly a first rate progam when it comes to highly subdivided objects so if I put it there first it basically turns my nicely sub'd objects from silo into garbage.. for now I am just saving each part I need separate as a separate object and piecing it together in houdini.
I think this is something sidefx should really consider improving for future versions as even basic programs like silo are able to recognize the .obj files as consisting of mutliple objects.. thanks for the help on this though as I greatly appreciate it
- edward
- Member
- 7717 posts
- Joined: July 2005
- Online
- rdane1010
- Member
- 120 posts
- Joined: July 2009
- Offline
- goldfarb
- Staff
- 3455 posts
- Joined: July 2005
- Offline
whenever I use obj I tend to follow these steps:
file SOP > mesh.obj
group SOP > delete all groups
attribute SOP > delete all attributes
either
connectivity SOP > object_$CLASS + partition SOP
or
use a series of delete nodes to separate the different parts, I select them by entering the delete tool and using “0” to “Select Connected Geometry”
then later I can use a groupCop or an attributTransfer to bring back the groups/attributes I need, if any.
file SOP > mesh.obj
group SOP > delete all groups
attribute SOP > delete all attributes
either
connectivity SOP > object_$CLASS + partition SOP
or
use a series of delete nodes to separate the different parts, I select them by entering the delete tool and using “0” to “Select Connected Geometry”
then later I can use a groupCop or an attributTransfer to bring back the groups/attributes I need, if any.
- perxt
- Member
- 1 posts
- Joined: Sept. 2009
- Offline
Hi, I needed this too so I wrote a script to do it. It creates a different SOP network (to keep it clean) and uses object_merge nodes for each group of your objs.
# Creates object_merge nodes from primitive groups
# of a file node.
#
# Usage: change the FILE variable to the full path of your
# *.obj (or *.bgeo). Then, copy-paste this into
# your Python Source Editor (“window” dropdown)
# and click apply.
FILE = ‘$HIP/geo/groups.obj’
# change the above line to point to your *.obj i.e.
# /home/user/file.obj or CsomeFolder/file.obj
# initialize shortcuts
import hou as h
n=h.node
# build geo nodes
INGEO = n('/obj').createNode('geo', ‘INGEO’, run_init_scripts=False)
OUTGEO = n('/obj').createNode('geo', ‘OUTGEO’, run_init_scripts=False)
# create a file SOP and set its disk path
fileNode=INGEO.createNode('file', ‘fileNode’)
fileNode.parm('file').set(FILE)
# create as many object_merge SOPs as there are groups and connect
for child in INGEO.children():
groups = h.hscriptExpression('primgrouplist(“%s”)' % fileNode.path()).split()
for i in groups:
r=OUTGEO.createNode('object_merge')
r.setName(“mrg_”+i)
r.parm('objpath1').set(fileNode.path())
r.parm('group1').set(i)
w=OUTGEO.createNode('file')
w.parm(“filemode”).set(“write”)
w.setName(“rw_”+i)
w.setInput(0, r, 0)
w.parm(“file”).set(“$HIP/geo/$HIPNAME/”+i+“.bgeo”)
# Creates object_merge nodes from primitive groups
# of a file node.
#
# Usage: change the FILE variable to the full path of your
# *.obj (or *.bgeo). Then, copy-paste this into
# your Python Source Editor (“window” dropdown)
# and click apply.
FILE = ‘$HIP/geo/groups.obj’
# change the above line to point to your *.obj i.e.
# /home/user/file.obj or CsomeFolder/file.obj
# initialize shortcuts
import hou as h
n=h.node
# build geo nodes
INGEO = n('/obj').createNode('geo', ‘INGEO’, run_init_scripts=False)
OUTGEO = n('/obj').createNode('geo', ‘OUTGEO’, run_init_scripts=False)
# create a file SOP and set its disk path
fileNode=INGEO.createNode('file', ‘fileNode’)
fileNode.parm('file').set(FILE)
# create as many object_merge SOPs as there are groups and connect
for child in INGEO.children():
groups = h.hscriptExpression('primgrouplist(“%s”)' % fileNode.path()).split()
for i in groups:
r=OUTGEO.createNode('object_merge')
r.setName(“mrg_”+i)
r.parm('objpath1').set(fileNode.path())
r.parm('group1').set(i)
w=OUTGEO.createNode('file')
w.parm(“filemode”).set(“write”)
w.setName(“rw_”+i)
w.setInput(0, r, 0)
w.parm(“file”).set(“$HIP/geo/$HIPNAME/”+i+“.bgeo”)
- pelos
- Member
- 617 posts
- Joined: Aug. 2008
- Offline
i would recommend try FBX, and work very well for me, well some time doesn't carry the materials with it but they say that will be fix in the next build and you don't need to worry to create groups or delete since all of them transfer in separate object just like you see in Maya or xsi.
is not you can delete each part that you don't want, go back to the main OBJ and select another part and delete the rest. as people commented above .
is not you can delete each part that you don't want, go back to the main OBJ and select another part and delete the rest. as people commented above .
- anon_user_40689665
- Member
- 648 posts
- Joined: July 2005
- Offline
what perxt said.
name your objects in the soruce app in a logical manner,
then separate using group names in houdini, EG:
'hero_pants'
can be extracted from ‘hero’ by deleting unselected groups: *pants*
you can also use *ants* if capitalization is in doubt
This way you can separate everything of relevance, EG:
hero_pants, hero_pants_buttons, hero_pants_belt, hero_pants_emitter, etc..
name your objects in the soruce app in a logical manner,
then separate using group names in houdini, EG:
'hero_pants'
can be extracted from ‘hero’ by deleting unselected groups: *pants*
you can also use *ants* if capitalization is in doubt
This way you can separate everything of relevance, EG:
hero_pants, hero_pants_buttons, hero_pants_belt, hero_pants_emitter, etc..
-
- Quick Links