On Feb 9, 2006, at 4:32 PM, Frank Condello wrote:
On 9-Feb-06, at 5:48 PM, Joseph J. Strout wrote:
You don't think it would be caused by the simple normal
interpolation Jeff is trying to do?
Sure why not! @Jeff: Maybe post some code so we can have a look-see...
Okay, here's the code which does the morph. You'll notice that I've
commented out the normals part, but that doesn't solve my problem --
I still get tearing. I think I should add that I'm working with a
trimesh which is broken up with several seams, so it's not one
continuous mesh.
Note: mObjectTrimesh holds the Trimesh in the RB3Dspace.
Sub UpdateMorph(timeLeft As Double, FPS As Double, start As Trimesh,
goal As Trimesh)
// Given the time elapsed between frames, the frames/sec speed
// to animate at, and start/goal morph targets, update the current
// mObjTrimesh to morph towards that goal.
Dim i, j, lastFrame As Integer
Dim percent As Double
Dim v0, v1, n0, n1 As Vector3D
Dim vFinal, nFinal As Vector3D
// Calculate the percentage to morph based on elapsed time and
// the frames/sec of the animation in question.
percent = (FPS - timeLeft) / FPS
j = mObjTrimesh.VertexCount - 1
for i = 0 to j
// Calculate difference vector between start and goal.
v0 = start.VertexPositions.GetVector(i)
v1 = goal.VertexPositions.GetVector(i)
'n0 = start.VertexNormals.GetVector(i)
'n1 = goal.VertexNormals.GetVector(i)
vFinal = v1.Minus(v0)
'nFinal = n1.Minus(n0)
// Calculate how far to move along difference vector.
vFinal.MultiplyBy percent
'nFinal.MultiplyBy percent
// Add it back to original positions to get final move.
vFinal.Add(v0)
'nFinal.Add(n0)
// Copy it back to current trimesh.
mObjTrimesh.VertexPositions.SetVector(i, vFinal)
'mObjTrimesh.VertexNormals.SetVector(i, nFinal)
Next
==
Jeff Quan
jquan at mindspring dot com
http://www.geocities.com/jeffqportfolio/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|