Hi,
There is a Python tool that will export a .jsx script with camera and null locations that I can then import into After Effects.
https://vimeo.com/186204479 [vimeo.com]
What I’m wanting to do is be able to ‘link’ the x,y,z of a null in the root OBJ level to the world position of a sphere (or point or some other object) inside a geometry SOP.
This will allow me to export the null objects into After Effects and then attach video clips of fire or other items and have the After Effects camera match my Houdini camera.
How would I get the ‘world’ position of an object inside a geometry SOP into a null object outside that geometry SOP?
Thanks,
Jim
World coordinates of an object inside a SOP
8339 12 1- reelinspirations
- Member
- 177 posts
- Joined: 11月 2015
- Offline
- goldfarb
- スタッフ
- 3459 posts
- Joined: 7月 2005
- Offline
make a new Shelf Tool
in the Script tab put:
in the Script tab put:
# get the geo Object geoObject = hou.selectedNodes() geoObjectName = geoObject[0].name() netparent = geoObject[0].parent() # get geo and bbox center geo = geoObject[0].displayNode().geometry() bbox = geo.boundingBox() center = bbox.center() # make null null = netparent.createNode("null", geoObjectName+"_null") null.moveToGoodPosition() # put null at location of center null.parmTuple("t").set(center)
- reelinspirations
- Member
- 177 posts
- Joined: 11月 2015
- Offline
Very cool.
So, let's say I create an attribute on my geometry that is unique. Maybe it is a name “fire” or even an attribute called “fire” that has a value of 1 in it.
How would I then ‘loop’ through all my geometry SOPS and create nulls for each object that has the “fire” attribute?
I'm thinking there may be more than one per SOP.
Thanks!
Jim
So, let's say I create an attribute on my geometry that is unique. Maybe it is a name “fire” or even an attribute called “fire” that has a value of 1 in it.
How would I then ‘loop’ through all my geometry SOPS and create nulls for each object that has the “fire” attribute?
I'm thinking there may be more than one per SOP.
Thanks!
Jim
- goldfarb
- スタッフ
- 3459 posts
- Joined: 7月 2005
- Offline
might be best to get our terms right:
there are Geometry Objects
and then there are Surface Operators and ‘geometry’ inside Geometry Objects.
so are you asking about multiple Geometry Objects that may or may not contain ‘geometry’ with an attribute called ‘fire’
or are you asking about one Geometry Object that has multiple pieces of geometry with the attribute?
there are Geometry Objects
and then there are Surface Operators and ‘geometry’ inside Geometry Objects.
so are you asking about multiple Geometry Objects that may or may not contain ‘geometry’ with an attribute called ‘fire’
or are you asking about one Geometry Object that has multiple pieces of geometry with the attribute?
- reelinspirations
- Member
- 177 posts
- Joined: 11月 2015
- Offline
- goldfarb
- スタッフ
- 3459 posts
- Joined: 7月 2005
- Offline
- reelinspirations
- Member
- 177 posts
- Joined: 11月 2015
- Offline
- tamte
- Member
- 8766 posts
- Joined: 7月 2007
- Online
select desired objects and run this perhaps?
not considering animation
not taking into account any orientation or scale on points (like N, up, orient, rot, scale, pscale attribs)
all can be of course added
root = hou.node("/obj") sel = hou.selectedNodes() subnet = root.createNode("subnet", "MyFireNulls") for node in sel: if node.type().nameWithCategory() == "Object/geo": sop = node.displayNode() # or use .renderNode() if you want geo = sop.geometry() if geo.findPointAttrib('fire'): trn = node.worldTransform() for point in geo.points(): fire = point.attribValue('fire') if fire == 1.0: null = subnet.createNode('null', "Fire_%s_point%s" %( node.name(), point.number())) null.parmTuple('t').set( point.position()*trn ) subnet.layoutChildren()
not considering animation
not taking into account any orientation or scale on points (like N, up, orient, rot, scale, pscale attribs)
all can be of course added
Edited by tamte - 2017年12月6日 21:45:19
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- goldfarb
- スタッフ
- 3459 posts
- Joined: 7月 2005
- Offline
- reelinspirations
- Member
- 177 posts
- Joined: 11月 2015
- Offline
Sweet, thanks!
Now to figure out the code and what it's doing so I can learn!
So, this line is creating a matrix 4 variable of the world coordinates of the object.
trn = node.worldTransform()
Trying to figure out what this line does.
I'm guessing it somehow ‘transforms’ the null to the world coordinates of our matrix4 variable trn by multiplying it with the current point position of the null (which should be at the origin if I'm not mistaken)
Not sure how the parmTuple works and why the ('t') parameter is there. Could not find any documentation on that.
null.parmTuple('t').set( point.position()*trn )
This should work great and Houdini is AWESOME!!!
So are the staff at SideFX for helping me with this.
Jim
Now to figure out the code and what it's doing so I can learn!
So, this line is creating a matrix 4 variable of the world coordinates of the object.
trn = node.worldTransform()
Trying to figure out what this line does.
I'm guessing it somehow ‘transforms’ the null to the world coordinates of our matrix4 variable trn by multiplying it with the current point position of the null (which should be at the origin if I'm not mistaken)
Not sure how the parmTuple works and why the ('t') parameter is there. Could not find any documentation on that.
null.parmTuple('t').set( point.position()*trn )
This should work great and Houdini is AWESOME!!!
So are the staff at SideFX for helping me with this.
Jim
- tamte
- Member
- 8766 posts
- Joined: 7月 2007
- Online
regarding this line
- null object (like any object) has vector parameter Translate, which if you hover over you can say says tx ty tz
so as a parameter tuple its called ‘t’, with actual parameters ‘tx’ ‘ty’ ‘tz’
therefore calling null.parmTuple('t').set() will simply set the values of Translate parameter tuple on the null
- point.position() is local space position of your point within the object
- trn (or node.worldTransform()) is transform matrix holding the world space transform of the object that contains your point
- point.position()*trn transforms local space point position to the world space using objects transform
null.parmTuple('t').set( point.position()*trn )
- null object (like any object) has vector parameter Translate, which if you hover over you can say says tx ty tz
so as a parameter tuple its called ‘t’, with actual parameters ‘tx’ ‘ty’ ‘tz’
therefore calling null.parmTuple('t').set() will simply set the values of Translate parameter tuple on the null
- point.position() is local space position of your point within the object
- trn (or node.worldTransform()) is transform matrix holding the world space transform of the object that contains your point
- point.position()*trn transforms local space point position to the world space using objects transform
Edited by tamte - 2017年12月8日 13:18:47
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- reelinspirations
- Member
- 177 posts
- Joined: 11月 2015
- Offline
- Kenneth Ackerman
- Member
- 1 posts
- Joined: 2月 2015
- Offline
-
- Quick Links