PDA

View Full Version : Grounding a defroming mesh



Remoc
07-25-2012, 09:20 AM
Hello Lightwavers,

Is it possible to have the lowest point in a deforming mesh ( deformed via bones or MDD or whatever ) to stay fixed to a ground plane which is at Y=0 on
a frame by frame basis?

ps. The plugins I have found only fix the objects pivot point to the ground.
Also Bullet doesn't support deforming meshes. ( so no luck there )

Is there anyway?

Remoc:help:

evenflcw
07-25-2012, 10:55 AM
EDIT: Apparently I misread. Ignore this post.

RebelHill
07-25-2012, 12:05 PM
Im not so sure about this one.

Im assuming from your post that the lowest point in the deforming mesh will be changing from one frame to the next as the object deforms. So that's gonna require someway to look up the point index of whichever point that is on a given frame.

Problem is, i cant think of an easy way to do this. You can use tools like DPs nearest point in nodal, but that only gives you the nearest point of some other mesh.

I couldnt find a store/get node (and tbh I only looked quickly) that'd pipe this info correctly... but if there is one, then you could add a plane at Y0, lookup nearest point on your deforming mesh, which would give you the lowest point on that object. Store this value, go back to nodal displace for the actual object itself, and get this info for applying a displacement effect to just that one specified point.

Well, that's the closest theoretical way i could think of anyhow.

jeric_synergy
07-25-2012, 12:46 PM
RH, I don't rightly know, but I saw Briphy use a Pom's Nodes node to store values, so maybe there's something in that package.

RebelHill
07-25-2012, 12:59 PM
Yeah... Pom did have a get/store... I jsut had a quick look at the DP ones (which are really for a different purpose). Might be worth checking out the Pom ones, if you can pipe the found point index from the one editor to the other, then that should be it.

Sensei
07-25-2012, 01:10 PM
This task really can't be done reliable way if it's not done using Master plugin class, because LW has no modifier/history stack..
Somebody must have write Master which is listening for events from meshes, which are send after processing mesh, then scan all points in mesh, and moving item down until bottom most point has Y = 0..

RebelHill
07-25-2012, 01:40 PM
Ahh... see, now sensei throws another explanation of the OP into the mix... that what you're wanting to do is to move the ENTIRE mesh down until the lowest point hits Y0...

Thats a whole different kettle of fish...

Lemme think on that.

Edit... Ok thought... Well, the process would essentially be little different. use the pipe through method to find which the lowest point is, but also take the distance to that point from the ground... Then back in the main objects displace nodes just displace the entire mesh on Y only by the negative of that amount.

SplineGod
07-25-2012, 01:43 PM
Possibly if the mesh is deforming except for a point or small group of points that stay the same throughout the displacement and use that as the part to anchor, esp if the deformations are done relative to those static points.

Sensei
07-25-2012, 01:58 PM
If mesh wouldn't deform I could suggest using TrueArt's Node Library Extended Item Info, which has Item Box Min/Max vectors inside of Motion or Deform Node Editor to move all vertexes in Y axis.

Otherwise you can bake MDD of whole anim, then use Extended Item Info node setup to move it to ground.

RebelHill
07-25-2012, 02:16 PM
I thought of turning to your bounding box node info as a possible other than trying to look up the specific point directly... is there a way though to get how far from Y0 the bottom face of the bounding box is, rather than the dimensions of the box itself??

AbstractTech3D
07-25-2012, 02:32 PM
Interesting question. With the right solution to this I guess you could solve problems of feet passing through floors from character animation and mocap, and extending it - removing feet sliding etc...

RebelHill
07-25-2012, 02:45 PM
Hmmm... not really as that's fairly different. First off feet slide is particularly tricky, as the computer can have no possible way to know if a foot is planted on the ground with body weight on it, or is just touching the ground and free to perform small movements. then ofc there's the issue of foot pose... is the foot still planted after the ankle lifts, after the toe?? it could vary across a whole animation. Ive yet to see anything, including MB, that has an auto system for locking down feet without some kind of user intervention to tell it when specifically to do so. (Ok, well MB does have such a feature, but only in "actor" mode, which is when marker based mocap is translated into bone based animation... and its a lil different to what you're thinking).

As for feet penetrating the ground, that's doable, for sure... BUT... with mocap such things are usually due to tracking anomalies, so the problem with raising the whole mesh till the bottom most point hits Y0 could then introduce lil pops up on Y at the hips (effectively)... simply tranferring the problem up a lil bit in space.

For ground penetration prevention... its pretty easy, you just need an input control rig with the mocap, that can then be constrained. You can do this is MB easy, just by checking the feet floor contact which is built into the character constraint. But, you could also do the same in LW using my RHiggit fbxIK rig... bake the input bone anim to the IK rig, grab the IKfoot goals, and hit position limits in motion options, boom...

Remoc
07-25-2012, 07:04 PM
Thankyou all for your responses.

I want to try Sensei's solution :

Otherwise you can bake MDD of whole anim, then use Extended Item Info node setup to move it to ground.

But I ain't so good with nodes. Which to connect to which?

I have attached a screen grab. ( hope I am in the right panel )

Remoc

jeric_synergy
07-25-2012, 07:12 PM
Didn't we recently go thru this question? More of a bounding box issue....????

Seems like "World Bounding Box" (copyright!) would maybe be useful in general.

Sensei
07-26-2012, 12:14 AM
You need to extract Y channel from Box Min using Split Vector or so, then negate Y, so instead of +Y, there will -Y etc. Then Make Vector again. And plug to Displacement input.

jeric_synergy
07-26-2012, 12:43 AM
If anybody gets this working, it would be informative to see a sample.

adk
07-26-2012, 01:05 AM
... cheers Sensei, this is the coolset think I've learned in a while :thumbsup:
even cooler is when you try to rotate it.

Sensei
07-26-2012, 01:18 AM
That seems to be working..

http://forums.newtek.com/attachment.php?attachmentid=105774&stc=1&d=1343287192

http://forums.newtek.com/attachment.php?attachmentid=105775&stc=1&d=1343287192

Sensei
07-26-2012, 03:24 AM
... cheers Sensei, this is the coolset think I've learned in a while :thumbsup:

http://forums.newtek.com/attachment.php?attachmentid=105776&d=1343287230

D'oh.. That's not what I suggested.. :p

You might confuse beginners with this.. I wanted to use Math > Scalar > Multiply, then Tools > Make Vector with just Y attached.

Because scalar connected to vector input will propagate to the all axes..
Or you used X and Z = 0 in Math > Vector > Multiply? But you have to clearly say so in the post, otherwise people will be confused and will start using such setups without success (because X and Z will be trashed)..



even cooler is when you try to rotate it.

Indeed very nice effect. Better than mine.

But I found problem- LWItemInfo->param() is not working correctly when it's called from multiple threads (so there is needed turning off Threaded Mesh Eval).
Box Min/Max vectors are coming from LWObjectInfo and apparently are working fine (but World Position etc. are coming from LWItemInfo).

Remoc
07-26-2012, 07:01 AM
Cool it works. I have attached a screencap.

Works with Threaded Mesh Eval on.

It also works when I use MDD reader & turn Apply Cache to: Object Space

Suddenly I can see many uses for this I hadn't thought of.

Remoc

Sensei
07-26-2012, 07:07 AM
There is no sense of adding 0,0,0..



Works with Threaded Mesh Eval on.

If you would use World Position and LW v11.0.2 you would see what I mean..

Box Min/Max are fine.

jeric_synergy
07-26-2012, 08:33 AM
... cheers Sensei, this is the coolset think I've learned in a while :thumbsup:
even cooler is when you try to rotate it.
Oooooo, well done!

jeric_synergy
07-26-2012, 10:29 AM
Cool it works. I have attached a screencap.
Suddenly I can see many uses for this I hadn't thought of.

Remoc
Remoc, thanks for including the contents of the Multiply and Add nodes in your screen cap. Makes a BIG difference in understandability.
:thumbsup:

adk
07-26-2012, 05:11 PM
D'oh.. That's not what I suggested.. :p

You might confuse beginners with this.. I wanted to use Math > Scalar > Multiply, then Tools > Make Vector with just Y attached.



I really should put a disclaimer into all my nodal postings
"Nodal noob at play ... you might experience, bumps, confusion & nausea"

Alas, I am one of those begginers Sensei so those little tips/explanations you posted are also valuable to me.

... the fact that I got it working, albeit way differently to what you actually suggested, is credit to your initial explanation :thumbsup:



Because scalar connected to vector input will propagate to the all axes..
Or you used X and Z = 0 in Math > Vector > Multiply? But you have to clearly say so in the post, otherwise people will be confused and will start using such setups without success (because X and Z will be trashed)..


That is correct indeed X and Z = 0 ... sorry about any confusion folks. I literally got this working, made the gifs, & flew out the door.

Never ever clicked that scalar>vector propagates to all axes, even when only one scalar is used :foreheads

The vector add is there so I could tweak the "y" value as my mesh does not initially rest on the ground.

Threaded mesh eval. works for me but my setup is different to yours.


Regardless, this is a very handy little setup, so thanks to all for the insight, hints & clues. Much appreciated.

jeric_synergy
07-26-2012, 06:39 PM
That is correct indeed X and Z = 0 ... sorry about any confusion folks. I literally got this working, made the gifs, & flew out the door.
Understood. Another poster included the option panels that make it clear (that's a nice graphic technique s/he used).

You were rushed, but w/o the numbers it can be pretty mystifying what's going on. :beerchug:

Thanks for posting the solution, and it IS very interesting that Sensei thought one way, but another way worked also!

adk
07-26-2012, 07:07 PM
This also works ok with undulating terrain ... granting a few descrepancies where bounding box / world position / undulations don't stack up very well. Still, I would have loved to have this set up many moons ago when I needed to ground 100's of individual buildings (parts) onto some funky terrain.

One is similar to my dodgy setup the other is Sensei's

The last add node in both cases is where you need to visually tweak/adjust it's value in order to ground the object on the first frame. Rest takes care of itself.
Plus as Remoc mentions - Before World Displacement needs to be selected for any of this to work.


PS: Oh crap ... forgot the disclaimer ... :)

"Nodal noob at play ... you might experience bumps, confusion & nausea"

jeric_synergy
07-26-2012, 07:34 PM
Cool: what happens if you apply a wave texture as displacement to that landscape?

adk
07-26-2012, 08:24 PM
Cool: what happens if you apply a wave texture as displacement to that landscape?

What happens is ... pretty cool !
Keep in mind this will not be perfect as the combo of bounding box / raycast from world position / terrain undulation at that location might work against each other. All in all tho, it's pretty good :thumbsup:

jeric_synergy
07-26-2012, 08:28 PM
Maybe slow that down a bit so it's more apparent what's going on?

(Or just package the scene and we'all'll render to our eyeballs capabilities.....)

I hoped it would react to a dynamic mesh! Huzzah, good job on all!

adk
07-26-2012, 08:40 PM
Maybe slow that down a bit so it's more apparent what's going on?

(Or just package the scene and we'all'll render to our eyeballs capabilities.....)

I hoped it would react to a dynamic mesh! Huzzah, good job on all!

... it's cause I always try to keep things relatively small for the forum.

Here's the scene.

jeric_synergy
07-26-2012, 09:45 PM
... it's cause I always try to keep things relatively small for the forum.

Here's the scene.
Excellent! Thank you!

Sensei
07-27-2012, 01:15 AM
The vector add is there so I could tweak the "y" value as my mesh does not initially rest on the ground.

Because you should use World Position from Item Info instead of constant value.. ;)

Otherwise moving item won't rest on ground. Especially if it'll be moving initially in Y in key framed motion.

Sensei
07-27-2012, 01:21 AM
If it would be in Surface Node Editor, user could use Ray Cast node to find out distance from bottom of object to the ground (ray origin = item bottom, ray direction = 0,-1,0).. But in Displacements I doubt this function is available. For 99.9% I am sure ray-cast can't be used.

adk
07-27-2012, 02:01 AM
If it would be in Surface Node Editor, user could use Ray Cast node to find out distance from bottom of object to the ground (ray origin = item bottom, ray direction = 0,-1,0).. But in Displacements I doubt this function is available. For 99.9% I am sure ray-cast can't be used.

... I just typed "ray" into the search field, DP Ray intersect popped up so I used that. I know that in surface editor I have options for others, which to me means they are/would be specific to their usage.

Seems to work in this case. At least from what I can gather with regard to what the nodes are doing.