VertexTweening

Started by
13 comments, last by pawelp 22 years ago
I also looked a bit at the DolphinVS example, do you know why their use 3 KeyFrames?
Advertisement
No - call D3DXAssembleShaderFromFile is called once at load time.

Vertex shaders **should** give you a speed boost. Why? Well I assume you have a Duron/Athlon/P3/P4. The Delphi compiler only compiles to Pentium 1 standard (possibly MMX too). The vertex shaders will either run in Hardware (Geforce 3/4, Radeon 8500) or use 3DNOW/SSE/SSE2 instruction set for optimization. Each line of VS code is roughly one processor cycle (aside from rcp), if you debug your code in Delphi you will probably see your code is much larger than the VS code.

Neil

PS Any more Q''s you know where to find me.

Oh and why 3 keyframes? Prevents distortion of the mesh. If it only used 2 meshes the output would look distorted between the keyframes. in my example I use MD2 models. The keyframes are close enought to not really see any distortion.


WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
Okey,, I think I slowly have it, thanx.
My Quake models have also normals and I tried to implement that in the VertexShader, but it''s nt going so well as I thougth, how should the vertex shader file and the vertex Declaration looks like if my model is make of vertexes of the following type:

TD3DVertex = record
x: Single; (* Homogeneous coordinates *)
y: Single;
z: Single;
nx: Single; (* Normal *)
ny: Single;
nz: Single;
tu: Single; (* Texture coordinates *)
tv: Single;
end;
?

Why do you decide not to use normals for your quake models?

BTW do you know what are the GICommands in the Quake md2 files?
I didn''t use normals for simplicities sake for now. However...

I wouldn''t other interpolating those any way mid-frame. The effect would only be negligible (notice how I don''t interpolate my texture coordinates?) and would run slower.

The decl

DWORD decl[] =
{
D3DVSD_STREAM( 0 ),
D3DVSD_REG( 0, D3DVSDT_FLOAT3 ), // Position of first mesh
D3DVSD_REG( 3, D3DVSDT_FLOAT3 ), //Normal
D3DVSD_REG( 6, D3DVSDT_FLOAT2 ), //Texcoord.
D3DVSD_STREAM( 1 ),
D3DVSD_REG( 1, D3DVSDT_FLOAT3 ), // Position of second mesh
D3DVSD_REG( 4, D3DVSDT_FLOAT3 ),
D3DVSD_REG( 7, D3DVSDT_FLOAT2 ),
D3DVSD_END()
};

I might attempt some vs code later fo you (but I am quite busy with assignment deadlines so if I don''t do it tonight I haven''t forgotten).

Neil


WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
ok, thanks

This topic is closed to new replies.

Advertisement