n00b - transform pieces around custom point (rot and translate)

Ask questions about how to achieve specific effects, how to work with certain operators, etc.
Post Reply
gum
Posts: 4
Joined: Mon Apr 29, 2024 8:26 pm

n00b - transform pieces around custom point (rot and translate)

Post by gum »

Hi,

please forgive the super n00b question, but I seem to be having a brain fart ...

How would I go about rotating and transforming a set of packed primitive pieces around a custom point (i.e. around their bbox centroid)?

I have gotten the falloff and the transform working but the rotation I can't get to work properly.

I have played around with MopsExplode, MopsReOrient and and setting a custom orient attribute, but no luck so far.

I am trying to create something along the lines of the attachments

thanks mucho
You do not have the required permissions to view the files attached to this post.

User avatar
toadstorm
Site Admin
Posts: 150
Joined: Sun Sep 22, 2019 1:28 pm

Re: n00b - transform pieces around custom point (rot and translate)

Post by toadstorm »

Hey there,

There's two ways you could handle this. For rotating around the bounding box centroid, the easiest way is to just use a Transform SOP with $CEX $CEY and $CEZ as the pivot... it'll transform everything around the centroid, including rotation.

The other way to go is to use MOPs Pivot. You can use Set Pivot (World) mode and set the pivot to any location in world space, or use a VEXpression to set the pivot if you're comfortable with some simple VEX. I'm attaching an example file that shows both methods.
You do not have the required permissions to view the files attached to this post.

gum
Posts: 4
Joined: Mon Apr 29, 2024 8:26 pm

Re: n00b - transform pieces around custom point (rot and translate)

Post by gum »

Heyya Toadstorm,

thanks so much for the quick reply!

Transform SOP with $CEX, ... ,... unfortunately doesn't work here as the rotation axis needs to be different per piece .
(btw Sesi has a Transform from Centroid SOP now via tab menu which is handy)

The mops approach is getting me closer although I still can't get the rotation to be what it needs to be.

I could probably explain better ... Imagine u have a fracture on a windshield that got hit by a passengers head ... a spiderweb fracture that's dented inwards on the center
You do not have the required permissions to view the files attached to this post.

User avatar
toadstorm
Site Admin
Posts: 150
Joined: Sun Sep 22, 2019 1:28 pm

Re: n00b - transform pieces around custom point (rot and translate)

Post by toadstorm »

I'm still not entirely sure this is what you're asking for, but are you trying to align the objects to the deformation as if it were a surface?

This would be a lot easier if you actually had a surface to adhere to, but there's a little trick you can use in this case because you have that nice smooth falloff gradient. I'm converting mops_falloff into a scalar volume using Volume Rasterize Attributes, then using VDB Analysis to compute the gradient... that's basically just a vector that's pointing in the direction of increasing values. I can then use a bit of VEX to sample that vector volume and bind it to an attribute, and then feed that to MOPs Aim to aim the objects along that vector.

If this isn't what you're looking for I'm going to need a much more detailed explanation of what kind of rotation you want.
You do not have the required permissions to view the files attached to this post.

gum
Posts: 4
Joined: Mon Apr 29, 2024 8:26 pm

Re: n00b - transform pieces around custom point (rot and translate)

Post by gum »

Thanks again Toadstorm,

unfortunately not quite what I am trying to do.

Imaging a bunch of pieces like in the image.

I have gotten close with:
- creating a vector @direct which is defined by the fracture centroid location subtracted from each piece's centroid
- creating a vector @up = set(0,1,0);
- creating another vector @rotaxis that is defined by cross(@direct, @up)

@rotaxis is the axis I'd want to rotate each piece around
You do not have the required permissions to view the files attached to this post.

User avatar
toadstorm
Site Admin
Posts: 150
Joined: Sun Sep 22, 2019 1:28 pm

Re: n00b - transform pieces around custom point (rot and translate)

Post by toadstorm »

If you know the axes that you want to rotate around but the packed primitives aren't currently aligned to those axes, you can use MOPs Reorient to override the existing local axes of each piece. Just create that `v@rotaxis` attribute and then set that as the N vector for MOPs Reorient and any rotation around Z will be around that axis.

gum
Posts: 4
Joined: Mon Apr 29, 2024 8:26 pm

Re: n00b - transform pieces around custom point (rot and translate)

Post by gum »

That's it THANKS - I knew it was something simple.

I missed that option with quaternions as default.

Works like a charm now
You do not have the required permissions to view the files attached to this post.

Post Reply