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: 

Select Objects inside Volume

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Christoph_Schaedl
1999 Views, 5 Replies

Select Objects inside Volume

Christoph_Schaedl
Mentor
Mentor

Id like to select all objects inside a Volume.

Lets say inside a cube.

 

Where should i start to get those data?

Do i have to bring in every object in the scene to bifrost?

----------------------------------------------------------------
https://linktr.ee/cg_oglu
0 Likes

Select Objects inside Volume

Id like to select all objects inside a Volume.

Lets say inside a cube.

 

Where should i start to get those data?

Do i have to bring in every object in the scene to bifrost?

----------------------------------------------------------------
https://linktr.ee/cg_oglu
5 REPLIES 5
Message 2 of 6

marcus.nordenstam
Alumni
Alumni
Accepted solution

 

If you want Bifrost to "see" your geometry, then yes, you will have to bring it into a graph.

 

Bifrost cannot currently select anything.  But maybe you can use the output of a graph and feed that to a MEL script command for select or something?  

 

In any event, there are several ways to bring in many geometries and check if they're inside a cube or sphere or some big bounding object.  First of all - the best way to bring in many geometries is using regular expression on an input node.  For more info on this, please take a look at my little FAQ https://forums.autodesk.com/t5/bifrost-forum/faq-for-new-bifrosters/td-p/8920248

 

Once you have an array of geometries coming into you graph, you'll need some way to check if they're inside the bounding geometry.  You can do this in two ways: with polygons or by turning the bounding geometry into a volume.  

 

The polygon way:  Iterate on the incoming geometry array, and for each geometry, get the point_positions.  Then, for each point_position, check that it is on the negative side of the plane defined by ALL polygon faces of the bounding geometry.  This method will be lightweight and fast, assuming the bounding geometry is simple, like a cube.  It will become slow if the bounding geometry has a lot of faces like a high-res sphere or a highly detailed mesh.

 

The volume way: Convert the bounding geometry to a volume, via mesh_to_volume, operating in "solid" mode.  The trick here is that, depending on how exact you want the result to be, you can use quite large values for the detail-size to make it fun faster and use less RAM.  Now, once you have the volume representation of the bounding geo, iterate on every geometry and get the point_positions.  Then use sample_volume, using the property called "voxel_signed_distance".  If this compound returns a positive number, that position is outside the volume.  This method will be faster than the other one, if the bounding geometry has a lot of faces.

 

There may be other ways of doing this, perhaps clever use of closest_locations_on_surface, but the two methods above will work.

 

Marcus

 

 

If you want Bifrost to "see" your geometry, then yes, you will have to bring it into a graph.

 

Bifrost cannot currently select anything.  But maybe you can use the output of a graph and feed that to a MEL script command for select or something?  

 

In any event, there are several ways to bring in many geometries and check if they're inside a cube or sphere or some big bounding object.  First of all - the best way to bring in many geometries is using regular expression on an input node.  For more info on this, please take a look at my little FAQ https://forums.autodesk.com/t5/bifrost-forum/faq-for-new-bifrosters/td-p/8920248

 

Once you have an array of geometries coming into you graph, you'll need some way to check if they're inside the bounding geometry.  You can do this in two ways: with polygons or by turning the bounding geometry into a volume.  

 

The polygon way:  Iterate on the incoming geometry array, and for each geometry, get the point_positions.  Then, for each point_position, check that it is on the negative side of the plane defined by ALL polygon faces of the bounding geometry.  This method will be lightweight and fast, assuming the bounding geometry is simple, like a cube.  It will become slow if the bounding geometry has a lot of faces like a high-res sphere or a highly detailed mesh.

 

The volume way: Convert the bounding geometry to a volume, via mesh_to_volume, operating in "solid" mode.  The trick here is that, depending on how exact you want the result to be, you can use quite large values for the detail-size to make it fun faster and use less RAM.  Now, once you have the volume representation of the bounding geo, iterate on every geometry and get the point_positions.  Then use sample_volume, using the property called "voxel_signed_distance".  If this compound returns a positive number, that position is outside the volume.  This method will be faster than the other one, if the bounding geometry has a lot of faces.

 

There may be other ways of doing this, perhaps clever use of closest_locations_on_surface, but the two methods above will work.

 

Marcus

 

Message 3 of 6

Christoph_Schaedl
Mentor
Mentor

Thanks for the info.

I have to forward this to my TD. To much to calculate for my small brain.

----------------------------------------------------------------
https://linktr.ee/cg_oglu
0 Likes

Thanks for the info.

I have to forward this to my TD. To much to calculate for my small brain.

----------------------------------------------------------------
https://linktr.ee/cg_oglu
Message 4 of 6
Anonymous
in reply to: marcus.nordenstam

Anonymous
Not applicable

thanks for this reply.   i am also trying to check if a point is inside a bounding object, trying the volume method.  how does one use sample_volume?  im trying to use it in an iterate node (for all the points i want to check on) but it seems to take an array

0 Likes

thanks for this reply.   i am also trying to check if a point is inside a bounding object, trying the volume method.  how does one use sample_volume?  im trying to use it in an iterate node (for all the points i want to check on) but it seems to take an array

Message 5 of 6
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

 was able to do this by sampling the fog density at those positions and then grabbing the points that have any fog density

 was able to do this by sampling the fog density at those positions and then grabbing the points that have any fog density

Message 6 of 6
Christoph_Schaedl
in reply to: Anonymous

Christoph_Schaedl
Mentor
Mentor

Hi Mike could you show us your magical Graph?

----------------------------------------------------------------
https://linktr.ee/cg_oglu
0 Likes

Hi Mike could you show us your magical Graph?

----------------------------------------------------------------
https://linktr.ee/cg_oglu

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

Post to forums  

Autodesk Design & Make Report