Archived

This topic is now archived and is closed to further replies.

eng3d

DirectX graphics blend (morph)

Recommended Posts

How this work??. This work via multiply the vertex into system memory or it have some method??. Because i need to use graphics blend (not alpha blend) in a complex human body and i hope the fps not fall!. It''s not very difficult to made the blend by myself (multiply matrix for all vertex and normals), but directx made a better work? -eng3d.softhome.net-

Share this post


Link to post
Share on other sites
I think you are referring vertex blending. There is a sample of this in the SDK, I believe it''s called tentacle or something like that.

Anyway, the DirectX vertex blending works as follows. You can set four different world matrices with SetTransform(). For Direct3D to know how to blend the vertices you also need to specify the weights used for each vertex to blend with these for matrices. To do this you need to change your vertex format to include the four weights (read about flexible vertex formats to understand how this is done). Once you have defined the weights for all vertices and set the world matrices, you render the triangles just as you normally do (hopefully with DrawIndexedPrimitiveVB()).

It is important to remember here that you can only use four different transform matrices for each call to DrawIndexedPrimitiveVB() so you will most likely have to make several calls to Draw...VB() in order to render the whole model.

I have no idea if this suits your purposes. But personally I would do the vertex blending myself in modelspace, and then send the blended vertices to Draw...VB(). This because it gives you more flexibility with the blending and you will only make a single call to Draw..VB().



- WitchLord

Share this post


Link to post
Share on other sites
Is is the point, I want to move a human parts and 4 matrix is far low for all body.

And i don''t like to use partial transformation (ie. 0.5f). It is a expensive made for directx ? (for cpu?). I like a 100% matrix transformation (1.0f)

My problem is if i made the transformation, i need to made a copy of vertex :

vertex -> transformation -> vertex''

How it is a expensive (vertex'' always be present, so i don''t need to create one all times)
My problem 2). There are some assembly (or fast c++) formula for multiply 3d vertex with 4x4 matrix (transformation)



-eng3d.softhome.net-

Share this post


Link to post
Share on other sites
quote:
Original post by eng3d

Is is the point, I want to move a human parts and 4 matrix is far low for all body.




Yes, four matrices isn''t enough for the whole body. You would have to split the body into several parts, where each part only needs a maximum of four matrices. For example, a leg needs three matrices (foot, lower leg, and upper leg), the pelvis needs three matrices (2 upper legs, and lower back).

quote:


And i don''t like to use partial transformation (ie. 0.5f). It is a expensive made for directx ? (for cpu?). I like a 100% matrix transformation (1.0f)

My problem is if i made the transformation, i need to made a copy of vertex :

vertex -> transformation -> vertex''

How it is a expensive (vertex'' always be present, so i don''t need to create one all times)




I''m not sure what you mean. No transformation is partial, all are fully made. The result from each transformation is then blended with weights into a final vertex. Like this:

Vertex'' = W1*(Vertex*Mtx1) + W2*(Vertex*Mtx2) + W3*(Vertex*Mtx3)

Where (W1+W2+W3) = 1. Even if you don''t use Direct3D to do the vertex blending for you, you need to do it this way.

quote:


My problem 2). There are some assembly (or fast c++) formula for multiply 3d vertex with 4x4 matrix (transformation)




Yes there are fast optimizations for this kind of operation. You''ll want to look at AMD''s 3DNow and Intel''s SSI instruction sets.

- WitchLord

Share this post


Link to post
Share on other sites
Actually, from the small bit of research I''ve done with Direct3D''s blending it seems the most world matrices you should use at any time is two. There is a very simple reason for that--current 3D hardware doesn''t support any more. And really the only reason not to do the blending yourself is to take advantage of T&L hardware doing it for you. Fortunately, that''s really all you should need. Generally any point on an organic body falls neatly between two discrete joints, so you shouldn''t need to use any more than that many blending matrices at a time.

Share this post


Link to post
Share on other sites