Raycast by camera instead of direction

40 views
Skip to first unread message

Jimmy Marrero

unread,
Jun 18, 2013, 11:26:32 AM6/18/13
to soft...@listproc.autodesk.com
Hey guys
I am using the footprint deformation in ICE and was wondering if there is a way to align the Raycast to match the direction of my camera. I am testing it currently on a sphere, I want to be able to rotate around the sphere and have the deformation appear consistent around the object instead of the current way of just deforming on a particular axis.

Any help appreciated.
Thanks


Jimmy

Christian Gotzinger

unread,
Jun 18, 2013, 11:52:46 AM6/18/13
to soft...@listproc.autodesk.com
As the direction you vector you can use the vector from your camera position to the object. You simply subtract one position from the other:
yourobject.kine.global.pos MINUS camera.kine.global.pos (and plug the result into the raycast)

Jimmy Marrero

unread,
Jun 19, 2013, 10:42:31 AM6/19/13
to soft...@listproc.autodesk.com
Thanks so much worked like a charm

Raffaele Fragapane

unread,
Jun 19, 2013, 7:05:01 PM6/19/13
to soft...@listproc.autodesk.com
That will quickly go down a drain the moment you have deformations pushing the character off its centre, creating swimming effects.

It's ok for contained portions of static terrain probably, but a more reliable solution emulating raytracing the fragment should work off the sampled point you're working on, or the nearest discrete sample if you want to go grid.
--
Our users will know fear and cower before our software! Ship it! Ship it and let them flee like the dogs they are!

Jimmy Marrero

unread,
Jun 20, 2013, 8:53:34 PM6/20/13
to soft...@listproc.autodesk.com

Raff you were absolutely right, I am.having that exact issue.
What im trying to achieve is something like a golf ball effect. Where spheres fly in and create an indentation on a master sphere.  Where the indentations are toward the master spheres center.

Any ideas??
Thanks again for all.your help
Jim

Raffaele Fragapane

unread,
Jun 20, 2013, 9:03:44 PM6/20/13
to soft...@listproc.autodesk.com
So is the problem you are trying to solve one of a denting operator? Like something where one object(s) deforms (dents) another based on intersection/collision?
Can you simulate?


I'm not 100% sure why you would be working off the camer if it was the above, so I suspect I might not quite be getting the right idea of what you're trying to do.

Matt Lind

unread,
Jun 20, 2013, 9:13:43 PM6/20/13
to soft...@listproc.autodesk.com

What you need to do is determine if the tiny sphere penetrates the master sphere.  You can do that by computing the vector starting at the tiny sphere’s center and pointing towards the master sphere’s center, then measure its length.  Computing the vector is a subtraction of tiny sphere’s global position from the master sphere’s global position.  If its length is less than tiny_sphere_radius + master_sphere_radius, the tiny sphere has penetrated.  

 

How the dent is performed on the master sphere really depends on the effect you want.  If you want total friction, then you push the master’s vertices in the direction of travel by the tiny sphere.  If you want a friction free dent, then you’ll likely push the vertices along the tiny sphere’s surface normal at point of contact.  The former will gouge the master sphere’s surface like a meteor impact dragging the mud along the path of travel, the latter will create an elastic dent like when you try to poke your finger through an inflated balloon.

 

 

Matt

Andy Moorer

unread,
Jun 20, 2013, 11:20:48 PM6/20/13
to soft...@listproc.autodesk.com
Alan, Miguel and Eric shared out a nice training video which sounds similar to what you are describing Jimmy (only the "dents" are "bumps"). You might give it a look over:


Cheers - AM
Reply all
Reply to author
Forward
0 new messages