Found 79 posts.
Search results Show results as topic list.
Technical Discussion » For Each on 2 objects
- MathieuLeclaire
- 79 posts
- Offline
Technical Discussion » For Each on 2 objects
- MathieuLeclaire
- 79 posts
- Offline
They are deforming. I just simplified the example.
I also believe the for each loop is unavoidable, but what I'm wondering is if there's a better way to loop through 2 or more objects by name without having to group and merge before entering the loop and splitting each piece up inside the loop. That's the part that feels wrong to me. It feels like I'm taking up extra processing power and extra memory to do this. I'm wondering if there's not a way to simply loop through the first object and inside that loop, call the second (and/or more) object(s) and tell it to isolate the piece that's matching the first object's name inside the loop… but maybe that's not possible? I don't know. That's why I'm asking.
I also believe the for each loop is unavoidable, but what I'm wondering is if there's a better way to loop through 2 or more objects by name without having to group and merge before entering the loop and splitting each piece up inside the loop. That's the part that feels wrong to me. It feels like I'm taking up extra processing power and extra memory to do this. I'm wondering if there's not a way to simply loop through the first object and inside that loop, call the second (and/or more) object(s) and tell it to isolate the piece that's matching the first object's name inside the loop… but maybe that's not possible? I don't know. That's why I'm asking.
Technical Discussion » For Each on 2 objects
- MathieuLeclaire
- 79 posts
- Offline
Yes, this works… but now I face a different situation where this approach does not work. I'm trying to pointdeform piece by piece while I have overlapping pieces :
This is the hi res mesh…
Whose name attribute match the lo res animation…
But if I simply do a pointdeform of the whole thing…
I'll get some stretching because of the overlapping pieces at their rest state…
So I need to use a for each loop to pointdeform the mesh piece by piece…
And that gives me a proper deformation…
But I'm not sure the group/merge/blast workflow is the optimal way of doing this. I feel like I'm taking up a lot of extra memory when all I need is to reference to the matching piece of the second geometry inside the loop. This is a simple example with just 2 meshes, but I have hundreds, maybe even thousands of pieces to process in my set-up and I'm trying to figure out the most optimal way of doing something like this.
This is the hi res mesh…
Whose name attribute match the lo res animation…
But if I simply do a pointdeform of the whole thing…
I'll get some stretching because of the overlapping pieces at their rest state…
So I need to use a for each loop to pointdeform the mesh piece by piece…
And that gives me a proper deformation…
But I'm not sure the group/merge/blast workflow is the optimal way of doing this. I feel like I'm taking up a lot of extra memory when all I need is to reference to the matching piece of the second geometry inside the loop. This is a simple example with just 2 meshes, but I have hundreds, maybe even thousands of pieces to process in my set-up and I'm trying to figure out the most optimal way of doing something like this.
Technical Discussion » For Each on 2 objects
- MathieuLeclaire
- 79 posts
- Offline
So I have 2 objects that contains a bunch of “Pieces” sharing an attribute “name” and I want to copy some attributes from one object to the next. The problem is that the order of the pieces don't match, so I can't simply use and Attribute Wrangle to copy data from one to the next because point order don't match. So I want to use a For Each loop to iterate through all the pieces to isolate each matching pieces so I can copy the data piece by piece.
For Each loops on the first object by it's “name” attribute, but I can't figure out the most efficient way to extract the same piece on the second mesh.
The only way I was able to make this work is by creating groups and merge the 2 objects to then separate them using a Blast inside the For Each loop. Merging and Blasting don't feel like a very optimized way of working though. There must be a more efficient way to do this !?
I tried using an expression on a Blast node plugged on the second object to fetch the Metadata value from the iteration to isolate the matching piece, but I get some very inconsistent results. I thought maybe a Fetch Input would do the trick, but no such luck there either. There must be a better way to do this !?
Any suggestion on how I can match 2 pieces from 2 different meshes in a For Each loop (other then the group/merge/blast technique explained earlier)?
For Each loops on the first object by it's “name” attribute, but I can't figure out the most efficient way to extract the same piece on the second mesh.
The only way I was able to make this work is by creating groups and merge the 2 objects to then separate them using a Blast inside the For Each loop. Merging and Blasting don't feel like a very optimized way of working though. There must be a more efficient way to do this !?
I tried using an expression on a Blast node plugged on the second object to fetch the Metadata value from the iteration to isolate the matching piece, but I get some very inconsistent results. I thought maybe a Fetch Input would do the trick, but no such luck there either. There must be a better way to do this !?
Any suggestion on how I can match 2 pieces from 2 different meshes in a For Each loop (other then the group/merge/blast technique explained earlier)?
Technical Discussion » Overlapping Finite Elements
- MathieuLeclaire
- 79 posts
- Offline
Yes. This helps a lot. It works perfectly. Thank you.
Now I'm just wondering if there's a way to tell the simulation that if two objects are overlapping, to push each other apart?
Now I'm just wondering if there's a way to tell the simulation that if two objects are overlapping, to push each other apart?
Technical Discussion » Overlapping Finite Elements
- MathieuLeclaire
- 79 posts
- Offline
So I want to convert some geometry to simulate them as solid objects using the finite element solver. The problem is I have many objects and some of them are overlapping:
When I create the tetra mesh using the solidembeded node, it treats the two object as one object:
So instead I use a for each loop to create separate tetra meshes:
Then these meshes are animated and I want the solid object to follow the animation as closely as it can while colliding with it's environment. To do this, I pointdeform each tetra by it's animated geometry inside a for each loop again and I use that result as the Target Deformation in the Solid Object DOP.
That works ratter well as each tetra object are simulated like separate objects :
The problem is when the dopimport_embedded deforms the actual mesh, it stretches the parts that were overlapping:
It looks like all tetras will deform all meshes as if they were one object instead of treating them separately. Is there a way to split them up so each tetra deforms only it's associated mesh instead?
Now these are two simple meshes to illustrate the problem, but my actual scene is full of intertwined meshes. I thought of doing a pre-roll process where we make sure each object is never overlapping and they slowly settle back into the start position, but because of the nature of the geometry being intertwined (imagine a ton of electrical wires crisscrossing), it's very difficult to animate a pre-roll that would settle to the desired shape. That's why I'm hoping I can avoid this by figuring out a way to deform each mesh one by one using it's designated tetra mesh instead.
Also a side question: Assuming the above scenario can be done, is there a way to make the finite element simulation push out overlapping tetra so they find a stable state with no overlapping at the beginning of the simulation? Right now, the simulation doesn't seem to care that they are overlapping until they separate and collide again later on.
When I create the tetra mesh using the solidembeded node, it treats the two object as one object:
So instead I use a for each loop to create separate tetra meshes:
Then these meshes are animated and I want the solid object to follow the animation as closely as it can while colliding with it's environment. To do this, I pointdeform each tetra by it's animated geometry inside a for each loop again and I use that result as the Target Deformation in the Solid Object DOP.
That works ratter well as each tetra object are simulated like separate objects :
The problem is when the dopimport_embedded deforms the actual mesh, it stretches the parts that were overlapping:
It looks like all tetras will deform all meshes as if they were one object instead of treating them separately. Is there a way to split them up so each tetra deforms only it's associated mesh instead?
Now these are two simple meshes to illustrate the problem, but my actual scene is full of intertwined meshes. I thought of doing a pre-roll process where we make sure each object is never overlapping and they slowly settle back into the start position, but because of the nature of the geometry being intertwined (imagine a ton of electrical wires crisscrossing), it's very difficult to animate a pre-roll that would settle to the desired shape. That's why I'm hoping I can avoid this by figuring out a way to deform each mesh one by one using it's designated tetra mesh instead.
Also a side question: Assuming the above scenario can be done, is there a way to make the finite element simulation push out overlapping tetra so they find a stable state with no overlapping at the beginning of the simulation? Right now, the simulation doesn't seem to care that they are overlapping until they separate and collide again later on.
Technical Discussion » Check for unpack?
- MathieuLeclaire
- 79 posts
- Offline
We are rendering with Arnold so all our meshes must be unpacked. We have an unpack node at the very end of our SOPs to make sure the meshes are unpacked. Sometimes our users might unpack our meshes or part of our meshes to manipulate point attributes before it reaches our unpack node.
I'm wondering what would be quicker : Should we just leave the unpack there and at worst case, it unpacks something that already is unpacked or would it be quicker to check through the mesh to find if/which are packed and only unpack those? Like should I create an Attribute Wrangle that creates a group based on the instrinsics typename and operate the unpack just on that group or is it going to be as fast to simply leave the unpack node there and let it do it's thing?
I'm wondering what would be quicker : Should we just leave the unpack there and at worst case, it unpacks something that already is unpacked or would it be quicker to check through the mesh to find if/which are packed and only unpack those? Like should I create an Attribute Wrangle that creates a group based on the instrinsics typename and operate the unpack just on that group or is it going to be as fast to simply leave the unpack node there and let it do it's thing?
Technical Discussion » loop through 2 objects
- MathieuLeclaire
- 79 posts
- Offline
Thanks. I forgot about the backticks. And yes, I was using the actual attribute at first, but since I had forgotten the backticks, I couldn't get it working and I tried to replace the attribute with the prim function wondering if that might be the error and that's the one I copied on this post in the end… but yeah, backticks… gotta get use to that one. I'm still new to Houdini so I need to drill these things in. Thank you for your reply.
Technical Discussion » loop through 2 objects
- MathieuLeclaire
- 79 posts
- Offline
So I have two objects that each have the primitive attribute “id” so we can separate the mesh in sub-objects. If I use a “for each loop” with the Piece Attribute “id”, I can loop through the first object and operate on it… but I want to isolate the mesh from the second object that has the same “id” attribute so I can use just that second mesh sub-object to operate on the first mesh sub-object. I can't figure out how to isolate the matching sub-object from the second mesh as I loop through the first mesh.
I tried to “Create Meta Import Node” to fetch the detail attribute iteration and use that in a Blast to isolate the matching sub-object, but I can't find an expression that works.
I tried that in the Group parameter :
…but it ain't working.
What's the right way to do this?
I tried to “Create Meta Import Node” to fetch the detail attribute iteration and use that in a Blast to isolate the matching sub-object, but I can't find an expression that works.
I tried that in the Group parameter :
prim(0, "id", @primnum)!=detail("../foreach_begin1_metadata1", "value", 0)
…but it ain't working.
What's the right way to do this?
Technical Discussion » Detect if input is packed primitive
- MathieuLeclaire
- 79 posts
- Offline
Technical Discussion » Detect if input is packed primitive
- MathieuLeclaire
- 79 posts
- Offline
Is there a VEX function or some way to detect if the input geometry is either a packed primitive, poly soups or polygons?
Technical Discussion » Copy to points using a path to Houdini Object in the scene
- MathieuLeclaire
- 79 posts
- Offline
Copy Stamp seems to be what I was looking for. I recall reading somewhere though that Copy Stamp is the “old way” of doing this, but I can't seem to find a better way to do this.
Technical Discussion » Copy to points using a path to Houdini Object in the scene
- MathieuLeclaire
- 79 posts
- Offline
I have these points, each containing a path attribute that points towards objects in Houdini (example “/obj/tentA”) and I want to vary the geometry across the copies using that path attribute.
We usually use that to drive instances, but I'm trying to rebuild them as packed primitives inside a mesh instead.
I'm trying to figure out how to pull the geometry to be used in a copy to points sop without having to manually create a ton of object_merge to be used through a switch inside a for each loop. There must be a procedural way to tell the object_merge to pull the object using the point's path attribute instead?
There must be an easier way to do this. Can anyone point me in the right direction?
Thanks.
We usually use that to drive instances, but I'm trying to rebuild them as packed primitives inside a mesh instead.
I'm trying to figure out how to pull the geometry to be used in a copy to points sop without having to manually create a ton of object_merge to be used through a switch inside a for each loop. There must be a procedural way to tell the object_merge to pull the object using the point's path attribute instead?
There must be an easier way to do this. Can anyone point me in the right direction?
Thanks.
Technical Discussion » Verify if object exists in VEX
- MathieuLeclaire
- 79 posts
- Offline
Yeah. That works. I tried that before posting but I forgot to add the “op:” before the path in the npoints function so I always got 0… my bad. I'm good now. Thanks.
Technical Discussion » Verify if object exists in VEX
- MathieuLeclaire
- 79 posts
- Offline
Is there a way to verify if an object exists in your scene using VEX? I'm building paths to objects procedurally but sometime the path to an object is not valid and I would like to detect when that's the case. How can I do that?
Technical Discussion » Copy point position from one alembic object to another with different path order
- MathieuLeclaire
- 79 posts
- Offline
So I have 2 Alembic objects. One has animation and the other has rendering info (UVs, material assignment and various properties assigned). I want to copy the animation to the rendering object. The problem is, the path order don't match, which changes the point order.
Example :
Render has path named :
/asset1/MeshA
/asset1/MeshB
/asset1/MeshC
Animation has path named :
/anim_asset1/controler/MeshB
/anim_asset1/MeshA
/anim_asset1/MeshC
If I unpack, convert and do an attribute wrangle “@P = @opinput1_P;”, the polygons will be connected all wrong because the point order is not the same anymore since rigging in Maya needed to add a controller to control MeshB and that changed the hierarchy and the path order when exporting their animated Alembic.
What's the best way for me to make Houdini copy point position from one mesh to another based on group or path names?
In this easy example, I could simply isolate each group, copy and merge them back together… but what if I'm dealing with thousands of groups? I'm still trying to wrap my head around how to work within groups in VEX. I'd appreciate if someone could point me in the right direction.
Thanks.
Example :
Render has path named :
/asset1/MeshA
/asset1/MeshB
/asset1/MeshC
Animation has path named :
/anim_asset1/controler/MeshB
/anim_asset1/MeshA
/anim_asset1/MeshC
If I unpack, convert and do an attribute wrangle “@P = @opinput1_P;”, the polygons will be connected all wrong because the point order is not the same anymore since rigging in Maya needed to add a controller to control MeshB and that changed the hierarchy and the path order when exporting their animated Alembic.
What's the best way for me to make Houdini copy point position from one mesh to another based on group or path names?
In this easy example, I could simply isolate each group, copy and merge them back together… but what if I'm dealing with thousands of groups? I'm still trying to wrap my head around how to work within groups in VEX. I'd appreciate if someone could point me in the right direction.
Thanks.
Technical Discussion » Compensating transform from the Instance Object
- MathieuLeclaire
- 79 posts
- Offline
Oh boy… that was well hidden. That's definitely the best way to go about this issue, but I'm still wondering what's wrong with my math? If I need to multiply some transform matrices in the future, how do I make sure they give me the desired result?
Technical Discussion » Compensating transform from the Instance Object
- MathieuLeclaire
- 79 posts
- Offline
Hello,
We have this problem with instances:
If you transform the instance object, all the instances transforms as well. I want to prevent that from happening.
Maybe there's a simpler way to achieve this, so please let me know if that's the case, but what I decided to do was to basically multiply the transformation matrix of the instance by the invert of the transformation matrix from it's instance object. That way, it would compensate the transformation and assume the instance object is always in a neutral transform.
So I wrote this VEX code:
…and I'm having issues when I rotate my instance object. It looks like there's an issue with the transform order as it looks like the scale is done relative to the orientation. I tried various transformation order on the instance object transform and on the cracktransform function, but I could never get the instances transform to match the desired result.
Can someone help me figure out what I'm doing wrong?
Thanks.
We have this problem with instances:
If you transform the instance object, all the instances transforms as well. I want to prevent that from happening.
Maybe there's a simpler way to achieve this, so please let me know if that's the case, but what I decided to do was to basically multiply the transformation matrix of the instance by the invert of the transformation matrix from it's instance object. That way, it would compensate the transformation and assume the instance object is always in a neutral transform.
So I wrote this VEX code:
@instance = "/obj/PigHead_Transformed";
matrix m = instance(@P, 0, @scale, 0, @orient, 0);
matrix m2 = invert( optransform(@instance) );
m = m2 * m;
vector trans = cracktransform(0, 0, 0, { 0, 0, 0 }, m);
vector rot = cracktransform(0, 0, 1, { 0, 0, 0 }, m);
vector scale1 = cracktransform(0, 0, 2, { 0, 0, 0 }, m);
@P = trans;
@scale = scale1;
@orient = quaternion((matrix3)m);
…and I'm having issues when I rotate my instance object. It looks like there's an issue with the transform order as it looks like the scale is done relative to the orientation. I tried various transformation order on the instance object transform and on the cracktransform function, but I could never get the instances transform to match the desired result.
Can someone help me figure out what I'm doing wrong?
Thanks.
Houdini Indie and Apprentice » Test position inside geometry in VEX or VOP
- MathieuLeclaire
- 79 posts
- Offline
Hi,
I know I can use a group sop to group points that are inside a geometry, but can such an evaluation be done directly in VEX or VOP context? IS there a function to test if a position vector is inside or outside a geometry?
Thanks.
I know I can use a group sop to group points that are inside a geometry, but can such an evaluation be done directly in VEX or VOP context? IS there a function to test if a position vector is inside or outside a geometry?
Thanks.
-
- Quick Links