PDA

View Full Version : Dynamic rigging! performance & other lovely problems


dammilo
11-23-2010, 10:55 AM
Hi guys,
I am a fellow reader of this awesome forum and i don't usually write anything (cfr:lurker), but now...i think the time to write has come! :D I'll try to write in my best english (i am italian).

so! I am currently working on the first steps of my graduation thesis, and the idea was to build a dynamic car rigging in 3dsmax (given a path and a terrain the car should realistically follow path and terrain, simple as that).
This is what i achieved so far (i am working on the front-left wheel only before duplicating rig and controllers): the wheels rotate and stay on the ground at a coherent distance.

http://img259.imageshack.us/img259/3583/rigi.jpg

little bit of explanation.
The green rig is a probe that estimates the angle of the terrain, launching 4 rays at a constant distance from the big green arrow (with the rig in default pose they fall in the center of the wheels).
The big yellow arrow inherits angle and direction of the little projected green circles and projects the 4 orange arrows, so that the length of the 2 axis and the distance between them are approximately constant in the 3 dimensions. The other little yellow splines are for the steering and rotation control; the four wheels have always the same z direction, an average of the normals returned by the orange arrows.

Now: i read lots of threads and tried to learn all i could...and btw thank to all of you and expecially to BOBO and PEN, you really helped me out of lots of sticky situations. Actually, i'm quite satisfied if i think that up to 2 weeks ago i didn't even know how to properly use a lookat constraint :)
But obviously i am not an expert, so i kindly ask you a general comment on my approach: thoughts?
Is it bad?
Am i missing something?
Do you foresee problems I don't?

Ok, time for my second question. This is the rig at work:

17114197

sadly, this is not a realtime grab. Realtime, performances are HORRIBLE.

For the projections i use a Transformation Script controller performing a combination of ray cast and intersectRay. I'm now using this approach in 8 objects (green circles, orange arrows), and i'm noticing a drastic performance hit every time I add code doing this procedure.
I am on sligthly clocked i7 920 and i went from a 50 FPS when i only had the green rig to a terrible 5 - 8 FPS (when in a moment of enthusiasm i added 2 or 3 more "probing" for calculating pneumatic deformation; i deleted this part of rig).
Worst part: i am still working with 1 wheel only!
More or less, this is what i wrote in the controllers. This is the one for the front-left orange arrow:

root=$FLtop --top yellow circle
--------------------------

--projection of the ray
evRay = ray root.pos [0, 0, -1]
groundVar= intersectRay $ground evRay

--if the ray doesn't hit anything
if groundVar == undefined then (
alignedMatrix = matrix3 1
alignedMatrix.row4 = root.transform.row4
alignedMatrix)

--cross products to align the arrow to the surface
else(
alignedMatrix = matrix3 1
alignedMatrix.row4 = groundVar.pos
alignedMatrix.row3 = normalize (groundVar.dir)
alignedMatrix.row2 = normalize -(cross root.transform.row1 groundVar.dir)
alignedMatrix.row1 = normalize -(cross alignedMatrix.row3 alignedMatrix.row2)
alignedMatrix)
This is it.
Are there coding errors?
Do you have performance tips?
Generic tips with maxscript and rigging?
Maybe this is normal?
I've seen several videos of awesome rigs on youtube (like http://www.youtube.com/watch?v=id1ZL2sBKSg , OMG YASSIN IF YOU REALLY EXIST: I WANT TO MARRY YOU) and they all seem...well..quite responsive :(

What do you think?

Thanks to all of you guys...really! You already were indirectly precious :D. I owe you one.

CGTalk Moderation
11-23-2010, 10:55 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.