Calculating WorldView

Started by
18 comments, last by MooMansun 18 years, 6 months ago
Great, I'm back were I started. How can I calculate the current worldMatrix without effecting the matrix in memory.

I'm using pure hardware VP and get commands are not an option. Device.Transform.World fails, passing the value to a temp store only gives me an additional pointer....

Lang: c#

Help anyone???
Advertisement
The link you posted is to a document that is over 7 years old. There have been over a dozen SDK releases since then! The document is severely out of date.

The part of the docs that you quoted was this:
Quote:From http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnardir3d/html/d3dlight3.asp
Computation of Inverse World Matrix
The world matrix could be represented as:

Mw = Mwr * Mwt, where Mwr is the rotation part and Mwtb is the translation part.

Mwr is a matrix with just the rotation part of the world matrix, and Mwt is a matrix with just the translation part of the world matrix. In no way does this imply that you can get the world matrix by taking the inverse of the view matrix.

Like someone else has already said; you need to have a basic understanding of linear algebra to do this.

Applications should not need to call GetTransform... or whatever, to get the world matrix of an object. Each object in your scene should have its own world matrix. The world matrix is used to transform geometry to different parts of the scene.

What is it about this explanation that you don't understand? Perhaps myself and the others that have posted in this thread and your other identical thread (http://www.gamedev.net/community/forums/topic.asp?topic_id=349970) have not been clear? If you're not sure about something ask, but don't just ask the same question multiple times hoping for a different answer when it has already been answered multiple times in the same way by different people.

neneboricua
Quote:Original post by neneboricua19
What is it about this explanation that you don't understand? Perhaps myself and the others that have posted in this thread and your other identical thread (http://www.gamedev.net/community/forums/topic.asp?topic_id=349970) have not been clear? If you're not sure about something ask, but don't just ask the same question multiple times hoping for a different answer when it has already been answered multiple times in the same way by different people.
neneboricua


Not just here - he's at it in the newsgroups too:
Moo's newsgroup argument
ZMan
ZBuffer,

The answers provided have not provided a solution to my problem.

They either fail or they just effect the Matrix in memory.

Read a little more carefully.

I need to obtain the worldView Matrix, however, under pure hw vp any matrix operation effects the Matrix in memory.

Is there a way around this?
Here, I have found someone else who says the worldMatrix is the inverse of the viewMatrix, their name is WitchLord (Moderator)...

Quote:
"I also advice you to take a look at the following matrix structures for the worldmatrix and viewmatrix:

World Matrix
View Matrix

See the similarities? The view matrix is in fact the inverse of the world matrix."

http://www.gamedev.net/community/forums/topic.asp?topic_id=15526&forum_id=10&gforum_id=
Think of it a different way, since it is just a Matrix, is there any Math operation which would return the inverted values?

Something like Math.Matrix.Invert(Matrix) would be handy...
Ok, that's it. I give up. I won't keep this going if the OP isn't willing to take advice. Good luck in all your efforts.

neneboricua
neneboricua:
"Applications should not need to call GetTransform... or whatever, to get the world matrix of an object. Each object in your scene should have its own world matrix. The world matrix is used to transform geometry to different parts of the scene."

This I know, however, you need to calculate the world matrix in order to have one. We were attempting to use GetTransform to obtain it.

So, before we end up flaming each other, I will keep it simple and ask one question at a time.

1. How do you calculate the worldMatrix of a loaded mesh?
Quote:Original post by MooMansun
you need to calculate the world matrix in order to have one. We were attempting to use GetTransform to obtain it.

This sounds like an infinite catch-22 loop to me [smile]

Provided you're not running a pure device, then calling GetTransform() where you haven't already set one should return a default. Off the top of my head, I think you'd just end up with the identity matrix.

Quote:Original post by MooMansun
1. How do you calculate the worldMatrix of a loaded mesh?

Build it using whatever information is available.

Some mesh formats will export, from the modeller, a set of matrices (bone/skeletal meshes are a good example of this) that you can read from the specific file format. If there isn't any information in the file you're loading, then you might want to look at the "level" data - there could be position/rotation/scale information in the level indicating where the current mesh is.

Failing those, Just assume an identity world matrix for the mesh..

An example I have kicking around stores 3 vectors with a mesh - rotation, scaling and translation. I have a copy of these 3 vectors with every instance of the mesh that is loaded. If I choose to move that mesh around at runtime then I alter one (or more) of those 3 vectors.

When it comes to rendering, calls to D3DXMatrixIdentity(), D3DXMatrixMultiply(), D3DXMatrixScaling(), D3DXMatrixTranslation(), D3DXMatrixRotation*() are used to create the world matrix for that mesh. I then SetTransform() this matrix (or apply it to the vshader constant table) and render...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Thanks guys,

It is a bit like the chicken and the egg. I am sure it can be done. I am running a pure device, which means any matrix operation effects the Matrix in memory.

Just for tonight, I am abandoning this DX9c thing for 'Team America', I need a good laugh and I'm sure something will come to me...

Again, thanks for all your help, chat later...

This topic is closed to new replies.

Advertisement