Move copies on the surface of deforming geometry

   3968   6   2
User Avatar
Member
59 posts
Joined: April 2006
Offline

I am playing with the SpikyDeformingTorus example and I was wondering if there is a way to translate the UVW of the static torus, to make the cones copies move on the surface of the torus.

Thanks!
User Avatar
Member
2555 posts
Joined: June 2008
Offline
There is some information and example HIP files on this site [tokeru.com] about how to instance copies onto deforming geometry. Scroll down the page a bit.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Sounds like a cool effect! Maybe I should add something like that to the example. There are a bunch of ways you could get them to move, but the question is, could you describe the manner in which you want them to move? Do you want them to move roughly along some vector field?

I suppose most approaches for deciding how they'll move would have in common that you'd move the points along the rest geometry, and still use Attribute Interpolate afterward to find the corresponding positions on the deformed geometry, unless you want the deformation itself to be involved in deciding how the points move. To move the points along a vector field, you can advect the points a little, then re-project back to the surface with a Ray SOP (Minimum Distance mode) or Point Relax SOP, then advect some more, and repeat, possibly finishing with a Point Relax SOP (or custom Attribute Wrangle) to make sure that the points don't end up bunched, (assuming you don't want them to be bunched). Hopefully that helps give you some ideas of how to approach it!

Edit: The Ray SOP and Point Relax SOP both have options for outputting primitive number and primitive uvw attributes for where the points ended up, so that's how you'd get the updated values for Attribute Interpolate.
Edited by neil_math_comp - July 30, 2016 23:18:02
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
59 posts
Joined: April 2006
Offline
Thanks for your replies. As I already had a setup based on Attribute Interpolate, I tried to use the Ray SOP, but I encountered a couple of problems. First is the Ray SOP make points pop on and off, and second is that I don't know how to input the new updated values of prim num and prim uv to the Attribute Interpolate. So one could say that I am on my way to something, or that I achieved absolutely nothing

Attachments:
moveOnSurface.hiplc (789.2 KB)

User Avatar
Member
34 posts
Joined: March 2012
Offline
So to find point on mesh surface where to “stick” geometry , you use ray sop , or in vop intersect vop.

Intersect vop will give you information like , prim num , uv(of primitive in question).

You than pipe this info in , primitive attribute node , and can output position attribute from there , and use that to drive geometry with deforming geo.

User Avatar
Member
1743 posts
Joined: March 2012
Offline
Okay, here's an updated version. A few things that needed adjustment:

1) To reduce popping, you need to re-project to the surface on every step of the Solver SOP, else the points will drift farther and farther from the surface until they're closer to a different part of the surface and they'll “jump” there. I just moved the Ray SOP into the Solver SOP and attached the rest geometry to the second input of the Solver SOP so that the Ray SOP could get at it.

2) The Ray SOP needs to output the new primitive number and primitive uvw, so I turned those options on, outputting to hitprim and hitprimuv. Apparently the Ray SOP doesn't like that the previous frame's geometry already has hitprim and hitprimuv, (probably my fault, but probably as a workaround for a bad conflict), so I just added an Attribute Delete SOP before it to remove those attributes before the Ray SOP adds them again. Since they're named hitprim and hitprimuv now, the Attribute Interpolate needs to be updated to use those names, (could have used sourceprim and sourceprimuv, but maybe you'll want to grab something from the original location of each point at some point later, so I kept those separate).

3) The Point Jitter SOP was using the same seed on every frame. It means that each point will move in the same direction on every frame. Maybe that's what you wanted, but I changed the seed to $FF in case it's not what you wanted, and increased the scale parameter a little, just to make the movement more visible again.

4) The Copy needs to come after the Attribute Interpolate, else all of the points on the icosahedra will get the same interpolated position, (i.e. they'll each get squished to a single position). With the Attribute Interpolate coming first, it just interpolates the positions for the template points, then the icosahedra get copied to those points.

Attachments:
moveOnSurface_2.hiplc (791.7 KB)

Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
59 posts
Joined: April 2006
Offline
Thanks so much for the lesson, ndickson!

I went through it and works as I was trying to make it work.
  • Quick Links