• Advertisement

thekiwimaddog

Member
  • Content count

    70
  • Joined

  • Last visited

Community Reputation

155 Neutral

About thekiwimaddog

  • Rank
    Member
  1. Rotation Matrix

    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!  Thanks in advance for your time! David
  2. Rotating Face Normals

    Thanks, the problems was with my reflection code. Thanks for your help anyways! David
  3. Rotating Face Normals

    OK, I've tried the following: [CODE] D3DXMATRIX matRotX, matRotY, matRotZ, matRotTotal; D3DXMatrixRotationX( &matRotX, pMeshCoords->Rotation.x ); D3DXMatrixRotationY( &matRotY, pMeshCoords->Rotation.y ); D3DXMatrixRotationZ( &matRotZ, pMeshCoords->Rotation.z ); matRotAll = matRotX * matRotY * matRotZ; D3DXMatrixInverse( &matRotAll, NULL, &matRotAll ); D3DXMatrixTranspose( &matRotAll, &matRotAll ); D3DXVec3TransformNormal( &RotFaceNormal, &FaceNormal, &matRotAll ); [/CODE] This hasn't helped. Am I going about this the wrong way? Thanks David
  4. Rotating Face Normals

    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 [b]D3DXVec3TransformNormal[/b] instead of [b]D3DXVec3TransformCoord[/b] but the documentation is says: [quote]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[/quote] I'm not sure what that means exactly and if it will help with rotating a Face Normal. Basically My Code is: [CODE] 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 ); [/CODE] Thanks in advance for any info anyone has! David
  5. 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
  6. Sending A Hash List

    Excellent! Thanks for the info! David
  7. Sending A Hash List

    OK, so lets say I max out the buffer and the send() function only queues half the data that I sent to it. What's the best way to handle this? Do I have to keep retrying the send with the remaining data? Is there a way to make it only queue the data if the full buffer is accepted because I'd rather not have to hang on a partial send and resend the whole message when the buffer is free. Thanks David
  8. Sending A Hash List

    Thanks for your quick reply! OK, maybe I'm not understanding how this works. I'm sending data using the send() function. Does it matter how often I make calls to this function? Once I've made a connection to the server can I send data as fast as I like without worrying about hammering the server or overloading any buffers? Or should I put the hash list into a single buffer and send just once? or would multiple calls to the send() function just join them up anyway? Thanks David
  9. Sending A Hash List

    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. Thanks in advance! David
  10. Anaglyph DirectX 9

    OK, I've fixed the issue. From what I've read you can't use AA when rendering to a texture directly. Instead you have to render to another surface and then copy it over to the textures surface. [img]http://i795.photobucket.com/albums/yy233/thekiwimaddog/AnaglyphAA.png[/img] Thanks once again for everyones help, I've learnt alot from this discussion! David
  11. Anaglyph DirectX 9

    I am using some draw order tricks to create some of the layers in the game. But you can see the keys on the board here are not taking the Z-Buffer into consideration at all here for some reason. It does seem odd this only happens when AA is enabled. With AA: [img]http://i795.photobucket.com/albums/yy233/thekiwimaddog/withAA.png[/img] Without AA: [img]http://i795.photobucket.com/albums/yy233/thekiwimaddog/withoutAA.png[/img] Do you have to treat the Z-Buffer differently when rending to a texture? Do I need to setup the AA settings per render target? Thanks! David
  12. Anaglyph DirectX 9

    The colours are quite important in the game and I can make out the colours fairly well. The Red and Blue notes are obviously the hardest to see but they are spaced apart so it's not likely that you would mistake one for the other. However, I've been thinking about changing the shape of the notes for each colour to make it a little easier to recognise. I could then have an option to saturate the colours and replace the notes accordingly. So does anyone have any ideas on how I should handle AA when changing render targets like this? Thanks David
  13. Anaglyph DirectX 9

    OK, these glitches I'm getting seem to be releated to Anti-Aliasing. I've been reading and many people have been saying that this doesn't work with mutiple render targets. Is this just for when you are rendering to 2 targets at once? or does that include what I'm doing by switching targets but only rendering to 1 at a time? Thanks David
  14. Anaglyph DirectX 9

    Ahh, thanks that worked! Thanks everyone for their time I really appreciate all of your help! I'm getting a few render glitches for some reason but you can see it working! [img]http://i795.photobucket.com/albums/yy233/thekiwimaddog/ps_anaglyph.png[/img] Thanks Again! David
  15. Anaglyph DirectX 9

    [quote name='Tom KQT' timestamp='1334682957' post='4932195'] Nope, it won't darken the result - don't forget that you are blending 50 % of the second image with the "full" first image. The result is 50 % of the first + 50 % of the second, which gives "100 %". If you have the proper blending operation: device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);then the blending equation for each color channel is result = color_on_screen * (1 - rendered_alpha) + rendered_color * rendered_alpha and in our case result = color_on_screen * (1 - 0.5) + rendered_color * 0.5 which is result = color_on_screen * 0.5 + rendered_color * 0.5 Imagine you have two identical images. Let's take one example pixel with color RBG 250,100,50. When you render the first quad, the pixel on the screen will be 250,100,50. Now you render the second one and by the calculations you'll get 125+125, 50+50, 25+25 which is 250,100,50. Not darkened at all. An important note: The first quad must be fully opaque, or you must disable blending before rendering it. If you did render also the first quad with 50 % alpha, it would blend with the empty backbuffer, which would probably be black (depends on how do you clear the buffer) and that WOULD darken the result. [/quote] OK, I feel stupid bringing this up again considering I said I understood what you were saying but I've tested this and I am getting a darker image. From what you've wrote here you say that the image behind is fully opaque. However, it is missing the Red Channel so isn't it a little diferent. If we just look at the red channel in isolation then if the original pixel is 255. The back image would be 0, and the front image would be 255. So 0 * 0.5 + 255 * 0.5 = 127.5. Or is this not the case? Thanks David
  • Advertisement