Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Vertex Transform vs SetTransform(D3DTS_WORLD..

  1. #11

    Vertex Transform vs SetTransform(D3DTS_WORLD..

    The main reason why method which uses WORLD transformation is faster is that more job is done on GPU, not on CPU. That is one thing you should always keep in mind when making rendering engine - do as much of work as you can on GPU!

    Also, you should keep CPU/GPU traffic as low as possible (that is one of reasons why indexed primitives are faster), so it's faster to send to GPU "render this vertex buffer" (assuming vertex buffer is created in DEFAULT or MANAGED pool) instead of "render this vertex buffer UP" (when you have to send all the data to GPU).


    hey also use D3DTS_WORLDMATRIX(index), but I still don't understand what is it for...
    It is used for skeletal animation. You first need to setup bones in your mesh and define WeightMap for each bone. After that, you set WorldMatrix for each bone (up to 256), and you let GPU to do the job


    And, don't forget - test, test, test!

    Best regards!
    blog: http://alexionne.blogspot.com/

  2. #12

    Vertex Transform vs SetTransform(D3DTS_WORLD..

    Generally if you draw less than 100 triangles with each DrawIndexedPrimitive call - it's better to pre-transform vertices on CPU to single vertex bufer and draw these several objects later with single DIP call. And this border value (of 100 vertices) tends to increase with increasing perfromance of GPU's.

    So in you case (drawing cube consisting of 12 triangles) it should be better if you transform vertices of many cubes on CPU and later draw them with one call to Draw{Indexed}Primitive.

    PS. This will not help if your box cover almost significant part of screen - in that case your application wil be limited by fillrate of pixelShader and Vertex transform perfromance does not matter in this case.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #13

    Vertex Transform vs SetTransform(D3DTS_WORLD..

    Thanks for the explanations ppl, now I'm sure that's the right method to transform vertices.

    Quote Originally Posted by chronozphere
    I am currently transforming my vertices using D3DXVec3Transform wich works fine.
    I was checking this post again, and found out that you use D3DXVec3Transform(). I use D3DXVec3TransformCoord() which returns a TD3DVector3, the other one returns a TD3DVector4. Is there a difference more than the returned type? Maybe I'm lossing soemthing on the operation. :?

  4. #14

    Vertex Transform vs SetTransform(D3DTS_WORLD..

    Code:
    I was checking this post again, and found out that you use D3DXVec3Transform(). I use D3DXVec3TransformCoord() which returns a TD3DVector3, the other one returns a TD3DVector4. Is there a difference more than the returned type? Maybe I'm lossing soemthing on the operation. Confused
    Oh..great tip I used the D3DXVec3Transform and after retrieving the TD3DVector4, i converted it to a normal vector, wich is inefficient.

    I will use the D3DXVec3TransformCoord() from now on.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •