• Create Account

Banner advertising on our site currently available from just \$5!

Member Since 22 Aug 2009
Offline Last Active May 16 2014 08:23 AM

### Rotation Matrix

03 September 2013 - 11:44 AM

Hi everyone!

I've been using this code for years when setting up my world matrix for my meshes:

```D3DXMatrixRotationX( &matRotX, Coords.Rotate.x );
D3DXMatrixRotationY( &matRotY, Coords.Rotate.y );
D3DXMatrixRotationZ( &matRotZ, Coords.Rotate.z );

D3DXMatrixScaling( &matScale, Coords.Scaling.x, Coords.Scaling.y, Coords.Scaling.z );

D3DXMatrixTranslation( &matTrans ,Coords.Position.x, Coords.Position.y, Coords.Position.z );

matWorld = ( matScale * matRotX * matRotY * matRotZ ) * matTrans;

d3dDevice->SetTransform( D3DTS_WORLD, &matWorld );```

However, my graphics guy has asked if he can have a system where if he rotates on an axis then it's sure to always rotate the same way regardless of other rotations applied.

For example:

If you have a Bike Wheel rotating on the Z Axis then it should still rotate correctly even if I rotate it on the Y Axis too. Currently using the above code it end up rotating the wrong way. I figured this is because of the order they are multiplied together. X then Y and then Z. But I don't just want to force the order the are multiplied for this specific case. How would I make it so that the Z Axis no matter what other rotations are applied will always make it spin the way you'd expect a wheel to spin?

Also, does anyone know if there is a technical term for what I am asking?

I would be grateful for any advice!

David

### Rotating Face Normals

17 November 2012 - 06:03 AM

Hi everyone I wonder if anyone has any insight into this.

Is rotating a Face Normal any different to rotating a Vertex? I don't seem to be getting the correct results when applying a matrix transform to a face normal. I've tried using D3DXVec3TransformNormal instead of D3DXVec3TransformCoord but the documentation is says:

If you transforming a normal by a non-affine matrix, the matrix you pass to this function should be the transpose of the inverse of the matrix you would use to transform a coord

I'm not sure what that means exactly and if it will help with rotating a Face Normal.
Basically My Code is:
```D3DXMATRIX matRotX, matRotY, matRotZ, matRotTotal;
D3DXMatrixRotationX( &matRotX, pMeshCoords->Rotation.x );
D3DXMatrixRotationY( &matRotY,  pMeshCoords->Rotation.y );
D3DXMatrixRotationZ( &matRotZ,  pMeshCoords->Rotation.z );

matRotAll = matRotX * matRotY * matRotZ;

D3DXVec3TransformNormal( &RotFaceNormal, &FaceNormal, &matRotAll );
```

Thanks in advance for any info anyone has!
David

19 September 2012 - 11:17 AM

Hi everyone!

I'm using DXUT as a basis for my main loop. I have a separate thread running during loadup which loads all the textures, models etc. When I turn V-Sync on the loading on the other thread slows down dramatically. If I turn V-Sync off it loads much faster. This seems odd to me as I thought V-Sync would free up the other thread to run faster when it was on and not the other way around. Is this an expected result or have I made a mistake somewhere?
Does anyone have any insight into what might be causing the issue as I've been messing arround with thread priorities and they don't seem to make any difference.

The only thing that does help is if I sleep for a few miliseconds in the Main Update loop.

Thanks in advance for any help!

David

### Sending A Hash List

06 June 2012 - 06:46 AM

Hi everyone!

I need to send a Hash List from a client to a server and was wondering on the best way to do this. I have a connection to the server and can send data fine but I was wondering how I should handle the procedure. I'm using TCP and was wondering if I could just get the client to just fire the data one Hash at a time and allow it to queue up on the server end. I'll be sending over a thousand of them and was wondering if I was just to send a load of seperate messages if it would be considered hammering the server?

Should I get the server to send a confirm message after it's received eash hash and then force the client to wait for the confirm before sending the next data. I want the data to be sent as quick as possible so I'd rather not have to wait for a confirm before each message.

David

### Anaglyph DirectX 9

15 April 2012 - 10:36 AM

Hi everyone!

I've been trying to implement Stereoscopic support for my game and have mannged to get this working fine in a Side-By-Side fashion but I'm quite unsure how to render in Anaglyph. From my understanding one way to do this is to render one eye and then render the second eye ontop but only letting the Reds blend through. I'm not sure if this is the best way to handle it but I was wondering if anyone had any advice on how this is done.

Is there a way to set the Render state to only blend Reds? ( I understand this might be quite costly)

Or is there a way to render 2 buffers and then blend them at the end but only the reds on the second layer?

Is this something that would be done with a Stencil Buffer?