hdk noobie here,
I'm trying to write a sop that will take two geos, shift their positions by a given value, then blend the two to get a new position.
Question is, what do I shift?
Would something like this work? (I haven't had the chance to try it yet because I'm not sure how to assign pos back to the vertex)
pseudocode:
p = prim->getVertex(i).getPos();
newP = p * shiftVal;
*edit*
Another question is, is that a good way to go about the problem?
Or should I be calculating the difference of two geos ‘then’ apply the shiftVal to the difference?
sop geo position shift
3562 5 1- moonjo
- Member
- 4 posts
- Joined: Aug. 2006
- Offline
- moonjo
- Member
- 4 posts
- Joined: Aug. 2006
- Offline
- mondi
- Member
- 44 posts
- Joined: July 2005
- Offline
getPos in the vertex class returns a reference to the position, so you should be able to just assign it:
UT_Vector4 newPos = ….;
prim->getVertex(i).getPos() = newPos;
or as in your example, use .assign() (note - you're multiplying the y,z, and w components in your example, but leaving the x untouched)
As far as order of operations, I'd blend the vectors first, then shift the result (1 interpolation and 1 shift as opposed to 2 shifts and 1 interpolation)
UT_Vector4 newPos = ….;
prim->getVertex(i).getPos() = newPos;
or as in your example, use .assign() (note - you're multiplying the y,z, and w components in your example, but leaving the x untouched)
As far as order of operations, I'd blend the vectors first, then shift the result (1 interpolation and 1 shift as opposed to 2 shifts and 1 interpolation)
- moonjo
- Member
- 4 posts
- Joined: Aug. 2006
- Offline
Thanks mondi,
Didn't know about xyzw for the vector.
Will try current method and if it doesn't work I'll have to find out if there's anything in the api that can help.
* basically, I need to extrapolate a new position from last valid frames.
ie. take the difference in positions of frames 39-40, and get the position for frame 50.
Didn't know about xyzw for the vector.
Will try current method and if it doesn't work I'll have to find out if there's anything in the api that can help.
* basically, I need to extrapolate a new position from last valid frames.
ie. take the difference in positions of frames 39-40, and get the position for frame 50.
- edward
- Member
- 7735 posts
- Joined: July 2005
- Offline
- moonjo
- Member
- 4 posts
- Joined: Aug. 2006
- Offline
Well, I managed to do it just with points; didn't deal with primitives or vertices.
I grabbed the points of the two geos, got their positions with getPos(), calculated the difference and just applied it to one of the geos.
Way too simpler than I expected so even though it's working, I'm still unsure. oh well.
I grabbed the points of the two geos, got their positions with getPos(), calculated the difference and just applied it to one of the geos.
Way too simpler than I expected so even though it's working, I'm still unsure. oh well.
-
- Quick Links