Skip to main content
gamedev.net
🔒 Locked

Multiple World Matrices

Started by jonnii 5 replies 900+ views
Original Post
jonnii
jonnii
Whats the point of having multiple world matrices? Is it similar to a matrix stack? Are they necessary if the rendering pipeline is programmable? [edited by - jonnii on November 18, 2003 12:20:21 PM]
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com
Fidelio66
Fidelio66
There are three matrices involved.
For each model, its world matrix transforms it from local coordinates (typically around (0,0,0)) to world space. Say you have a model of a tree, then you can draw it 20 times using a slightly different world matrix and you''d create a small forest.
The view matrix transforms the world according to the camera position and look direction. Finally the transformation matrix transforms the 3D coordinates to 2D screen coordinates for example (0..640,0..480)
jonnii
jonnii
really? thats great.

however, it''s not the question i asked.

multiple WORLD matrices. is this for some kind of vertex skinning in software?
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com
treething
treething
Yes. Its for vertex blending, e.g. skinning. Each matrix has an influence on a vertex equal to the equivalent weight in the vertex structure. Thats for the FF pipeline of course. With vertex shaders you can bazillions of matrices and do whatever you like with them.
superdeveloper
superdeveloper
Anyone have a sample of this (FF, not VS)?

looking at msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/enums/d3dtransformstatetype.asp, there is even the "D3DTS_WORLD" macro that is used to index between all the world matrices.

I only ever use 1 world matrix at a time (for each object), and stacks for all the articluated stuff... I never used multiple world matrices like this, although I am curious to the vertex-effects it''s capable of.
JoeyBlow2
JoeyBlow2
Yikes. I just deleted my sample which used this. Could have come in handy here.

Basically you setup a blend factor in the vertex declaration (the struct), between 0.0, and 1.0. Then you can setup WORLDMATRIX(0) to be at a certain position/direction, and WORLDMATRIX(1) to be at another position/direction. The blend factor 0.0 and 1.0 will cause a LERP command to be used on those matrixes to get the final result between the two matrix.

Think of it this way. Lets say you have an arm rendered on the screen. Shoulder down to elbow, then out to the wrist. Near the shoulder the weights would be around 0. Down near the elbow 1. On the lower arm, elbow to wrist, elbow would have 0, and wrist would have 1. You will have to render each section independantly from each other (can't batch)

Lets say you have your arm down to your side. The WorldMatrix(0) and WorldMatrix(1) will have the same directions then you just render your arms as normal. But if you rotate the elbow 90 degrees, then the fixed function will rotate/move the vertexes automatically in hardware around the joint to make sure there are no seams in the polygons and that its getting stretched appropriately.

Its best if I make an example


0 _____ 0 ____
| | | |
| | | |
| | | |________
| | \ | |
1 |___| \__|________|
0 | | 1 0 1
| |
| |
| |
1 |___|



In the first one, the upper arm of the arm WORLDMATRIX(0) and WORLDMATRIX(1) are pointing down. In the lower arm part, same thing both pointing down. In the second example, the upper arm the WORLDMATIRX(0) is pointing down, and WORLD_MATRIX(1) is pointing right. The lower arm the both matrix is pointing right. (unless you want the wrist to move in another direction then you can change the MATRIX(1) to point at a new direction)


[edited by - Joeyblow2 on November 19, 2003 11:28:35 AM]
jonnii
jonnii
i figured it was for vertex skinning. shame i''ve already implemented it using a vertex shader.

oh well.
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.