Archived

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

vxten

mesh mirroring..

Recommended Posts

Ok I''m not sure what to do here. I load a model/mesh with D3DXLoadSkinMeshFromXof since its an x file. I need to edit the mesh so that it is mirrored either verticle or horizontal or both. now the thing is i think i will have to edit ID3DXSkinMesh but i do not know what to do. any help? thanks

Share this post


Link to post
Share on other sites
Well I figured out how to get direct access to the vertext buffer. simple enough. but i still have no clue how i can mirror meshes.

[edited by - vxten on October 23, 2003 11:25:57 AM]

Share this post


Link to post
Share on other sites
now it seems if i rotate the mesh''s x,y,z just right i can get the required effect. its like damn impossible know what to rotate it too i have to let it run in a loop adjusting rotation and when something looks good ill break in and see the values. this is driving me insane!!

Share this post


Link to post
Share on other sites
quote:
Original post by rileyriley
could you just multiply whichever coordinate you want to mirror around by -1?


This would like.. change the order of the vertices of a triangle.
Clockwise -> Counter-clockwise;
Counter-clockwise -> Clockwise;

--
You''re Welcome,
Rick Wong
- sitting in his chair doing the most time-consuming thing..

Share this post


Link to post
Share on other sites
see this image. maybe i can fix something like the perspective view so things will look right to me?

http://www.ten-arc.net/perspectivehelp.jpg

[edited by - vxten on October 23, 2003 1:08:36 PM]

Share this post


Link to post
Share on other sites
i am hoping its a camara deal, but the camara wont hover over the meshes top down like that it either gos left-right, up-down, or away-near. in either case i still only see the side

[edited by - vxten on October 23, 2003 1:27:08 PM]

Share this post


Link to post
Share on other sites
HMM,
i would go with the camera, you''re doing something strange if that doesn''t work.

make the camera a lookat one, like this (managed):

Matrix matLookAt = Matrix.LookAtLH( new Vector3( cameraX, cameraY, cameraZ ), new Vector3( 0 , 0, 0 ), new Vector3( 0.0f, 1.0f, 0.0f ) );

then set the view matrix to that:

_device.Transform.View = matView;

you probably already knew that but you really should be able to achieve that result by moving the camera..

Share this post


Link to post
Share on other sites
ahh i dont understand how to get it to look at. I do this, but im fixed to an area. i think i have to edit the main World matrix?

D3DXMatrixTranslation(&m_matTranslation, -m_XPos, -m_YPos, -m_ZPos);

D3DXMatrixMultiply(&m_matWorld, &m_matTranslation, &m_matRotation);

Share this post


Link to post
Share on other sites
nonono,
the world matrix is the one you edit to translate/rotate/scale a set of vertices before you render them.

the view matrix is the one you change to make the camera move.

i think there is a d3dx function for creating a look-at matrix. i''m using managed so i don''t know exactly where it is.

Share this post


Link to post
Share on other sites
I used this like you said from the start. It still shows whats in the pic link above

D3DXMATRIX matView;
D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0.0f, 0.0f,-100.0f ),
&D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),
&D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) );
m_pD3DDevice->SetTransform( D3DTS_VIEW, &matView );

Share this post


Link to post
Share on other sites
quote:
Original post by Nik02
Rotate the actual vertices by locking the vertex buffer and transforming each vertex individually.


i know how to transform the vertex individually but i dont know how to rotate them

Share this post


Link to post
Share on other sites
I think the problem here is that you want your camera to look straight down from above your plane. The trick is then to position your camera above the object :
D3DXVECTOR3 vFromPt = D3DXVECTOR3( 0.0f, 100.0f, 0.0f );
and make it look at the origin :
D3DXVECTOR3 vLookatPt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
and now make your up vector for your camera along the z-axis :
D3DXVECTOR3 vUpVec = D3DXVECTOR3( 0.0f, 0.0f, 1.0f );
Now plug these values into your D3DX function to generate your view matrix :
D3DXMATRIX matView;
D3DXMatrixLookAtLH( &matView, &vFromPt, &vLookatPt, &vUpVec );
m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
Of course you can tweak these values to get the look you want - you had the right idea, just needed to change the up vector.
Crow.

Share this post


Link to post
Share on other sites
Maybe if you explained your problem better, people would understand you better, and be able to help you.

And this is not called "Mesh mirroring", its called "Mesh rotating".


--
You're Welcome,
Rick Wong
- sitting in his chair doing the most time-consuming thing..

[edited by - Pipo DeClown on October 24, 2003 10:38:14 AM]

Share this post


Link to post
Share on other sites