#### Archived

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

This topic is 6013 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I would be so gratefull if anyone could explain to me both in Theory and with Real code on how to do tweening with vertexshader with Meshes. please dont give me that link to that old post that someone wrote ages ago. do i need vertexbuffers when i got meshes?. please, could u explain step by step both theory and code on how to do it?. i would be eternally grateful. / Mr. Funk

##### Share on other sites
You sure are asking for a lot. Have you taken a look at the Dolphin sample in the DirectX SDK? There is your sample code. I will be more than happy to answer any specific questions you may have after you have bloodied yourself on that.

##### Share on other sites
quote:

I would be so gratefull if anyone could explain to me both in Theory and with Real code on how to do tweening with vertexshader with Meshes.

The DX SDK docs do show how tweening works fairly well. Also, I would download the nVidia effects browser, which contains a few tweening (morphing) vertex shaders with full source.

quote:

please dont give me that link to that old post that someone wrote ages ago.

There should be nothing wrong with a link to a message with the exact answers you seek.

quote:

do i need vertexbuffers when i got meshes?.

Meshes are vertex buffers. If you are using ID3DXMesh, then you are using a vertex buffer and index buffer wrapped by an interface class.

quote:

please, could u explain step by step both theory and code on how to do it?.
i would be eternally grateful.

To quote the DX SDK:

Tweening is performed before lighting and clipping. The resulting vertex position (normal) is computed as follows:
POSITION = POSITION1 * (1.0 - TWEENFACTOR) + POSITION2 * TWEENFACTOR, and likewise for normals.

Inside the vertex shader, it breaks down to taking a source and destination set of coordinates, and interpolating between them using a time factor.

An extremely basic tween shader looks like this:

  vs.1.0; v0 = source vertex; v3 = target vertex; c0-c3 = world*view*projection transformation; c4.x = tween factor, c4.y = 1-tween factor; LERP vertex coordinatesmul r1, v0, c4.xmad r1, v3, c4.y, r1; Transform to clip space and outputdp4 oPos.x, r1, c0dp4 oPos.y, r1, c1dp4 oPos.z, r1, c2dp4 oPos.w, r1, c3

home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX

##### Share on other sites
Could u give me more code. ?..
u know the full package?..
i have gone through the dolphin thing, but i aint getting it yet.

1. 1
2. 2
Rutin
20
3. 3
khawk
17
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633759
• Total Posts
3013715
×