Community
Bifrost Forum
Welcome to the Bifrost Forum. This is the place for artists using Bifrost to ask and answer questions, browse popular topics, and share knowledge about creating effects procedurally using Bifrost. You can also visit the Bifrost Community on AREA to download an array of ready-to-use graphs, read Bifrost news and updates, and find the latest tutorials.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

accessing trasnformations and object properties

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
userX4542
2422 Views, 11 Replies

accessing trasnformations and object properties

Hey everyone. Simple questions - 

 

What's the best way to access an object's transformation values (scale, translate, rotate) or any other value for that matter. I see there's a get_geo_property node, a get_property node and a get_propery_any node. What's the difference between these nodes and how do I use them in a graph?

 

Thanks,

 

Callum

11 REPLIES 11
Message 2 of 12
mjcg91
in reply to: userX4542

I'll let someone else explain the different property nodes because it can get a bit technical, but mostly you want to use the get_geo_property.

As for transforms, you need to create an input port and connect it to the transform node manually. either the matrix (float 4x4), or each individual component, depending on what you want to do.

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 3 of 12
syracoj
in reply to: userX4542


@userX4542 wrote:

Hey everyone. Simple questions - 

 

What's the best way to access an object's transformation values (scale, translate, rotate) or any other value for that matter. I see there's a get_geo_property node, a get_property node and a get_propery_any node. What's the difference between these nodes and how do I use them in a graph?

 

Thanks,

 

Callum


The get_geo_property node uses the get_property node. And the get_property node uses the get_property_any node.

You shouldn't have to concern yourself too much with the get_property and get_property_any nodes (they are lower level nodes that were necessary to appropriately develop the get_geo_property node).

 

If you Input by Path a Maya object (like a poly sphere) into the graph (via: MMB drag and drop the object from the outliner to the graph) and then connect this nodes port to the output node you can set a watchpoint on the connection line by right clicking and doing "Add Watchpoint". When the watchpoint is created you will see a table of data. You will notice that the left column of this table has a list of properties.

 

It is these properties that you can fetch or 'get' with the get_geo_property node. You are getting that geometries property. 

 

On the get_geo_property node you will see that it takes a Bifrost Object input, a data Type and the property name.

 

If you plug in the polyObject from the Input by Path, then specify point_position as the property, and then connect a value node of type array<Math::float3> then you have essentially grabbed the point_positions of that input object in which you can do stuff to it.

 

see attached image.

 

simpleXformExample.png

 

To access an objects transforms one can also pass in the object matrix or world matrix (or inverse matrix) data from the transform or shape of the DG object. This will require one to create a matrix4x4 port inside the bifrostGraph prior to making the DG connection.

 

Message 4 of 12
userX4542
in reply to: syracoj

thanks, that makes sense. I will take a look try what you suggested.

Message 5 of 12
userX4542
in reply to: syracoj

Okay, the get_geo_property makes sense to me now. I was confused about the syntax for the property name but now I understand that you can see properties and their names in the watchpoint.

Unfortunately I still don't understand how I can access the translate, rotate and scale values when I drag the transform node into the graph. I only get a mesh output point. Is there a button for that? haha

Message 6 of 12
syracoj
in reply to: userX4542


@userX4542 wrote:

Okay, the get_geo_property makes sense to me now. I was confused about the syntax for the property name but now I understand that you can see properties and their names in the watchpoint.

Unfortunately I still don't understand how I can access the translate, rotate and scale values when I drag the transform node into the graph. I only get a mesh output point. Is there a button for that? haha


When you drag in the transform of the object from the outliner to the bifrost graph you do not actually get the transform node. This just conveniently inputs the full Dag path of that object: /pObject1/pObjectShape1 while making connections(behind the scenes) between the pObjectShape1.worldMesh[0] to the input of the bifrostGraph.

 

we currently do not offer a "get the xform of the object" for free. This has to be manually setup by the user. You can pass in the xform of the object via its matrix attributes manually. If you want transform control built into the graph then you can follow the example I had included in the attached image of my last post. There may be design intention in the future to offer a more elegant means to pass in the xform of any given object, but currently you have to do it by hand.

 

Message 7 of 12
syracoj
in reply to: userX4542

attached image shows creating a float4x4 input in the bifrostGraph then connectAttr the polyObject.worldMatrix[0] to the in matrix of the graph.

 

inside the graph I created a matrix_to_SRT node (which handles all the math for you) and then piped out the SRT members and added watchpoints so that you can see how the in viewport transform of the polyobject results in the values seen inside the bifrostGraph.

 

inMatrixExample.png

 

Message 8 of 12
userX4542
in reply to: syracoj

Thanks, I now understand how you managed to get to that point in the first image. It's good to know you pipe in some data from the node editor and then reconstruct it in bifrost using the matrix to srt node in your image. 

Message 9 of 12
bhall
in reply to: userX4542

Can you give some insight on performing this type of translation for a VDB? Currently I can resample the VDB to scale and transform but cannot get it to rotate. I don't know what to do to get the Xform info from it.

Message 10 of 12
syracoj
in reply to: bhall

Use the resample_volume with the following xform setup.

 

useResampleVolume.png

quick check on read_openVDB as a input in bifrost 2.0.5.1 reveals it works on the vdb also.

 

andSeemsToWorkWithReadOpenVDB.png

Message 11 of 12
bhall
in reply to: syracoj

So I hooked it up the way you have in the image. The only difference was that I don't get a 'Rotation' option on my pTorusShape1. When I hook to 'degrees_to_radians' I only have 'Degrees'. Everything else hooks up and without the transform attached from the 'SRT_to_matrix' to the 'resample_volume' the volume is present. When its hooked up, the volume disappears. I tried to follow what you had set up with the matrix being attached in the the earlier post but couldn't get the pTorus World Matrix to attach to the bif. All it had was a mesh input in the connection editor.VDB xForm 1.PNG

 

Message 12 of 12
syracoj
in reply to: bhall

right click on the degrees port on the input node and set the data type to float3. Then right click again on the degrees port and rename it rotation.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report