hi michel,
i´ve tried to follow your explanation, and started editing the template.fx shader.
assuming i want to morph between 2 objects:
write an effect, that has as many value-parameters as you have different positions for each vertex. these are the weights for your different positions
i added this to “PARAMETERS”
// Vertexes for morphing
float3 vertex1In = { 0, 0, 0 };
float3 vertex2In = { 0, 0, 0 };
// control params for morphing
float vertex1val = { 0 };
float vertex2val = { 0 };
now:
transform each position with your world-transform-matrix (Transform)
guess the calculation takes place in the vertex shader part of the effect?
i´ve copynpasted some lines from the template patch…
struct MORPH_OUTPUT
{
float4 Pos : POSITION;
};
MORPH_OUTPUT MORPH ( float4 Pos : POSITION)
{
//inititalize all fields of output struct with 0
MORPH_OUTPUT Out = (MORPH_OUTPUT)0;
Pos = mul(Pos, tWVP);
// CALCULATE FINAL POSITION ???
Out.Pos = Pos;
return Out;
}
your final position is the sum of the several weighted positions you have (the weights are your value-params that you can control easily within your patch)
mhm, i don´t get that-
why do i need a parameterfor EACH of the 2 states? if it´s for “blending” the two models, i would need only one (kind of of a “percentage”)?
(i´ve attached the fx-file).
gruss, florian
p.s. michel - haste meine email zum bücherthema gekriegt?