Re: [CPP] Storing data in a compileOp
| Date : Mon, 12 Dec 2005 18:19:18 +0100 |
| To : XSI(at)Softimage.COM |
| From : Guy Rabiller <guy(at)alamaison.fr> |
| Subject : Re: [CPP] Storing data in a compileOp |
|
Ok Alan, now that I have a clearer view of your problem, here are a few suggestions, hopping that I didnt miss anything. I'm trying here to stick to the XSI DAG 'spirit', avoiding hacks, try to make things as clean as possible. The point here, is to not play the 'persistent' approach, but the 'on the fly computation' approach ( so the 'procedural idea' is conserved, when you touch something everything is updated ), then have the ability to make things persistent by baking maps or plotting datas, if you want, once the animation is validated. In practice, it will appear to behave as if there was 'persistent' datas: What you can do is to split the problem in 3, because you have 3 problems to solve: - one is position constraint, nearby the Base surface - the second is the constraint position offset, idealy with manual, interactive update of each Constrained object. - the third beeing orientation constraint according to the Cage object vertices offsets relative to the Base object vertices. Perhaps you could adress these issues with those 4 steps: 1) VertexColorMap Direction Vector Operator First you can deal with the Orientation problem in a total independent way, by computing all the direction vectors for the Base/Cage objects at once ( for each frame ), so that each Constrained object Operator will just 'look-up' at this information relatively quickly, and have this information persisted with the scene ( because in fact it is computed on the fly ). - Add a VertexColor Map to the Base object. - Create an Operator (#1) that will update this map ( output ), according to the direction offset, vertices by vertices from both object geometry primitives ( input ). - Encode this direction in RGB ( x in R, y in G, .. ) in the VertexColorMap. The VertexColorMap will then contain direction vector, and will be computed on the fly, updated automatically by your Operator whenever you deform the Cage object and/or the Base object, so you can animate both. You could even bake ( or rendermap ) the sequence by creating a TextureMap sequence, and connect it ( in fact the UVs, source Clip, Cluster ) to the Operator in place of the VertexColorMap ( use optional input ports here ), this way no computation will take place this time, you would have a direction vectors 'cache' through picture sequences. 2) Direction Constraint Operator - Create an simple Operator (#2) wich will update the Constrained objects Orientation ( output ) according to the VertexColorMap ( input ) or the TextureMap 'cache' ( input ) from the 'encoded' vectors. - Its up to you to interpolate the directions nearby a triangle. - Once the animation is validated you can 'cache' the Constraint by plotting the Orientation of your Feathers, making it persistent ( really this time ) so it will be updated very quiickly, and remove your Operator. 3) Position Constraint - For each Feather create a Null and position it where the Feather should be constrained. - Parent the Feather under its Null. - Create a new Operator (#3) connected ( input ) to the Base Object Geometry, and to the Position ( output ) of the Null. - For each Null, retrieve the nearest triangle. - From the triangle, get this datas: -- The 3 vertices indices ( rather than their positions ). -- The Triangle Barycentric coordinates of the Null. -- The distance of the Null to the Triangle Plane ( according to its Normal ) So 2 vectors and a scalar. It seems a lot of data, but it will allow you to keep track of the deformation of the Base object, and recompute the correct Null position on the fly. No need to store the positions then. - When you Constraint your Feather, you record those datas in a PPG under the Feather connected to the Operator, or in the Operator Parameters. - Inside your Operator, you look for those datas and 'look-up' for the 3 triangle vertices from their IDs, then recompute the correct position of the Null. - Again, you can 'cache' the Null Positions by simply plotting them once the animation is validated, then making it persistent ( really this time ), so they will be updated very quickly. You can then remove your Operator. As a note, you could combine Operator #2 and #3 if you like, so only the Nulls will be constrained both in Position and Orientation. 4) Position ( and even Orientation ) Offset - Parent Each Feather under his associated Null. - With each Constrained object parented under their respective Null, it is now trivial to move them as regular children, even rotate them manually if you have combined Operator #2 and #3. - Once you have Moved your Feather, you can update the Null Operator PPG/Parameters, by checking the nearest triangle again, and update the vertices indices/barycentric coordinates and distance. This could be done either by: -- Using a Command ( from a menu or script ). -- Using an Event ( so that it would be automatically done whenever you move the Feather ) Before you update those, record the Feather Position ( global ), Update ( the Feather will move because the Null might move, then place back the Feather in the previous Position. - Note that once the Null Positions are cached, it wont update anything anymore. Sorry for the long description, I hope its relatively clear, tell me if that is of any help to your problem and if I didnt assumed anything wrong. -- guy rabiller | 3d technical director (at) LaMaison Alan Jones a écrit : Hi Guy, --- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi |
- Follow-Ups:
- Re: [CPP] Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Re: [CPP] Storing data in a compileOp
- References:
- Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Re: Storing data in a compileOp
- From: Guy Rabiller <guy(at)alamaison.fr>
- Re: Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Re: [CPP] Storing data in a compileOp
- From: Guy Rabiller <guy(at)alamaison.fr>
- Re: [CPP] Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Re: [CPP] Storing data in a compileOp
- From: Guy Rabiller <guy(at)alamaison.fr>
- Re: [CPP] Storing data in a compileOp
- From: Alan Jones <skyphyr(at)gmail.com>
- Storing data in a compileOp
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: [CPP] Storing data in a compileOp
- Next by Date: Re: [CPP] Storing data in a compileOp
- Previous by Thread: Re: [CPP] Storing data in a compileOp
- Next by Thread: Re: [CPP] Storing data in a compileOp
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |