Jump to content

Looping points movement along complex surface


Recommended Posts

Hello,

 

The title may be not that clear so rather then tell, I will show what I need to achieve first and then I will describe my approach (or better say approacheS, because I have been banging my head against the wall for quite some time with this). So basically here is what I need (did this quick and dirty animation in C4D): https://www.dropbox.com/home?preview=test.mp4

Now the tricky part is that this animation has to loop.

 

Initially I started in C4D. Made some particles crawling along the surface of the statue, cloned some primitives on those particles and applied dynamics. It all works great but how do I loop it.

 

Simulations are are very tricky to loop (especially in C4D) so I decided to go the Houdini way and try to build procedural setup that would give me similar result. My initial thoughts of the setup are the following:

- scatter points on statue

- make them move with the noise and use (minpos() function to stick them to the surface), and use periodic noise so the movement can be easily looped.

- every frame attribute transfer normals of the statue to the moving points, so that when I copy objects they will be aligned to the surface

- copy objects onto points and make sure there transformation axis is at the bottom so that when copied they appear on the surface of the statue

- check for intersections with the statue (still not sure how to approach it but as far as I remember there is a way to see if two meshes intersect or not

- if they intersect, move the object away from the statue along the normal of the point it is copied onto (I think this will have to be done in solver so that I move it slightly and then check for intersections again, because the distance the object has to be moved may differ)

- I still do not know how to avoid intersection between all the objects on the statue themselves ( do not have any ideas so far)

 

For now I am stuck on trying to loop the movement of the points. I can loop them easily in 3D space but when I minpos() them on to the surface they jump from time to time. I understand why this happens but can't figure out how to avoid it. I tried attrib transfering the normals of the statue to the points every frame (in solver) and then calculating the cross product between normal of the point and vector generated bu the noise. This gives pretty smooth movement but the loop breaks of course as you may have guessed.

Anyway, thanks for reading this far. If you have any ideas on how to make it work, please let me know, I appreciate any input. I have posted same question on the SideFx Forums on friday but it is still been reviewed (takes so long). Maybe I am overthinking things and there is easier way to do it say in C4D, in case you know it, please let me know. And do you think my thinking process is somewhat right?

 

Looking forward to any help.

Have a great day everyone!

Link to comment
Share on other sites

Your file attachment is broken.

This is a tricky problem because the only way to *procedurally* move objects along a surface in three dimensions like this is without snapping to have a perfectly parameterized surface... meaning, it's either NURBS or it has a flawless UV layout. If you could hide your UV seams, it might be possible to have your simulation happen in UV space (literally, set @P = v@uv on the mesh after converting your uv attribute to Point), then use xyzdist() to get the primnum and primuv on the flattened mesh for each point, then fetch P and N/up from the original mesh and set your copy points to have that P, N, up. When your objects cross UV boundaries, though, they'll jump.

If you were running this in a solver, maybe you could store the original P/N/up of each copy point when the solver starts, and after a specified amount of time start pushing points towards their goal positions instead of just moving in a straight line along the surface? It'd probably take some cleanup work to get them to not look like they're accelerating and decelerating, but in reality on a complex surface it's going to be really hard to get an absolutely perfect loop with no speed changes at all.

 

Link to comment
Share on other sites

7 minutes ago, toadstorm said:

Your file attachment is broken.

This is a tricky problem because the only way to *procedurally* move objects along a surface in three dimensions like this is without snapping to have a perfectly parameterized surface... meaning, it's either NURBS or it has a flawless UV layout. If you could hide your UV seams, it might be possible to have your simulation happen in UV space (literally, set @P = v@uv on the mesh after converting your uv attribute to Point), then use xyzdist() to get the primnum and primuv on the flattened mesh for each point, then fetch P and N/up from the original mesh and set your copy points to have that P, N, up. When your objects cross UV boundaries, though, they'll jump.

If you were running this in a solver, maybe you could store the original P/N/up of each copy point when the solver starts, and after a specified amount of time start pushing points towards their goal positions instead of just moving in a straight line along the surface? It'd probably take some cleanup work to get them to not look like they're accelerating and decelerating, but in reality on a complex surface it's going to be really hard to get an absolutely perfect loop with no speed changes at all.

 

First of all thank you very much for taking the time to reply.

Creating perfect UVs and hiding the seams is going to be really hard I think, cause the model is 3D scanned and consists of a bunch of triangles (though I am not experienced in UV unwrapping enough, so I may be mistaken, and maybe there is an easy way. I will do a research).

My other idea was to create several random distorted circles, 1 for each point, and project them onto the surface of the statue. Or draw them by hand and make them closed. Then move the points along these closed polylines using U attribute. Do you think it may work?

What about intersections part? Any advice on how to better prevent the objects from intersecting with the sculpture? If I am going to create the paths for the initial points manually, I think intersections between the objects themselves is not going to be an issue because I can tweak them to avoid each other. But what about the intersection with the statue? Obviously making things dynamic is not an option as I won't be able to control them and create a perfect loop.

Link to comment
Share on other sites

Creating paths projected onto the surface is an interesting idea, and that would certainly make the looping process easier. You could maybe use the Detangle SOP to remove most of the intersections, then re-project onto the surface.

To prevent the objects from intersecting with the statue itself... I'm not sure what your statue looks like, but if the pivot point of the objects you're copying is set so that the objects just rest on the surface, you shouldn't have to do anything special there. You can just move your source object in space before copying if you're packing them at the origin, or edit the v@pivot attribute on your template points.

Link to comment
Share on other sites

16 hours ago, toadstorm said:

Creating paths projected onto the surface is an interesting idea, and that would certainly make the looping process easier. You could maybe use the Detangle SOP to remove most of the intersections, then re-project onto the surface.

To prevent the objects from intersecting with the statue itself... I'm not sure what your statue looks like, but if the pivot point of the objects you're copying is set so that the objects just rest on the surface, you shouldn't have to do anything special there. You can just move your source object in space before copying if you're packing them at the origin, or edit the v@pivot attribute on your template points.

To see what it is going to looks like, please see the attached image. It is not the final result, just a quick test scene with a free 3Dscanned statue. Some objects on the statue are going to be pretty big. So even if they do not intersect with the statue at the position of the points they are copied on, the may intersect anyway. Say the large box is copied to the point, which is on the neck. It won't intersect with the neck, but because it is so big, it will intersect with head and maybe back or shoulders.

CINEMA_4D_2018-12-04_13-30-56.png

Link to comment
Share on other sites

I wouldn't even begin to know how to resolve collisions like that procedurally... you'd have to do this as a rigid body sim, which is going to make looping difficult. 

My advice would just be to fake it- either plan your objects and paths carefully so these intersections don't happen, or do some tweaks after the animation/simulation to hide or correct anything that doesn't appear to loop properly.

Link to comment
Share on other sites

24 minutes ago, toadstorm said:

I wouldn't even begin to know how to resolve collisions like that procedurally... you'd have to do this as a rigid body sim, which is going to make looping difficult. 

My advice would just be to fake it- either plan your objects and paths carefully so these intersections don't happen, or do some tweaks after the animation/simulation to hide or correct anything that doesn't appear to loop properly.

Trying this out now. I have managed to create a couple of test paths and it works perfect. Very simple to create those paths too, thanks to the built in Projection in the Drawcurve node. And the good thing is that I can draw all my paths in one Node and post-process them all together. As for the intersections part, it is very tricky. Can't figure it out for now. Maybe will have to deal with that problem afterwords. Though I am not sure have to do it yet. One thing I can think of right now to make it procedural is to somehow smooth out the curvature of the statue. But I have to do it only to the cavities to even the mesh out but at the same time keep all convexity. Will try to figure it out. If nothing works then will be trying to fix intersections manually afterwords.

Anyway, thanks a lot for the help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...