Results 1 to 8 of 8

Thread: DX8 : General Tips

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118

    DX8 : General Tips

    Hi all

    Im just about to em,bark upon a project but b4 I start I was wondering if any1 could help me with a bit of advice:

    1) I assume hex colours are faster than using RGB(x,x,x) / D3DColorArgb(x,x,x,x). What tool can u use for calculating hex colour codes please?

    2) I realise to reduce overdraw it is best to draw the screen from back to front. Any tips on implementing this?

    3) I can calculate normals and use them when I use trianglelists but would have problems when using trianglestrips and index buffers. Any help on this 1 please?

    Thanks in advance

    Dan

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    Sorry I meant front to back

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    PS If two quads (I think this is the word for a flat square made up of 2 traingles) face the same direction will the vectors in quad1 have the same values as the vectors in quad2?

    Thanks

  4. #4
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    1) If you are a performance nut, they are faster, but if you are using VB, you arent a performance nut. Dont worry about it =).
    2)ZBuffering takes care of overdraw. When rendering alphablended particles, and you turn z writing off, over draw DOES become a problem. What you can do is transform all of the particle center points with the world and view matrices, and then sort by z coordinate.
    3) When one vertex is shared between several faces, its normal is the normalized average of all of its shared faces.
    4) Do you mean Normals? It depends. See 3.

    Z.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    Z

    Yeah I do mean normals for 4.

    Do u use normals and index buffers together Z? If so have u got some code for how u do this please. Otherwise I have to scrap using either triangle strips or lighting and I would like to use both.

    About 2 (but less important), I read that DX doesnt render stuff behind other stuff. However if u render the stuff at the back first it renders it and then also renders the front stuff whereas if u do the front stuff first it renders that then doesnt render the back stuff because it knows it is behind something.

    How do u go about rendering the stuff closest first?

    I was thinking of dividing the level into regions and rendering those regions closest to the cam first since they would be at the front.

    Like I say tho the normal thing is more important to me.

    Thanks

    Dan

  6. #6
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    I use indexed triangle lists for my models, and use normals. Do you know how to find the normal for a triangle? If so, it is just a simple matter to find a vertex normal. Simply find the face normals of all triangles that share that vertex, and average them. Set the vertex's normal to what you end up with.

    A ZBuffer will take care of overdraw. It will save you on drawing, but not transformation. If you want to save on transformation time, you need to look into some sort of culling algorithm. The only time you need to worry about overdraw is when you DONT use the ZBuffer.

    Z.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    Thanks Z u saved the day again

    Thats five pints I O U now right?

    Dan

  8. #8
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    =).

    Z.

Posting Permissions

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



Click Here to Expand Forum to Full Width